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

Function runtime_store

libatomic/src/review/incremental.rs:192–203  ·  view source on GitHub ↗
(repo: &Repository)

Source from the content-addressed store, hash-verified

190}
191
192fn runtime_store(repo: &Repository) -> CliResult<Option<SessionStore>> {
193 let directory = repo.dot_dir().join("sessions");
194 // SessionStore::new creates directories. Never call it on an absent store.
195 match std::fs::metadata(&directory) {
196 Ok(metadata) if metadata.is_dir() => SessionStore::new(directory)
197 .map(Some)
198 .map_err(|e| CliError::Internal(e.into())),
199 Ok(_) => Err(invalid("Session store is not a directory")),
200 Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(None),
201 Err(e) => Err(CliError::Internal(e.into())),
202 }
203}
204
205fn runtime_session(store: Option<&SessionStore>, id: &str) -> CliResult<Option<AgentSession>> {
206 validate_session(id)?;

Callers 1

resolve_with_sessionFunction · 0.85

Calls 5

is_dirMethod · 0.80
invalidFunction · 0.70
metadataFunction · 0.50
dot_dirMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected