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

Method open_at

atomic-cli/src/commands/intent/key_cache.rs:100–123  ·  view source on GitHub ↗

Open the cache rooted at `dir` (used by tests).

(dir: &Path)

Source from the content-addressed store, hash-verified

98
99 /// Open the cache rooted at `dir` (used by tests).
100 pub fn open_at(dir: &Path) -> Self {
101 let path = dir.to_path_buf().join(CACHE_FILE);
102
103 if let Ok(raw) = std::fs::read_to_string(&path) {
104 match serde_json::from_str::<CacheFile>(&raw) {
105 Ok(file) => {
106 return Self {
107 dir: dir.to_path_buf(),
108 path,
109 entries: file.entries,
110 }
111 }
112 Err(e) => {
113 log::debug!("key cache unreadable (ignoring): {e}");
114 }
115 }
116 }
117
118 Self {
119 dir: dir.to_path_buf(),
120 path,
121 entries: BTreeMap::new(),
122 }
123 }
124
125 /// Look up a cached, unexpired, active key for (server, identity name).
126 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected