pub struct DefaultSandboxRuntime { /* private fields */ }Expand description
默认沙箱运行时实现
使用进程隔离和资源限制实现沙箱。
Implementations§
Source§impl DefaultSandboxRuntime
impl DefaultSandboxRuntime
Sourcepub fn new() -> Layer3Result<Self>
pub fn new() -> Layer3Result<Self>
创建新的沙箱运行时
Trait Implementations§
Source§impl Default for DefaultSandboxRuntime
impl Default for DefaultSandboxRuntime
Source§impl SandboxRuntime for DefaultSandboxRuntime
impl SandboxRuntime for DefaultSandboxRuntime
Source§fn create<'life0, 'async_trait>(
&'life0 self,
config: SandboxConfig,
) -> Pin<Box<dyn Future<Output = Layer3Result<SandboxId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 self,
config: SandboxConfig,
) -> Pin<Box<dyn Future<Output = Layer3Result<SandboxId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
创建沙箱
Source§fn destroy<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn destroy<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
销毁沙箱
Source§fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
code: &'life2 str,
language: &'life3 str,
) -> Pin<Box<dyn Future<Output = Layer3Result<ExecutionResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
code: &'life2 str,
language: &'life3 str,
) -> Pin<Box<dyn Future<Output = Layer3Result<ExecutionResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
在沙箱中执行代码
Source§fn execute_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
request: ToolRequest,
) -> Pin<Box<dyn Future<Output = Layer3Result<ToolResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
request: ToolRequest,
) -> Pin<Box<dyn Future<Output = Layer3Result<ToolResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
在沙箱中执行工具
Source§fn status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
) -> Pin<Box<dyn Future<Output = Layer3Result<SandboxStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
) -> Pin<Box<dyn Future<Output = Layer3Result<SandboxStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
获取沙箱状态
Source§fn info<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
) -> Pin<Box<dyn Future<Output = Layer3Result<Option<SandboxInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn info<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SandboxId,
) -> Pin<Box<dyn Future<Output = Layer3Result<Option<SandboxInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
获取沙箱信息
Source§fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<SandboxInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<SandboxInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
列出所有活跃沙箱
Auto Trait Implementations§
impl !Freeze for DefaultSandboxRuntime
impl !RefUnwindSafe for DefaultSandboxRuntime
impl Send for DefaultSandboxRuntime
impl Sync for DefaultSandboxRuntime
impl Unpin for DefaultSandboxRuntime
impl UnsafeUnpin for DefaultSandboxRuntime
impl UnwindSafe for DefaultSandboxRuntime
Blanket Implementations§
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> 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