MCPcopy Create free account
hub / github.com/Botloader/botloader / create

Method create

components/scheduler/src/vm_session.rs:84–106  ·  view source on GitHub ↗

Creates a fresh vm on the worker, replacing whatever vm it was hosting. The worker is handed back on send failure so the caller can dispose of it as broken.

(
        worker: WorkerHandle,
        guild_id: Id<GuildMarker>,
        logger: GuildLogSender,
        vm_session_id: u64,
        scripts: Vec<Script>,
        premium_tier: Option<PremiumSlotTie

Source from the content-addressed store, hash-verified

82 /// The worker is handed back on send failure so the caller can dispose of
83 /// it as broken.
84 pub fn create(
85 worker: WorkerHandle,
86 guild_id: Id<GuildMarker>,
87 logger: GuildLogSender,
88 vm_session_id: u64,
89 scripts: Vec<Script>,
90 premium_tier: Option<PremiumSlotTier>,
91 ) -> Result<Self, WorkerHandle> {
92 let mut session = Self {
93 guild_id,
94 logger,
95 vm_session_id,
96 dispatch_id_gen: 0,
97 pending_acks: HashMap::new(),
98 worker,
99 vm_cold: false,
100 };
101
102 match session.send_create_scripts_vm(vm_session_id, scripts, premium_tier) {
103 Ok(()) => Ok(session),
104 Err(()) => Err(session.worker),
105 }
106 }
107
108 /// Replaces the vm on the already claimed worker, used when the guild's
109 /// scripts changed while a session was active.

Callers 1

Premium.tsxFile · 0.80

Calls 1

Tested by

no test coverage detected