khonsulabs / bonsaidb

A developer-friendly document database that grows with you, written in Rust
https://bonsaidb.io/
Apache License 2.0
1.02k stars 37 forks source link

File storage format questions #247

Closed happysalada closed 2 years ago

happysalada commented 2 years ago

What is the format when the db is stored as a file ? (I couldn't find documentation on it). Is the format fixed or would there be a possibility for a human readable format ? (json, toml, text, anything).

ecton commented 2 years ago

The database is stored using Nebari. There is no alternate storage format, although the database can be exported using the backup() function. This will export one file per document, using the bytes as stored in the database.

Within the database, the serialization format is completely customizable by the user. The bonsaidb::core::document module has some high level information about how this works.

To switch the serialization format from the default (Pot using Serde), it can be customized on the derive macro or SerializedCollection can be implemented manually.

happysalada commented 2 years ago

Thanks a lot for the detailed answer!

one small detail, the link to transmog on this page https://dev.bonsaidb.io/release/docs/bonsaidb/core/schema/trait.Collection.html#changing-the-serialization-strategy is broken. (this is not a problem for me at all, I'm just saying to let you know).

ecton commented 2 years ago

Thank you for pointing that out! I was attempting to point to a re-export, but even on docs.rs it isn't working correctly. I'll change this to a full link to the repo https://github.com/khonsulabs/transmog