macula_names (macula v11.5.0)

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

Functions

Extract namespace (first segment).

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

Count number of segments in name.

Validate name syntax with default options (no wildcards).

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

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