Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs-atomic-storage: Integrate fs-atomic-versions with fs-storage #3

Open
2 tasks done
kirillt opened this issue Feb 20, 2024 · 6 comments
Open
2 tasks done

fs-atomic-storage: Integrate fs-atomic-versions with fs-storage #3

kirillt opened this issue Feb 20, 2024 · 6 comments
Assignees

Comments

@kirillt
Copy link
Member

kirillt commented Feb 20, 2024

Most likely, it won't need JNI later.

@kirillt kirillt moved this to Todo in Development Feb 20, 2024
@kirillt
Copy link
Member Author

kirillt commented Mar 1, 2024

Crate fs-atomic-versions shouldn't be used directly by data-link and other crates (although we leave this possibility to users/apps). Crate fs-atomic-versions should be used by fs-storage.

Basically, any dependency on fs-atomic-versions will require to create initialization methods.

@kirillt kirillt changed the title Port atomic files from arklib fs-storage: Port atomic files from arklib Apr 3, 2024
@kirillt
Copy link
Member Author

kirillt commented Apr 3, 2024

This thing should be done after these 3 are completed:

JNI probably be done after atomics, because I'd expect some API change:

@kirillt
Copy link
Member Author

kirillt commented Apr 27, 2024

We can also look at the atomic versioning not only as a mechanism preventing dirty writes, but also as an update discovery mechanism.

  • We don't allow writing storages without versions
  • We maintain N latest versions for each storage
  • If we attempt to write storage with version N, while N+1 is already on disk, we merge
  • If we attempt to read storage with version N, while N+1 is already in memory, we merge

Monoid or CRDT can help us here. It seems that we're going to use them anyway.

@kirillt
Copy link
Member Author

kirillt commented Apr 27, 2024

One more consideration: we want to use storages for caching, too. I don't think it makes sense to version cache items⏤we just refer to them by immutable key and overwrite any with new version when needed.

How to implement caching nicely if we adopt atomic versioning for storages?

Options:

  1. Switch on/off versioning for this particular kind of storage.
  2. N=0 effectively disables versioning, where N is the number of versions to maintain during writing/reading.

@twitu
Copy link
Collaborator

twitu commented May 20, 2024

The ark-rust repo already has a crate called fs-atomic-versions which has the AtomicFile implementation. Is there anything else this issue needs to do?

@kirillt
Copy link
Member Author

kirillt commented Nov 13, 2024

Here, we need to create experimental version of fs-storage that uses fs-atomic-versions inside for each file it writes.

Let's call it fs-atomic-storage.

@kirillt kirillt changed the title fs-storage: Port atomic files from arklib fs-atomic-storage: Integrate fs-atomic-versions with fs-storage Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants