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

Method clear

atomic-agent/src/turn/session.rs:1080–1092  ·  view source on GitHub ↗

Delete a session state file. Returns `Ok(())` if the file doesn't exist (idempotent).

(&self, session_id: &str)

Source from the content-addressed store, hash-verified

1078 ///
1079 /// Returns `Ok(())` if the file doesn't exist (idempotent).
1080 pub fn clear(&self, session_id: &str) -> AgentResult<()> {
1081 validate_session_id(session_id)?;
1082
1083 let path = self.session_path(session_id);
1084 match std::fs::remove_file(&path) {
1085 Ok(()) => Ok(()),
1086 Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
1087 Err(e) => Err(AgentError::SessionSaveFailed {
1088 session_id: session_id.to_string(),
1089 reason: format!("delete: {}", e),
1090 }),
1091 }
1092 }
1093
1094 /// List all stored sessions.
1095 ///

Callers

nothing calls this directly

Calls 3

validate_session_idFunction · 0.85
session_pathMethod · 0.80
kindMethod · 0.45

Tested by

no test coverage detected