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:
parent
de204e3075
commit
d76b14dfcd
14 changed files with 160 additions and 67 deletions
|
|
@ -12,7 +12,7 @@ struct ContentNode {
|
|||
version @1 :UInt32; # monotonic per UUID, latest wins
|
||||
timestamp @2 :Int64; # unix epoch seconds
|
||||
nodeType @3 :NodeType;
|
||||
provenance @4 :Provenance;
|
||||
provenanceOld @4 :Provenance; # deprecated — use provenance (@21)
|
||||
key @5 :Text; # "identity.md#boundaries" human-readable
|
||||
content @6 :Text; # markdown blob
|
||||
weight @7 :Float32;
|
||||
|
|
@ -38,6 +38,10 @@ struct ContentNode {
|
|||
# Stable creation timestamp (unix epoch seconds). Set once when the
|
||||
# node is first created; never changes on rename or content update.
|
||||
createdAt @20 :Int64;
|
||||
|
||||
# Freeform provenance string: "extractor:write", "rename:tombstone", etc.
|
||||
provenance @21 :Text;
|
||||
|
||||
}
|
||||
|
||||
enum NodeType {
|
||||
|
|
@ -79,12 +83,13 @@ struct Relation {
|
|||
timestamp @2 :Int64; # unix epoch seconds
|
||||
source @3 :Data; # content node UUID
|
||||
target @4 :Data; # content node UUID
|
||||
relType @5 :RelationType;
|
||||
strength @6 :Float32; # manual=1.0, auto=0.1-0.7
|
||||
provenance @7 :Provenance;
|
||||
deleted @8 :Bool; # soft delete
|
||||
sourceKey @9 :Text; # human-readable source key (for debugging)
|
||||
targetKey @10 :Text; # human-readable target key (for debugging)
|
||||
relType @5 :RelationType;
|
||||
strength @6 :Float32; # manual=1.0, auto=0.1-0.7
|
||||
provenanceOld @7 :Provenance; # deprecated — use provenance (@11)
|
||||
deleted @8 :Bool; # soft delete
|
||||
sourceKey @9 :Text; # human-readable source key (for debugging)
|
||||
targetKey @10 :Text; # human-readable target key (for debugging)
|
||||
provenance @11 :Text; # freeform provenance string
|
||||
}
|
||||
|
||||
enum RelationType {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue