Search documentation of macula

# macula_names (macula v4.4.1)

View Source

Shared naming utilities for hierarchical dot-separated names. Used by both pub/sub topics and RPC procedure names. Supports DNS-style reverse notation: org.domain.service.method

# Summary

## Types

name/0
options/0

## Functions

local_node_id()

Get the local node ID. Returns the node ID stored in persistent_term, or generates one if not set. This is used for NAT detection to identify the local node.

namespace(Name)

Extract namespace (first segment).

normalize(Name)

Normalize name (lowercase, trim, remove double dots).

segment_count(Name)

Count number of segments in name.

validate(Name)

Validate name syntax with default options (no wildcards).

validate(Name, Opts)

Validate name syntax with options. Valid names: - Non-empty - Segments separated by dots - Segments contain alphanumeric, underscore, hyphen - Optionally allow wildcards (* and #) for patterns - No leading or trailing dots - No double dots

# Types

# name/0

    -type name() :: binary().

# options/0

    -type options() :: #{allow_wildcards => boolean()}.

# Functions

# local_node_id()

    -spec local_node_id() -> binary().

Get the local node ID. Returns the node ID stored in persistent_term, or generates one if not set. This is used for NAT detection to identify the local node.

# namespace(Name)

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

Extract namespace (first segment).

# normalize(Name)

    -spec normalize(name()) -> name().

Normalize name (lowercase, trim, remove double dots).

# segment_count(Name)

    -spec segment_count(name()) -> non_neg_integer().

Count number of segments in name.

# validate(Name)

    -spec validate(name()) -> ok | {error, invalid_name}.

Validate name syntax with default options (no wildcards).

# validate(Name, Opts)

    -spec validate(name(), options()) -> ok | {error, invalid_name}.

Validate name syntax with options. Valid names: - Non-empty - Segments separated by dots - Segments contain alphanumeric, underscore, hyphen - Optionally allow wildcards (* and #) for patterns - No leading or trailing dots - No double dots