Search documentation of macula

# macula_registry_manifest (macula v0.44.2)

View Source

Macula Registry Package Manifest

Handles parsing and validation of package manifests: - Manifest structure validation - Capability specification parsing - SemVer version validation - Dependency resolution

All functions are stateless.

# Summary

## Types

capability/0
dependency/0
manifest/0

## Functions

capability_matches(_, _)

Check if a capability pattern matches a specific capability Pattern can include wildcards: * matches any single segment, ** matches any segments

compare_versions(V1, V2)

Compare two SemVer versions Returns: lt (less than), eq (equal), gt (greater than)

from_binary(Binary)

Deserialize manifest from binary (MessagePack)

get_capabilities(_)

Get capabilities from manifest

get_dependencies(_)

Get dependencies from manifest

get_name(_)

Get package name from manifest

get_version(_)

Get package version from manifest

parse(Map)

Parse a manifest from a map (with atom or binary keys)

to_binary(Manifest)

Serialize manifest to binary (MessagePack)

validate(Manifest)

Validate a parsed manifest

validate_version(Version)

Validate SemVer version string

# Types

# capability/0

    -type capability() ::
              {network, [{connect, binary()}]} |
              {pubsub, [{publish | subscribe, binary()}]} |
              {rpc, [{register | call, binary()}]} |
              {nifs, [binary()]} |
              {file_access, [{read | write, binary()}]}.

# dependency/0

    -type dependency() :: #{name := binary(), version := binary(), registry => binary()}.

# manifest/0

    -type manifest() ::
              #{name := binary(),
                version := binary(),
                otp_release => binary(),
                macula_version => binary(),
                capabilities := [capability()],
                dependencies := [dependency()],
                entry_module := atom(),
                supervisor := atom(),
                description => binary(),
                license => binary(),
                authors => [binary()]}.

# Functions

# capability_matches(_, _)

    -spec capability_matches(capability(), capability()) -> boolean().

Check if a capability pattern matches a specific capability Pattern can include wildcards: * matches any single segment, ** matches any segments

# compare_versions(V1, V2)

    -spec compare_versions(binary(), binary()) -> lt | eq | gt | {error, term()}.

Compare two SemVer versions Returns: lt (less than), eq (equal), gt (greater than)

# from_binary(Binary)

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

Deserialize manifest from binary (MessagePack)

# get_capabilities(_)

    -spec get_capabilities(manifest()) -> [capability()].

Get capabilities from manifest

# get_dependencies(_)

    -spec get_dependencies(manifest()) -> [dependency()].

Get dependencies from manifest

# get_name(_)

    -spec get_name(manifest()) -> binary().

Get package name from manifest

# get_version(_)

    -spec get_version(manifest()) -> binary().

Get package version from manifest

# parse(Map)

    -spec parse(map()) -> {ok, manifest()} | {error, term()}.

Parse a manifest from a map (with atom or binary keys)

# to_binary(Manifest)

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

Serialize manifest to binary (MessagePack)

# validate(Manifest)

    -spec validate(manifest()) -> ok | {error, term()}.

Validate a parsed manifest

# validate_version(Version)

    -spec validate_version(binary()) -> ok | {error, invalid_version}.

Validate SemVer version string