pub struct RuntimeContext { /* private fields */ }Expand description
Implementations§
Source§impl RuntimeContext
impl RuntimeContext
Sourcepub fn new(
self_id: ActrId,
caller_id: Option<ActrId>,
request_id: String,
inproc_gate: OutGate,
outproc_gate: Option<OutGate>,
data_stream_registry: Arc<DataStreamRegistry>,
media_frame_registry: Arc<MediaFrameRegistry>,
signaling_client: Arc<dyn SignalingClient>,
credential: AIdCredential,
actr_lock: Option<LockFile>,
config_dir: Option<PathBuf>,
) -> Self
pub fn new( self_id: ActrId, caller_id: Option<ActrId>, request_id: String, inproc_gate: OutGate, outproc_gate: Option<OutGate>, data_stream_registry: Arc<DataStreamRegistry>, media_frame_registry: Arc<MediaFrameRegistry>, signaling_client: Arc<dyn SignalingClient>, credential: AIdCredential, actr_lock: Option<LockFile>, config_dir: Option<PathBuf>, ) -> Self
创建新的 RuntimeContext
§参数
self_id: 当前 Actor 的 IDcaller_id: 调用方 Actor ID(可选)request_id: 当前请求唯一 IDinproc_gate: 进程内通信 gate(立即可用)outproc_gate: 跨进程通信 gate(可能为 None,等待 WebRTC 初始化)data_stream_registry: DataStream 回调注册表media_frame_registry: MediaTrack 回调注册表signaling_client: 用于路由发现的信令客户端credential: 该 Actor 的凭证(调用信令接口时使用)actr_lock: Actr.lock.toml 依赖配置(用于 fingerprint 查找)config_dir: 配置目录路径(用于 compat.lock.toml Fast Path 缓存)
Sourcepub async fn call_raw(
&self,
target: &Dest,
route_key: String,
payload_type: PayloadType,
payload: Bytes,
timeout_ms: i64,
) -> ActorResult<Bytes>
pub async fn call_raw( &self, target: &Dest, route_key: String, payload_type: PayloadType, payload: Bytes, timeout_ms: i64, ) -> ActorResult<Bytes>
Execute a non-generic RPC request call (useful for language bindings).
Sourcepub async fn tell_raw(
&self,
target: &Dest,
route_key: String,
payload_type: PayloadType,
payload: Bytes,
) -> ActorResult<()>
pub async fn tell_raw( &self, target: &Dest, route_key: String, payload_type: PayloadType, payload: Bytes, ) -> ActorResult<()>
Execute a non-generic RPC message call (fire-and-forget, useful for language bindings).
Sourcepub async fn send_data_stream_with_type(
&self,
target: &Dest,
payload_type: PayloadType,
chunk: DataStream,
) -> ActorResult<()>
pub async fn send_data_stream_with_type( &self, target: &Dest, payload_type: PayloadType, chunk: DataStream, ) -> ActorResult<()>
Send DataStream with an explicit payload type (lane selection).
This is intended for language bindings; the Context trait method
send_data_stream() currently defaults to StreamReliable.
Trait Implementations§
Source§impl Clone for RuntimeContext
impl Clone for RuntimeContext
Source§fn clone(&self) -> RuntimeContext
fn clone(&self) -> RuntimeContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Context for RuntimeContext
impl Context for RuntimeContext
Source§fn request_id(&self) -> &str
fn request_id(&self) -> &str
Get the unique request ID Read more
Source§fn call<'life0, 'life1, 'async_trait, R>(
&'life0 self,
target: &'life1 Dest,
request: R,
) -> Pin<Box<dyn Future<Output = ActorResult<R::Response>> + Send + 'async_trait>>where
R: 'async_trait + RpcRequest,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call<'life0, 'life1, 'async_trait, R>(
&'life0 self,
target: &'life1 Dest,
request: R,
) -> Pin<Box<dyn Future<Output = ActorResult<R::Response>> + Send + 'async_trait>>where
R: 'async_trait + RpcRequest,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a type-safe RPC request and wait for response Read more
Source§fn tell<'life0, 'life1, 'async_trait, R>(
&'life0 self,
target: &'life1 Dest,
message: R,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
R: 'async_trait + RpcRequest,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn tell<'life0, 'life1, 'async_trait, R>(
&'life0 self,
target: &'life1 Dest,
message: R,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
R: 'async_trait + RpcRequest,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a type-safe one-way message (no response expected) Read more
Source§fn register_stream<'life0, 'async_trait, F>(
&'life0 self,
stream_id: String,
callback: F,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
F: Fn(DataStream, ActrId) -> BoxFuture<'static, ActorResult<()>> + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn register_stream<'life0, 'async_trait, F>(
&'life0 self,
stream_id: String,
callback: F,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
F: Fn(DataStream, ActrId) -> BoxFuture<'static, ActorResult<()>> + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Register a DataStream callback for a specific stream Read more
Source§fn unregister_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
stream_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unregister_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
stream_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Unregister a DataStream callback Read more
Source§fn send_data_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
chunk: DataStream,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_data_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
chunk: DataStream,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a DataStream to a destination Read more
Source§fn discover_route_candidate<'life0, 'life1, 'async_trait>(
&'life0 self,
target_type: &'life1 ActrType,
) -> Pin<Box<dyn Future<Output = ActorResult<ActrId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn discover_route_candidate<'life0, 'life1, 'async_trait>(
&'life0 self,
target_type: &'life1 ActrType,
) -> Pin<Box<dyn Future<Output = ActorResult<ActrId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Discover a remote Actor of the specified type via the signaling server. Read more
Source§fn call_raw<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 ActrId,
route_key: &'life2 str,
payload: Bytes,
) -> Pin<Box<dyn Future<Output = ActorResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn call_raw<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 ActrId,
route_key: &'life2 str,
payload: Bytes,
) -> Pin<Box<dyn Future<Output = ActorResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Send a raw RPC request (untyped bytes) and wait for response Read more
Source§fn register_media_track<'life0, 'async_trait, F>(
&'life0 self,
track_id: String,
callback: F,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
F: Fn(MediaSample, ActrId) -> BoxFuture<'static, ActorResult<()>> + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn register_media_track<'life0, 'async_trait, F>(
&'life0 self,
track_id: String,
callback: F,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
F: Fn(MediaSample, ActrId) -> BoxFuture<'static, ActorResult<()>> + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Register a WebRTC native media track callback Read more
Source§fn unregister_media_track<'life0, 'life1, 'async_trait>(
&'life0 self,
track_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unregister_media_track<'life0, 'life1, 'async_trait>(
&'life0 self,
track_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Unregister a media track callback Read more
Source§fn send_media_sample<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
track_id: &'life2 str,
sample: MediaSample,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_media_sample<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
track_id: &'life2 str,
sample: MediaSample,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Send media samples via WebRTC native track Read more
Auto Trait Implementations§
impl !Freeze for RuntimeContext
impl !RefUnwindSafe for RuntimeContext
impl Send for RuntimeContext
impl Sync for RuntimeContext
impl Unpin for RuntimeContext
impl !UnwindSafe for RuntimeContext
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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