Wardrik.Definitions (wardrik v0.1.0-rc.1)

Copy Markdown

Stores each agent's definition as it was given.

Summary

Functions

Returns the name of the policy that bounds the agent id, or nil.

Removes the agent id's definition, and its boundary. Removing none is :ok.

Returns the agent id's definition, or :error if it has none.

Returns the IDs of the agents with a definition.

Stores definition for the agent id.

Stores the agent id's boundary: the policy named by the token that defined it.

Functions

boundary(wardrik, id)

@spec boundary(Wardrik.t(), String.t()) :: String.t() | map() | nil

Returns the name of the policy that bounds the agent id, or nil.

delete(wardrik, id)

@spec delete(Wardrik.t(), String.t()) :: :ok | {:error, term()}

Removes the agent id's definition, and its boundary. Removing none is :ok.

fetch(wardrik, id)

@spec fetch(Wardrik.t(), String.t()) :: {:ok, map()} | :error

Returns the agent id's definition, or :error if it has none.

ids(wardrik)

@spec ids(Wardrik.t()) :: [String.t()]

Returns the IDs of the agents with a definition.

put(wardrik, id, definition)

@spec put(Wardrik.t(), String.t(), map()) :: :ok | {:error, term()}

Stores definition for the agent id.

put_boundary(wardrik, id, name)

@spec put_boundary(Wardrik.t(), String.t(), String.t() | map()) ::
  :ok | {:error, term()}

Stores the agent id's boundary: the policy named by the token that defined it.