Repository navigation
Conversation
A connection keeps the state of each ledger it has read, so a process sharing a storage directory saw another process's commits only after reconnecting. Ledger.refresh() catches the ledger up with the nameservice head and returns the latest t, loading it first when this connection has not read it yet (the engine's refresh leaves an uncached ledger alone and reports t 0). Writes already catch up on their own: a commit that meets a newer head is retried against it.
Contributor
Author
|
Closing for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Several processes can share one Fluree storage directory, but a Python connection keeps the state of each ledger it has read. Its queries therefore never saw another process's commits until it reconnected.
Ledger.refresh()(andfluree.aio'sawait ledger.refresh()) catches the ledger up with the nameservice head and returns the latestt:Details
refresh()wraps the engine'sFluree::refresh. That call only updates a ledger already in the cache: for one this connection hasn't read yet, it reportst0. So the binding loads the ledger first; a cold load reads the head anyway.insert/upsert/update,transaction()andtransact()alike, and the docstring says so.with_policy) handle: it reveals only the headt, whichsnapshot().talready does.Snapshotkeeps the state it froze.min_toption. It only compares the returnedt, which the caller can do directly.Tests
test_a_refresh_takes_in_another_connections_commits: two file connections on one directory stand in for two processes. The test covers a stale read beforerefresh(), the returnedt, and the fresh read after. It also refreshes a ledger the connection hasn't read yet, which pins the cold-load case.test_the_api_end_to_end(aio) callsrefresh().