A quick-and-dirty “““embedded database””” library.
This is just a library for storing data in JSON files, but with a few added conveniences:
- The saved data includes a schema version number, and will be automatically migrated to newer schema versions.
- The live data is guarded by a built-in read-write lock which can be used synchronously or from a [tokio] async environment.
- Data is saved to the backing JSON file, in a hopefully-atomic fashion, every time a write lock is released.
Data can be represented in pretty much any form you can convince [serde] to go along with, except for the following restrictions:
- Your data type must be [
Debug
] + [Send
] + [Sync
] +'static
. - Your serialization format shouldn't include a top-level
version
field of its own, as this is reserved for our schema version tracking. - You can't use
#[serde(deny_unknown_fields)]
, as this conflicts with our use of#[serde(flatten)]
.