Search documentation of macula

# macula_realm (macula v4.4.1)

View Source

Realm management and validation. Realms provide logical isolation boundaries in the mesh. Realm names follow reverse DNS notation (e.g., "org.example.mesh").

# Summary

## Types

realm_id/0

32-byte SHA-256 hash

realm_name/0

## Functions

equals(Realm1, Realm2)

Check if two realm names are equal.

from_binary(_)

Decode realm name from binary.

id(RealmName)

Generate deterministic realm ID from name. Uses SHA-256 hash for 256-bit realm IDs.

namespace(RealmName)

Extract namespace (top-level domain) from realm name. Example: "org.example.mesh" -> "org"

normalize(RealmName)

Normalize realm name (lowercase, trim).

to_binary(RealmName)

Encode realm name to binary.

validate(RealmName)

Validate realm name format. Rules: - Reverse DNS notation (org.example.mesh) - Lowercase alphanumeric, dots, hyphens, underscores - No leading/trailing dots - No consecutive dots

# Types

# realm_id/0

    -type realm_id() :: binary().

32-byte SHA-256 hash

# realm_name/0

    -type realm_name() :: binary().

# Functions

# equals(Realm1, Realm2)

    -spec equals(realm_name(), realm_name()) -> boolean().

Check if two realm names are equal.

# from_binary(_)

    -spec from_binary(binary()) -> {ok, realm_name()} | {error, term()}.

Decode realm name from binary.

# id(RealmName)

    -spec id(realm_name()) -> realm_id().

Generate deterministic realm ID from name. Uses SHA-256 hash for 256-bit realm IDs.

# namespace(RealmName)

    -spec namespace(realm_name()) -> binary().

Extract namespace (top-level domain) from realm name. Example: "org.example.mesh" -> "org"

# normalize(RealmName)

    -spec normalize(realm_name()) -> realm_name().

Normalize realm name (lowercase, trim).

# to_binary(RealmName)

    -spec to_binary(realm_name()) -> binary().

Encode realm name to binary.

# validate(RealmName)

    -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