macula_realm (macula v0.20.5)
View SourceRealm management and validation. Realms provide logical isolation boundaries in the mesh. Realm names follow reverse DNS notation (e.g., "org.example.mesh").
Summary
Functions
Check if two realm names are equal.
Decode realm name from binary.
Generate deterministic realm ID from name. Uses SHA-256 hash for 256-bit realm IDs.
Extract namespace (top-level domain) from realm name. Example: "org.example.mesh" -> "org"
Normalize realm name (lowercase, trim).
Encode realm name to binary.
Validate realm name format. Rules: - Reverse DNS notation (org.example.mesh) - Lowercase alphanumeric, dots, hyphens, underscores - No leading/trailing dots - No consecutive dots
Types
Functions
-spec equals(realm_name(), realm_name()) -> boolean().
Check if two realm names are equal.
-spec from_binary(binary()) -> {ok, realm_name()} | {error, term()}.
Decode realm name from binary.
-spec id(realm_name()) -> realm_id().
Generate deterministic realm ID from name. Uses SHA-256 hash for 256-bit realm IDs.
-spec namespace(realm_name()) -> binary().
Extract namespace (top-level domain) from realm name. Example: "org.example.mesh" -> "org"
-spec normalize(realm_name()) -> realm_name().
Normalize realm name (lowercase, trim).
-spec to_binary(realm_name()) -> binary().
Encode realm name to binary.
-spec validate(realm_name()) -> ok | {error, term()}.
Validate realm name format. Rules: - Reverse DNS notation (org.example.mesh) - Lowercase alphanumeric, dots, hyphens, underscores - No leading/trailing dots - No consecutive dots