Expand description
Sequence handle.
A Sequence is an auto-incrementing (or decrementing) counter backed by
a single key-value record in a Database. The persistent record stores
the next batch boundary so that multiple handles can share the same
database key without requiring coordination on every call.
§Record format (ported exactly from the)
byte 0 : version (always 1)
byte 1 : flags
bit 0 (FLAG_INCR) — sequence increments
bit 1 (FLAG_WRAP) — wrap-around allowed
bit 2 (FLAG_OVER) — overflow has occurred
bytes 2+ : range_min (big-endian i64, 8 bytes)
bytes 10+: range_max (big-endian i64, 8 bytes)
bytes 18+: stored_value (big-endian i64, 8 bytes)Total: 26 bytes. uses packed-long encoding; we use fixed big-endian i64 for simplicity (compatible with the noxu-persist pattern).
Structs§
- Sequence
- A handle for manipulating a sequence record stored in a
Database.