Behaviour for version-specific lifecycle, admission, routing, and wire shaping.
Dialects are supplied explicitly to a runtime. Merely loading a dialect module never enables it.
Summary
Callbacks
Optional shaping of an active request's progress notification, independent of subscriptions.
Optional post-handler admission for dialect-specific result variants and capabilities.
Functions
Returns the exact profiles bundled in-tree, independent of a runtime allowlist.
Returns the bundled profile versions in preference order.
Returns the untouched _meta map or an empty map.
Callbacks
@callback build_context(Snodo.Envelope.t(), Snodo.Server.Runtime.t()) :: {:ok, Snodo.Context.t()} | {:error, Snodo.Error.t()}
@callback decode_request(map(), Snodo.Transport.Context.t()) :: {:ok, Snodo.Envelope.t()} | {:error, Snodo.Error.t()}
@callback detect(Snodo.Envelope.t()) :: :exact | :fallback | false
@callback era() :: :session | :stateless
@callback profile() :: Snodo.Protocol.Profile.t()
@callback resolve_operation(Snodo.Envelope.t()) :: {:ok, term()} | :not_handled | {:error, Snodo.Error.t()}
@callback server_discovery(Snodo.Server.Runtime.t()) :: map() | :unsupported
@callback shape_error(Snodo.Error.t(), Snodo.Context.t() | nil) :: map()
@callback shape_progress(String.t() | integer(), map(), Snodo.Context.t()) :: map()
Optional shaping of an active request's progress notification, independent of subscriptions.
@callback shape_result(term(), Snodo.Result.t(), Snodo.Context.t()) :: map()
@callback shape_subscription_ack(map(), Snodo.Envelope.id(), Snodo.Context.t()) :: map()
@callback shape_subscription_event( Snodo.Subscription.Event.t(), Snodo.Envelope.id(), Snodo.Context.t() ) :: map()
@callback shape_subscription_result(Snodo.Envelope.id(), Snodo.Context.t()) :: map()
@callback transport_policy(Snodo.Envelope.t() | nil) :: Snodo.Transport.Policy.t()
@callback validate_operation(term(), map(), Snodo.Context.t()) :: :ok | {:error, Snodo.Error.t()}
@callback validate_result(term(), Snodo.Result.t(), Snodo.Context.t()) :: :ok | {:error, Snodo.Error.t()}
Optional post-handler admission for dialect-specific result variants and capabilities.
@callback version() :: String.t()
Functions
@spec builtin_profiles() :: [Snodo.Protocol.Profile.t()]
Returns the exact profiles bundled in-tree, independent of a runtime allowlist.
@spec builtin_versions() :: [String.t()]
Returns the bundled profile versions in preference order.
@spec request_meta(Snodo.Envelope.t()) :: map()
Returns the untouched _meta map or an empty map.