pub trait Adapter {
// Required methods
fn name(&self) -> &'static str;
fn root(&self) -> Option<PathBuf>;
fn discover(&self) -> Discovered;
fn parse(&self, path: &Path) -> Result<Session>;
// Provided methods
fn store(&self) -> Option<Store> { ... }
fn parse_key(&self, _key: &str) -> Result<Session> { ... }
fn reconcile_scope(&self) -> Option<String> { ... }
}Required Methods§
fn name(&self) -> &'static str
Sourcefn root(&self) -> Option<PathBuf>
fn root(&self) -> Option<PathBuf>
Store root, e.g. ~/.claude/projects. May not exist on this machine.
Sourcefn discover(&self) -> Discovered
fn discover(&self) -> Discovered
All session files under the root, with a partial-walk flag the indexer
uses to protect deletion reconciliation (see Discovered).
Provided Methods§
Sourcefn store(&self) -> Option<Store>
fn store(&self) -> Option<Store>
A shared store (many sessions in one database) for tools that do not use
one file per session. When Some, the indexer uses it instead of
discover/parse. Default None = ordinary file-per-session adapter.
Sourcefn parse_key(&self, _key: &str) -> Result<Session>
fn parse_key(&self, _key: &str) -> Result<Session>
Parse one session out of a shared store by its key (from store().keys).
Only called for adapters that return a Store.
Sourcefn reconcile_scope(&self) -> Option<String>
fn reconcile_scope(&self) -> Option<String>
Limit deletion reconciliation to part of this tool’s indexed rows. When
Some(prefix), only indexed rows whose key starts with prefix are
considered for archiving after this adapter runs. Use it when the
adapter’s store holds only part of a tool’s sessions - for example
several installations of the same tool sharing one tool name, each
listing only its own keys - so that one installation’s sync cannot
archive another’s rows. Default None = the adapter speaks for every
row of its tool.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".