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

Function serve

atomic-cli/src/commands/agent/owner.rs:889–901  ·  view source on GitHub ↗
(repository: &Path)

Source from the content-addressed store, hash-verified

887}
888
889fn serve(repository: &Path) -> CliResult<()> {
890 let dot_dir = Repository::canonical_dot_dir(repository)?;
891 let owner_lock = acquire_owner_lock(&dot_dir)?;
892 let store_path = Repository::canonical_change_store_path(repository)?;
893 let store = Arc::new(
894 RedbChangeStore::open(&store_path)
895 .with_context(|| format!("failed to open {}", store_path.display()))?,
896 );
897 let endpoint = endpoint_name(&dot_dir);
898 runtime()?.block_on(run_server(&endpoint, store))?;
899 FileExt::unlock(&owner_lock).context("failed to release database-owner lock")?;
900 Ok(())
901}
902
903fn acquire_owner_lock(dot_dir: &Path) -> anyhow::Result<File> {
904 let path = dot_dir.join(OWNER_LOCK_FILE);

Callers 1

runMethod · 0.85

Calls 6

acquire_owner_lockFunction · 0.85
endpoint_nameFunction · 0.85
runtimeFunction · 0.85
run_serverFunction · 0.85
contextMethod · 0.80
with_contextMethod · 0.45

Tested by

no test coverage detected