macula_rpc_names (macula v0.20.5)

View Source

Name validation and utilities for RPC procedures. Uses reverse DNS notation: org.domain.service.procedure

Summary

Functions

Check if name matches pattern. For now, only exact matching (no wildcards). Future: Could add wildcard patterns if needed.

Extract namespace (first segment).

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

Count number of segments in name.

Validate RPC procedure name syntax. Valid names: - Non-empty - Segments separated by dots - Segments contain alphanumeric, underscore, hyphen - No leading or trailing dots - No double dots - No wildcards allowed (unlike topics)

Types

name/0

-type name() :: binary().

Functions

matches(Name, Pattern)

-spec matches(name(), name()) -> boolean().

Check if name matches pattern. For now, only exact matching (no wildcards). Future: Could add wildcard patterns if needed.

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 RPC procedure name syntax. Valid names: - Non-empty - Segments separated by dots - Segments contain alphanumeric, underscore, hyphen - No leading or trailing dots - No double dots - No wildcards allowed (unlike topics)