pub enum ShardCommand {
Attach {
connection: ConnectionId,
queue: Arc<OutboundQueue>,
cursor: Arc<AtomicU64>,
held: ShardView,
ready: Option<Sender<()>>,
},
Detach {
connection: ConnectionId,
reason: String,
handover: Option<Handover>,
},
Drained(ConnectionId),
Requested {
connection: ConnectionId,
channel: ChannelId,
},
RequestedSelfState {
connection: ConnectionId,
self_mute: Option<bool>,
self_deaf: Option<bool>,
},
QueriedPermissions {
connection: ConnectionId,
channel: ChannelId,
},
QueriedUserStats {
connection: ConnectionId,
target: SessionId,
},
InvokedAction {
connection: ConnectionId,
action: String,
session: Option<SessionId>,
channel: Option<ChannelId>,
},
Said {
connection: ConnectionId,
to: TextTarget,
message: String,
},
}Expand description
A command for a shard’s task.
Variants§
Attach
Fields
connection: ConnectionIdqueue: Arc<OutboundQueue>Shared with the connection’s writer task, which is what lets a migration hand the same queue to the next shard.
cursor: Arc<AtomicU64>The cell the voice plane gates on. Owned by the runtime rather than by the shard, so a migration does not have to republish it.
Detach
Fields
connection: ConnectionIdDrained(ConnectionId)
A connection’s queue drained: retry for that one alone, in O(1).
Requested
The client asked to enter a channel. Resolved against this connection’s own view and reported to the flavor, or refused.
RequestedSelfState
The client asked to mute or deafen itself. Reported to the flavor, which alone decides what the view ends up saying.
QueriedPermissions
The client asked what it may do in a channel. Answered from the render, for that connection alone.
QueriedUserStats
The client asked what the server publishes about a user. Answered only for a user this connection can actually see.
InvokedAction
The client invoked a context action. Validated against what this connection was offered and what it can see, then reported to the flavor.
The wire identifier travels as it arrived: the gateway does not know which actions exist, and reading it back is part of the validation.
Fields
connection: ConnectionIdSaid
The client sent a text message. Resolved against this connection’s own view and reported to the flavor, or refused.
The gateway has already checked the shape, the length and the rate; what is left is the only question it cannot answer, which is whether this connection may name that target at all.
Implementations§
Source§impl ShardCommand
impl ShardCommand
Sourcepub fn attach(
connection: ConnectionId,
queue: Arc<OutboundQueue>,
) -> ShardCommand
pub fn attach( connection: ConnectionId, queue: Arc<OutboundQueue>, ) -> ShardCommand
Attach a connection that holds nothing yet: a fresh arrival.
Sourcepub fn detach(
connection: ConnectionId,
reason: impl Into<String>,
) -> ShardCommand
pub fn detach( connection: ConnectionId, reason: impl Into<String>, ) -> ShardCommand
Detach a connection that is leaving for good.