dizzy.engine.dagstore¶
dizzy.engine.dagstore
¶
dagstore — the content-addressed event DAG the event store is built on.
Cryptographic event ids, parent pointers for order, heads as checkpoint, canonical topological replay, git-style anti-entropy sync. Stdlib only: this subpackage adds nothing to DIZZY's dependency footprint, which is why it can sit in core alongside the shells rather than behind an extra.
It knows nothing about DIZZY — no feat file, no generated classes, not even
pydantic. It stores (type: str, payload: dict) and returns hashed
Event records. :mod:dizzy.engine.store is the layer that gives those
payloads their DIZZY meaning.
NotCanonicalizable
¶
Bases: ValueError
The value falls outside the hashed subset (float, big int, non-str key…).
Source code in dizzy/src/dizzy/engine/dagstore/canonical.py
33 34 | |
TamperedEvent
¶
Bases: ValueError
An event's id does not match its content.
Source code in dizzy/src/dizzy/engine/dagstore/events.py
23 24 | |
DagStore
¶
A single node's event DAG. :memory: (default) or a file path.
Source code in dizzy/src/dizzy/engine/dagstore/store.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
append(type, payload)
¶
Mint a new event on top of the current heads and store it.
Source code in dizzy/src/dizzy/engine/dagstore/store.py
64 65 66 67 68 69 70 | |
add(event)
¶
Ingest a replicated event. Returns False if already present.
Verifies the content hash (raises TamperedEvent) and requires every
parent to be present already (raises MissingParents) — replication
must deliver ancestry first, which sync guarantees.
Source code in dizzy/src/dizzy/engine/dagstore/store.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
heads()
¶
The DAG frontier (sorted): events no known event names as parent.
Source code in dizzy/src/dizzy/engine/dagstore/store.py
103 104 105 106 107 108 | |
iterate()
¶
Yield every event in canonical replay order.
Kahn's algorithm with the ready set kept as a sorted frontier: an event becomes ready once all its parents have been emitted; among ready events the smallest id goes first. Purely a function of the event set — no clocks, no insertion order.
Source code in dizzy/src/dizzy/engine/dagstore/store.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
MissingParents
¶
Bases: KeyError
add() was given an event whose parents are not yet in the store.
Source code in dizzy/src/dizzy/engine/dagstore/store.py
32 33 | |
canonical_json(value)
¶
Serialize value to canonical JSON bytes (UTF-8).
Deterministic: equal values (regardless of dict insertion order) always produce identical bytes. Raises NotCanonicalizable for anything outside the hashed subset.
Source code in dizzy/src/dizzy/engine/dagstore/canonical.py
89 90 91 92 93 94 95 96 97 98 | |
verify(event)
¶
True iff the event's id matches its content.
Source code in dizzy/src/dizzy/engine/dagstore/events.py
50 51 52 | |