MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / claim_session

Method claim_session

libatomic/src/daemon/sandbox_grants.rs:442–458  ·  view source on GitHub ↗
(
        &self,
        grant: &SandboxGrant,
        session_id: &str,
        unused: bool,
    )

Source from the content-addressed store, hash-verified

440 }
441
442 fn claim_session(
443 &self,
444 grant: &SandboxGrant,
445 session_id: &str,
446 unused: bool,
447 ) -> Result<bool, GrantError> {
448 let mut registry = self.lock();
449 let key = (grant.repository_id.clone(), session_id.to_string());
450 Ok(match registry.sessions.get(&key) {
451 Some(existing) => *existing == owner(grant),
452 None if unused => {
453 registry.sessions.insert(key, owner(grant));
454 true
455 }
456 None => false,
457 })
458 }
459
460 fn owns_session(&self, grant: &SandboxGrant, session_id: &str) -> Result<bool, GrantError> {
461 let key = (grant.repository_id.clone(), session_id.to_string());

Callers 1

check_turn_scopeFunction · 0.80

Calls 5

ownerFunction · 0.85
lockMethod · 0.80
getMethod · 0.65
cloneMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected