sdsavior
Most likely i have re-invented the wheel here. But i was to lazy to find something like this. So, here you go...
A crash-recoverable, memory-mapped ring buffer for JSON records, designed for SD-card-ish environments (where constant small writes are a fun way to speedrun media death).
Install
pip install sdsavior
Quick Start
from sdsavior import SDSavior
rb = SDSavior(
data_path="data.ring",
meta_path="data.meta",
capacity_bytes=8 * 1024 * 1024,
)
rb.open()
rb.append({"hello": "pi"})
rb.append({"n": 123})
for seq, ts_ns, obj in rb.iter_records():
print(seq, ts_ns, obj)
rb.close()
Or with a context manager:
from sdsavior import SDSavior
with SDSavior("data.ring", "data.meta", 8 * 1024 * 1024) as rb:
rb.append({"ok": True})
CLI
Export current contents to a JSONL
sdsavior export --data data.ring --meta data.meta --capacity 8388608 --out out.jsonl
IMPORTANT NOTES
- Records are stored as JSON lines (
\\nappended). - Metadata is double-buffered with CRC and a commit counter for crash recovery.
- Already-encoded JSON can be written with
append_json_bytes(...)to skip a decode/encode round trip. group_commit_records=Ncan batch fsync work while keeping CRC-based crash recovery.- By default it does not fsync data pages on every append (to reduce wear); metadata is fsync'd.
TODO
- fix ci for pypy publishing...
- smarter fsync strategy
- indexing / partial recovery scans
Metadata
Release files for sdsavior 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sdsavior-1.1.0.tar.gz | 79.7 kB | Without provenance | Details for sdsavior-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sdsavior-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for sdsavior-1.1.0-py3-none-any.whl |
Total release size: 93.9 kB
Release files / sdsavior-1.1.0.tar.gz
| Download URL | sdsavior-1.1.0.tar.gz |
|---|---|
| Size | 79.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5690364af8819eaa6189cef91d09a4c03be6e089ab772382e0627b9bccc873f8
|
|
BLAKE2b-256 checksum How to use checksums |
8c2fe4dc4f0ce5253327f8f701703aeea433f73333821dd198076dc9f778b726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / sdsavior-1.1.0-py3-none-any.whl
| Download URL | sdsavior-1.1.0-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18c01ca00bc25e37ffe1e04088b4b092b1f80dfaa9791534e9cbf9ea92a41eb1
|
|
BLAKE2b-256 checksum How to use checksums |
a7cfc4a5dd3cb062e39d4b01f1be29977fc67debda8edc5a2ea1e03bd441a15d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for sdsavior 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.