sigil-czac · flow
Source declarations, signatures and documentation for flow.
Source: sigil/node/sigil-czac/src/flow.rs. SHA-256: ef935128d1b14110dc355f149051894b62bb46de0488715086f84ab105ac2785.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
flow::DEFAULT_INITIAL_CREDITS
Default initial credits per channel.
pub const DEFAULT_INITIAL_CREDITS: u64;Source line: 18.
flow::DEFAULT_MAX_CREDITS
Default maximum credits per channel.
pub const DEFAULT_MAX_CREDITS: u64;Source line: 21.
flow::Priority
Message priority levels.
Lower numeric value = higher priority. Critical messages are always dequeued before High, High before Normal, Normal before Low.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Priority {
/// Highest priority — system-critical messages.
Critical = 0,
/// High priority — time-sensitive messages.
High = 1,
/// Normal priority — default for application messages.
Normal = 2,
/// Low priority — background/bulk transfers.
Low = 3,
}Source line: 31.
flow::Priority::COUNT
Number of priority levels.
pub const COUNT: usize;Source line: 44.
flow::Priority::from_index
Convert from a numeric index.
pub fn from_index(idx: usize) -> Result<Self, CzacError>;Source line: 47.
flow::FlowController
Credit-based flow controller with priority queues.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FlowController {
/// Initial credits assigned when the channel opens.
pub initial_credits: u64,
/// Currently available send credits.
pub available_credits: u64,
/// Maximum credits that can be accumulated.
pub max_credits: u64,
/// Congestion window (for adaptive flow control).
pub window_size: u64,
/// Four priority queues: [Critical, High, Normal, Low].
pub priority_queues: [VecDeque<Vec<u8>>; 4]
}Source line: 62.
flow::FlowController::new
Create a new flow controller with the given credit limits.
pub fn new(initial_credits: u64, max_credits: u64) -> Self;Source line: 77.
flow::FlowController::can_send
Check whether there are credits available to send.
pub fn can_send(&self) -> bool;Source line: 93.
flow::FlowController::consume_credit
Consume one send credit.
pub fn consume_credit(&mut self) -> Result<(), CzacError>;Source line: 98.
flow::FlowController::replenish
Replenish credits (called when the remote acknowledges messages).
Credits are capped at max_credits.
pub fn replenish(&mut self, amount: u64);Source line: 112.
flow::FlowController::enqueue
Enqueue a message at the given priority.
Returns an error if the total queue depth exceeds the maximum.
pub fn enqueue(&mut self, data: Vec<u8>, priority: Priority) -> Result<(), CzacError>;Source line: 122.
flow::FlowController::dequeue
Dequeue the highest-priority message.
Returns None if all queues are empty.
pub fn dequeue(&mut self) -> Option<(Priority, Vec<u8>)>;Source line: 134.
flow::FlowController::queue_depth
Total number of messages across all priority queues.
pub fn queue_depth(&self) -> usize;Source line: 146.
flow::FlowController::is_backpressured
Check whether backpressure should be applied.
Returns true if either credits are exhausted or queues are deep.
pub fn is_backpressured(&self) -> bool;Source line: 153.
flow::FlowController::queue_depth_for
Returns the number of messages in a specific priority queue.
pub fn queue_depth_for(&self, priority: Priority) -> usize;Source line: 158.