Parrhesia.Storage.Moderation behaviour (parrhesia v0.12.0)

Copy Markdown

Storage callbacks for moderation and access-control state.

Summary

Types

context()

@type context() :: map()

event_id()

@type event_id() :: binary()

ip_address()

@type ip_address() :: binary()

pubkey()

@type pubkey() :: binary()

reason()

@type reason() :: term()

Callbacks

allow_pubkey(context, pubkey)

@callback allow_pubkey(context(), pubkey()) :: :ok | {:error, reason()}

ban_event(context, event_id)

@callback ban_event(context(), event_id()) :: :ok | {:error, reason()}

ban_pubkey(context, pubkey)

@callback ban_pubkey(context(), pubkey()) :: :ok | {:error, reason()}

block_ip(context, ip_address)

@callback block_ip(context(), ip_address()) :: :ok | {:error, reason()}

disallow_pubkey(context, pubkey)

@callback disallow_pubkey(context(), pubkey()) :: :ok | {:error, reason()}

event_banned?(context, event_id)

@callback event_banned?(context(), event_id()) :: {:ok, boolean()} | {:error, reason()}

has_allowed_pubkeys?(context)

@callback has_allowed_pubkeys?(context()) :: {:ok, boolean()} | {:error, reason()}

ip_blocked?(context, ip_address)

@callback ip_blocked?(context(), ip_address()) :: {:ok, boolean()} | {:error, reason()}

pubkey_allowed?(context, pubkey)

@callback pubkey_allowed?(context(), pubkey()) :: {:ok, boolean()} | {:error, reason()}

pubkey_banned?(context, pubkey)

@callback pubkey_banned?(context(), pubkey()) :: {:ok, boolean()} | {:error, reason()}

unban_event(context, event_id)

@callback unban_event(context(), event_id()) :: :ok | {:error, reason()}

unban_pubkey(context, pubkey)

@callback unban_pubkey(context(), pubkey()) :: :ok | {:error, reason()}

unblock_ip(context, ip_address)

@callback unblock_ip(context(), ip_address()) :: :ok | {:error, reason()}