ContextFactory

Struct ContextFactory 

Source
pub struct ContextFactory { /* private fields */ }
Expand description

Context factory

§职责

  • 创建 RuntimeContext 实例
  • 注入 OutGate(enum dispatch,零虚函数)
  • 管理默认配置

Implementations§

Source§

impl ContextFactory

Source

pub fn new( inproc_gate: OutGate, shell_to_workload: Arc<InprocTransportManager>, workload_to_shell: Arc<InprocTransportManager>, data_stream_registry: Arc<DataStreamRegistry>, media_frame_registry: Arc<MediaFrameRegistry>, signaling_client: Arc<dyn SignalingClient>, ) -> Self

创建新的 ContextFactory

§参数
  • inproc_gate: 进程内通信 gate(Dest::Shell/Local)- 立即可用
  • shell_to_workload: Shell → Workload 方向的传输管理器
  • workload_to_shell: Workload → Shell 方向的传输管理器
  • data_stream_registry: DataStream 回调注册表
  • media_frame_registry: MediaTrack 回调注册表
§设计说明
  • inproc_gate: 在 ActrSystem::new() 时创建,立即可用(Shell/Local 通信不需要 ActorId)
  • outproc_gate: 初始为 None,在 ActrNode::start() WebRTC 初始化完成后设置
  • 双向 InprocTransportManager: 确保 Shell 和 Workload 的 pending_requests 完全分离
  • data_stream_registry: 管理 DataStream 回调,支持应用数据流传输
  • media_frame_registry: 管理 MediaTrack 回调,支持 WebRTC 原生媒体流
Source

pub fn set_outproc_gate(&mut self, gate: OutGate)

设置跨进程通信 gate

§用途

ActrNode::start() 完成 WebRTC 初始化后调用

Source

pub fn set_actr_lock(&mut self, actr_lock: LockFile)

设置 Actr.lock.toml 文件

§用途

ActrNode::start() 时调用,用于 discover_route_candidate 获取依赖 fingerprint

Source

pub fn set_config_dir(&mut self, config_dir: PathBuf)

设置配置目录路径

§用途

ActrNode::start() 时调用,用于 compat.lock.toml Fast Path 缓存

Source

pub fn shell_to_workload(&self) -> Arc<InprocTransportManager>

获取 Shell → Workload 方向的传输管理器

Source

pub fn workload_to_shell(&self) -> Arc<InprocTransportManager>

获取 Workload → Shell 方向的传输管理器

Source

pub fn create( &self, self_id: &ActrId, caller_id: Option<&ActrId>, request_id: &str, credential: &AIdCredential, ) -> RuntimeContext

创建 Context(用于消息处理)

§参数
  • self_id: 当前 Actor ID
  • caller_id: 调用方 Actor ID(可选)
  • request_id: 请求唯一 ID
§返回

返回 RuntimeContext 实例(实现了 Context trait)

Source

pub fn create_bootstrap( &self, self_id: &ActrId, credential: &AIdCredential, ) -> RuntimeContext

创建引导 Context(用于生命周期钩子)

§用途

用于 on_start/on_stop 钩子,无 caller_id

Trait Implementations§

Source§

impl Clone for ContextFactory

Source§

fn clone(&self) -> ContextFactory

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more