pub trait ConnectionServices:
Debug
+ Send
+ Sync {
// Required methods
fn publish(
&self,
channel: &str,
envelope: &MessageEnvelope,
idempotency_key: Option<&str>,
) -> Result<PublishOutcome, ServerError>;
fn subscribe(
&self,
channel: &str,
accepted_schemas: &[ProtocolSchemaId],
install: Option<InboxInstall>,
) -> Result<ConnectionSubscription, ServerError>;
fn unsubscribe(
&self,
subscription: ConnectionSubscription,
) -> Result<(), ServerError>;
fn open_conversation(
&self,
conversation_id: u64,
subject: &str,
) -> Result<ConnectionConversation, ServerError>;
fn conversation_message(
&self,
conversation: &ConnectionConversation,
envelope: &MessageEnvelope,
) -> Result<(), ServerError>;
fn close_conversation(
&self,
conversation: ConnectionConversation,
) -> Result<(), ServerError>;
fn flush_durable_state(&self) -> Result<(), ServerError>;
// Provided method
fn supports_channel_operations(&self) -> bool { ... }
}Expand description
Operations that adapt wire frames to liminal library calls.
Required Methods§
Sourcefn publish(
&self,
channel: &str,
envelope: &MessageEnvelope,
idempotency_key: Option<&str>,
) -> Result<PublishOutcome, ServerError>
fn publish( &self, channel: &str, envelope: &MessageEnvelope, idempotency_key: Option<&str>, ) -> Result<PublishOutcome, ServerError>
Delegates a publish request to the liminal library.
idempotency_key, when Some, drives dedup-on-delivery: a re-publish with
the same key is delivered to subscribers at most once. The returned
PublishOutcome carries the genuine delivery ack.
§Errors
Returns ServerError when the liminal publish operation fails.
Sourcefn subscribe(
&self,
channel: &str,
accepted_schemas: &[ProtocolSchemaId],
install: Option<InboxInstall>,
) -> Result<ConnectionSubscription, ServerError>
fn subscribe( &self, channel: &str, accepted_schemas: &[ProtocolSchemaId], install: Option<InboxInstall>, ) -> Result<ConnectionSubscription, ServerError>
Delegates a subscribe request to the liminal library.
install, when Some, carries the connection’s §5 shared inbox byte
budget, per-inbox fairness cap, and R3 wake notifier. The implementation
MUST install it on the subscription’s inbox BEFORE the registration is
published to the channel actor (i.e. before any envelope can be
delivered), so no envelope is ever admitted uncharged, past the depth
cap, or without a wake. Implementations with no real inbox (test
stand-ins, capability-scoped profiles that refuse subscribe) may ignore
it.
§Errors
Returns ServerError when the liminal subscribe operation fails.
Sourcefn unsubscribe(
&self,
subscription: ConnectionSubscription,
) -> Result<(), ServerError>
fn unsubscribe( &self, subscription: ConnectionSubscription, ) -> Result<(), ServerError>
Delegates unsubscribe to the liminal library.
§Errors
Returns ServerError when the liminal unsubscribe operation fails.
Sourcefn open_conversation(
&self,
conversation_id: u64,
subject: &str,
) -> Result<ConnectionConversation, ServerError>
fn open_conversation( &self, conversation_id: u64, subject: &str, ) -> Result<ConnectionConversation, ServerError>
Delegates conversation open to the liminal library.
§Errors
Returns ServerError when the liminal conversation open operation fails.
Sourcefn conversation_message(
&self,
conversation: &ConnectionConversation,
envelope: &MessageEnvelope,
) -> Result<(), ServerError>
fn conversation_message( &self, conversation: &ConnectionConversation, envelope: &MessageEnvelope, ) -> Result<(), ServerError>
Delegates a conversation message to the liminal library.
§Errors
Returns ServerError when the liminal conversation message operation fails.
Sourcefn close_conversation(
&self,
conversation: ConnectionConversation,
) -> Result<(), ServerError>
fn close_conversation( &self, conversation: ConnectionConversation, ) -> Result<(), ServerError>
Delegates conversation close to the liminal library.
§Errors
Returns ServerError when the liminal conversation close operation fails.
Sourcefn flush_durable_state(&self) -> Result<(), ServerError>
fn flush_durable_state(&self) -> Result<(), ServerError>
Flushes durable channel state through the liminal library boundary.
§Errors
Returns ServerError when the liminal channel flush operation fails.
Provided Methods§
Sourcefn supports_channel_operations(&self) -> bool
fn supports_channel_operations(&self) -> bool
Whether this adapter backs ordinary channel and conversation operations.
The default is true — the full-service adapter serves publish, subscribe,
and conversation frames, so full mode is byte-for-byte unchanged. The
capability-scoped worker front door overrides this to false, letting
[super::apply] reject the channel/conversation frames it short-circuits on
empty connection state (Unsubscribe, ConversationMessage,
ConversationClose) with a typed error frame instead of silently swallowing
an operation for a resource that could never have been created in this
profile. Frames that always reach a service method (Publish, Subscribe,
ConversationOpen) are rejected by the front door’s own method bodies and do
not consult this flag.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".