LemonCore.PolicyStore (lemon_core v0.1.0)

View Source

Typed wrapper for policy domain storage.

Provides scoped access to agent, channel, session, and runtime policies stored in LemonCore.Store.

Summary

Functions

Deletes the runtime policy.

Deletes the policy for the given session.

Fetches the policy for the given agent, or nil if not set.

Fetches the policy for the given channel, or nil if not set.

Fetches the runtime policy, or nil if not set.

Fetches the policy for the given session, or nil if not set.

Stores a policy for the given agent.

Stores a policy for the given channel.

Stores the runtime policy.

Stores a policy for the given session.

Functions

delete_runtime()

@spec delete_runtime() :: :ok

Deletes the runtime policy.

delete_session(session_key)

@spec delete_session(binary()) :: :ok

Deletes the policy for the given session.

get_agent(agent_id)

@spec get_agent(binary()) :: map() | nil

Fetches the policy for the given agent, or nil if not set.

get_channel(channel_id)

@spec get_channel(binary()) :: map() | nil

Fetches the policy for the given channel, or nil if not set.

get_runtime()

@spec get_runtime() :: map() | nil

Fetches the runtime policy, or nil if not set.

get_session(session_key)

@spec get_session(binary()) :: map() | nil

Fetches the policy for the given session, or nil if not set.

put_agent(agent_id, policy)

@spec put_agent(binary(), map()) :: :ok | {:error, term()}

Stores a policy for the given agent.

put_channel(channel_id, policy)

@spec put_channel(binary(), map()) :: :ok | {:error, term()}

Stores a policy for the given channel.

put_runtime(policy)

@spec put_runtime(map()) :: :ok | {:error, term()}

Stores the runtime policy.

put_session(session_key, policy)

@spec put_session(binary(), map()) :: :ok | {:error, term()}

Stores a policy for the given session.