provenance: convert from enum to freeform string

The Provenance enum couldn't represent agents defined outside the
source code. Replace it with a Text field in the capnp schema so any
agent can write its own provenance label (e.g. "extractor:write",
"rename:tombstone") without a code change.

Schema: rename old enum fields to provenanceOld, add new Text
provenance fields. Old enum kept for reading legacy records.
Migration: from_capnp_migrate() falls back to old enum when the
new text field is empty.

Also adds `poc-memory tail` command for viewing recent store writes.

Co-Authored-By: ProofOfConcept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-03-11 01:19:52 -04:00
parent de204e3075
commit d76b14dfcd
14 changed files with 160 additions and 67 deletions

View file

@ -12,7 +12,7 @@
// Old files are preserved as backup. Run once.
use crate::store::{
self, Store, Node, NodeType, Provenance, RelationType,
self, Store, Node, NodeType, RelationType,
parse_units, new_relation,
};
@ -194,7 +194,7 @@ pub fn migrate() -> Result<(), String> {
} else {
NodeType::Semantic
},
provenance: Provenance::Manual,
provenance: "manual".to_string(),
key: key.clone(),
content,
weight: old_entry.weight as f32,
@ -233,7 +233,7 @@ pub fn migrate() -> Result<(), String> {
} else {
NodeType::Semantic
},
provenance: Provenance::Manual,
provenance: "manual".to_string(),
key: key.clone(),
content: unit.content.clone(),
weight: 0.7,