[−][src]Struct ttcore::Serv
服务定义
Implementations
impl Serv
[src]
pub fn new() -> Serv
[src]
创建服务实例
pub fn set_resource(&self, rsc: Resource)
[src]
设置可用的资源总量
pub fn get_resource(&self) -> Resource
[src]
获取资源占用的统计数据
pub fn clean_expired_env(&self)
[src]
清理过期的 Env
pub fn add_client(&self, id: CliId) -> Result<()>
[src]
添加新的客户端
pub fn del_client(&self, id: &CliIdRef)
[src]
删除客户端并清理所有资源
pub fn register_env(&self, id: CliId, env: Env) -> Result<()>
[src]
添加 Env, 若 CliId 不存在会自动创建
pub fn del_env(&self, cli_id: &CliIdRef, env_id: &EnvIdRef)
[src]
清除指定的 Env
pub fn stop_env(&self, cli_id: &CliIdRef, env_id: &EnvIdRef) -> Result<()>
[src]
暂停运行, 让出资源
- 保留临时镜像和端口影射
- 停止所有 VM 进程
- 资源计数递减
pub fn start_env(&self, cli_id: &CliIdRef, env_id: &EnvIdRef) -> Result<()>
[src]
恢复运行先前被 stop 的 ENV
- 启动所有 VM 进程
- 资源计数递增
pub fn get_env_meta(&self, cli_id: &CliIdRef) -> Vec<EnvMeta>
[src]
批量获取所有 Env 的概略信息
pub fn get_env_meta_all(&self) -> Vec<EnvMeta>
[src]
获取全局 ENV 列表, 供 Proxy 使用
pub fn get_env_detail(
&self,
cli_id: &CliIdRef,
env_set: Vec<EnvId>
) -> Vec<EnvInfo>
[src]
&self,
cli_id: &CliIdRef,
env_set: Vec<EnvId>
) -> Vec<EnvInfo>
批量获取 Env 详细信息, 不能直接返回 Env 实体, 会触发 Drop 动作
pub fn update_env_life(
&self,
cli_id: &CliIdRef,
env_id: &EnvIdRef,
lifetime: u64,
is_fucker: bool
) -> Result<()>
[src]
&self,
cli_id: &CliIdRef,
env_id: &EnvIdRef,
lifetime: u64,
is_fucker: bool
) -> Result<()>
更新指定 Env 的 lifetime
pub fn update_env_del_vm(
&self,
cli_id: &CliIdRef,
env_id: &EnvIdRef,
vmid_set: &[VmId]
) -> Result<()>
[src]
&self,
cli_id: &CliIdRef,
env_id: &EnvIdRef,
vmid_set: &[VmId]
) -> Result<()>
删除指定 OS 前缀的 VM
pub fn update_env_hardware(
&self,
cli_id: &CliIdRef,
env_id: &EnvIdRef,
cpu_mem_disk: (Option<u32>, Option<u32>, Option<u32>),
vm_port: &[Port],
deny_outgoing: Option<bool>
) -> Result<()>
[src]
&self,
cli_id: &CliIdRef,
env_id: &EnvIdRef,
cpu_mem_disk: (Option<u32>, Option<u32>, Option<u32>),
vm_port: &[Port],
deny_outgoing: Option<bool>
) -> Result<()>
更新指定 Env 的 lifetime
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Serv
impl Send for Serv
impl Sync for Serv
impl Unpin for Serv
impl !UnwindSafe for Serv
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,