1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Type aliases for actor communication channels.
use crateCommand;
use mpmc;
/// Default capacity for bounded mailboxes created by the `mailbox()` helper function.
/// This capacity applies to the single mailbox used by `SocketCore` and other simpler actors.
/// It can be tuned based on expected load and performance characteristics.
pub const DEFAULT_MAILBOX_CAPACITY: usize = 512;
/// The async sending end of an actor's mailbox.
/// Cloneable; used by Tokio tasks to send commands to `SocketCore`.
pub type MailboxSender = AsyncSender;
/// The sync sending end of an actor's mailbox.
/// Cloneable; used by OS threads (e.g. the io_uring worker) to send commands to `SocketCore`
/// across the sync/async boundary. The `fibre` runtime activates the correct cross-thread
/// waker when this variant is used, ensuring the Tokio task wakes up.
pub type MailboxSyncSender = Sender;
/// The receiving end of an actor's mailbox.
/// Only one task should typically own and receive from a `MailboxReceiver` to process commands sequentially.
pub type MailboxReceiver = AsyncReceiver;
// Note: The `SocketMailbox` struct and its associated constants
// (DEFAULT_SYSTEM_MAILBOX_CAPACITY, DEFAULT_USER_MAILBOX_CAPACITY)
// have been removed as part of the refactor to use a single command mailbox for SocketCore
// and to move system-level notifications to the EventBus.
/// Creates a new single bounded mailbox channel pair.
/// This is the standard way to create mailboxes for actors in this system, including `SocketCore`.
///
/// # Returns
/// A tuple containing the `MailboxSender` and `MailboxReceiver`.