add position field to capnp schema
Position was only in the bincode cache (serde field) — it would be lost on cache rebuild from capnp logs. Now persisted in the append-only log via ContentNode.position @19. Also fixes journal-tail sorting to extract dates from content headers, falling back to key-embedded dates.
This commit is contained in:
parent
da10dfaeb2
commit
f20ea4f827
2 changed files with 5 additions and 1 deletions
|
|
@ -31,6 +31,9 @@ struct ContentNode {
|
|||
# Spaced repetition
|
||||
lastReplayed @17 :Float64; # unix epoch
|
||||
spacedRepetitionInterval @18 :UInt32; # days: 1, 3, 7, 14, 30
|
||||
|
||||
# Section ordering within a file
|
||||
position @19 :UInt32; # 0 = file-level, 1+ = section index
|
||||
}
|
||||
|
||||
enum NodeType {
|
||||
|
|
|
|||
|
|
@ -1106,7 +1106,7 @@ fn read_content_node(r: memory_capnp::content_node::Reader) -> Result<Node, Stri
|
|||
state_tag: read_text(r.get_state_tag()),
|
||||
last_replayed: r.get_last_replayed(),
|
||||
spaced_repetition_interval: r.get_spaced_repetition_interval(),
|
||||
position: 0,
|
||||
position: r.get_position(),
|
||||
community_id: None,
|
||||
clustering_coefficient: None,
|
||||
schema_fit: None,
|
||||
|
|
@ -1161,6 +1161,7 @@ fn write_content_node(mut b: memory_capnp::content_node::Builder, node: &Node) {
|
|||
b.set_state_tag(&node.state_tag);
|
||||
b.set_last_replayed(node.last_replayed);
|
||||
b.set_spaced_repetition_interval(node.spaced_repetition_interval);
|
||||
b.set_position(node.position);
|
||||
}
|
||||
|
||||
fn read_relation(r: memory_capnp::relation::Reader) -> Result<Relation, String> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue