pub struct HarnessStore { /* private fields */ }Expand description
~/.mecha/learning/harness/ — candidates and the overrides file.
Implementations§
Source§impl HarnessStore
impl HarnessStore
Sourcepub fn default_root() -> Result<PathBuf>
pub fn default_root() -> Result<PathBuf>
Beside the learning store’s other artifacts, so MECHA_LEARNING_DIR
relocates the whole learning surface together.
pub fn open(root: impl Into<PathBuf>) -> Result<HarnessStore>
pub fn open_default() -> Result<HarnessStore>
pub fn root(&self) -> &Path
Sourcepub fn write(&self, c: &HarnessCandidate) -> Result<()>
pub fn write(&self, c: &HarnessCandidate) -> Result<()>
Write (or rewrite) one candidate, atomically — a nightly pass and a
list in a terminal must never meet over a half-written file.
Sourcepub fn all(&self) -> Result<Vec<HarnessCandidate>>
pub fn all(&self) -> Result<Vec<HarnessCandidate>>
Every candidate, oldest first. Unreadable files are skipped with a warning — one bad record must not hide the store.
Sourcepub fn find(&self, id: &str) -> Result<HarnessCandidate>
pub fn find(&self, id: &str) -> Result<HarnessCandidate>
Find one candidate by id or unique prefix. Ambiguity is an error rather than a guess, same as session lookup.
pub fn overrides_path(&self) -> PathBuf
Sourcepub fn overrides(&self) -> Result<Vec<AcceptedOverride>>
pub fn overrides(&self) -> Result<Vec<AcceptedOverride>>
The currently accepted overrides, in file order.
Sourcepub fn set_override(
&self,
ov: AcceptedOverride,
) -> Result<Option<AcceptedOverride>>
pub fn set_override( &self, ov: AcceptedOverride, ) -> Result<Option<AcceptedOverride>>
Install an override, replacing any earlier one on the same key. Returns what it replaced, so the acceptance can record the reversal.
Sourcepub fn remove_override(&self, key: &str) -> Result<Option<AcceptedOverride>>
pub fn remove_override(&self, key: &str) -> Result<Option<AcceptedOverride>>
Remove the override on key, returning it if there was one. Removal
returns the key to whatever the user’s own config layers say — the
candidate files keep the history.