Liberum-Neto / liberum-neto

2 stars 0 forks source link

Implement liberum_vault using streams #45

Closed originalmk closed 1 day ago

originalmk commented 1 week ago

Vault is an actor responsible for loading or storing the fragments in the SQLite database. Currently data of fragments is not stored in database at all, it could be more elegant solution though. SQLite supports storing large blobs without having to pass all of their data at once:

https://docs.rs/rusqlite/latest/rusqlite/struct.Connection.html#method.blob_open

Vault could provide the following interface (pseudocode):

Vault::fragment(path: &Path) -> Iter<Stream>
Vault::id_builder() -> FragmentIDBuilder
FragmentIDBuilder#update(Vec<u8>)
FragmentIDBuilder#build()

and messages implementations (pseudocode):

LoadFragment { id: ... } -> Result<Option<Stream<u8>>>
StoreFragment { id: ..., Stream<u8> } -> Result<FragmentID, Error>
DeleteFragment { id: ... } -> Result
UpdateFragment { id: ..., Stream<u8> } -> Result
originalmk commented 1 week ago

fragment function implemented, it turned out that there is no need to implement FragmentIDBuilder as blake3 has similar interface already and it may be used there.

originalmk commented 1 day ago

Already merged.