Skip to main content

ChannelCore

Trait ChannelCore 

Source
pub trait ChannelCore {
Show 16 methods // Required methods fn id(&self) -> ChannelId; fn principal(&self) -> &Principal; fn state(&self) -> &ChannelState; fn config(&self) -> &ChannelConfig; fn parent(&self) -> Option<ChannelId>; fn children(&self) -> &HashSet<ChannelId>; fn ancestor_path(&self) -> &[ChannelId]; // Provided methods fn is_running(&self) -> bool { ... } fn is_paused(&self) -> bool { ... } fn is_awaiting_approval(&self) -> bool { ... } fn is_terminal(&self) -> bool { ... } fn priority(&self) -> u8 { ... } fn can_spawn(&self) -> bool { ... } fn has_children(&self) -> bool { ... } fn depth(&self) -> usize { ... } fn is_descendant_of(&self, ancestor: ChannelId) -> bool { ... }
}
Expand description

Core channel interface.

This trait defines the essential operations that all channel types must support. It provides a common interface for state queries, tree navigation, and lifecycle management.

§Implementors

  • BaseChannel: Basic channel with state and tree management

For Human-interactive channels, use ClientRunner which owns a BaseChannel internally.

§Example

use orcs_runtime::channel::ChannelCore;

fn process_channel(channel: &impl ChannelCore) {
    println!("Channel {} is running: {}", channel.id(), channel.is_running());
    println!("Principal: {:?}", channel.principal());
}

Required Methods§

Source

fn id(&self) -> ChannelId

Returns the channel’s unique identifier.

Source

fn principal(&self) -> &Principal

Returns the principal associated with this channel.

The principal is used for scope resolution and permission checks.

Source

fn state(&self) -> &ChannelState

Returns a reference to the current state.

Source

fn config(&self) -> &ChannelConfig

Returns a reference to the channel’s configuration.

Source

fn parent(&self) -> Option<ChannelId>

Returns the parent channel’s ID, if any.

Source

fn children(&self) -> &HashSet<ChannelId>

Returns a reference to the set of child channel IDs.

Source

fn ancestor_path(&self) -> &[ChannelId]

Returns the cached ancestor path.

The path is ordered: [parent, grandparent, ..., root].

Provided Methods§

Source

fn is_running(&self) -> bool

Returns true if the channel is in Running state.

Source

fn is_paused(&self) -> bool

Returns true if the channel is in Paused state.

Source

fn is_awaiting_approval(&self) -> bool

Returns true if the channel is in AwaitingApproval state.

Source

fn is_terminal(&self) -> bool

Returns true if the channel is in a terminal state (Completed or Aborted).

Source

fn priority(&self) -> u8

Returns the scheduling priority (0-255).

Source

fn can_spawn(&self) -> bool

Returns whether this channel can spawn children.

Source

fn has_children(&self) -> bool

Returns true if this channel has any children.

Source

fn depth(&self) -> usize

Returns the depth of this channel in the tree.

Source

fn is_descendant_of(&self, ancestor: ChannelId) -> bool

Returns true if this channel is a descendant of the given ancestor.

Implementors§