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

Method open

atomic-identity/src/store.rs:393–415  ·  view source on GitHub ↗

Open or create an identity store at the specified path.

(root: &Path)

Source from the content-addressed store, hash-verified

391
392 /// Open or create an identity store at the specified path.
393 pub fn open(root: &Path) -> Result<Self, IdentityError> {
394 // Create the directory if it doesn't exist
395 if !root.exists() {
396 fs::create_dir_all(root)?;
397 }
398
399 // Load or create configuration
400 let config_path = root.join(Self::CONFIG_FILE);
401 let config = if config_path.exists() {
402 let content = fs::read_to_string(&config_path)?;
403 toml::from_str(&content)?
404 } else {
405 let config = StoreConfig::new();
406 let content = toml::to_string_pretty(&config)?;
407 fs::write(&config_path, content)?;
408 config
409 };
410
411 Ok(Self {
412 root: root.to_path_buf(),
413 config,
414 })
415 }
416
417 /// Get the default store path.
418 ///

Callers 11

digestFunction · 0.45
digestFunction · 0.45
spoolFunction · 0.45
try_append_agent_traceFunction · 0.45
bind_turn_intentMethod · 0.45
freeze_turn_intentMethod · 0.45
write_captureFunction · 0.45
try_turn_end_lockMethod · 0.45
with_accumulatorMethod · 0.45
save_accumulatorMethod · 0.45

Calls 2

writeFunction · 0.50
existsMethod · 0.45

Tested by

no test coverage detected