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

Decouple AuthorityTemporaryStore and AuthorityStore #801

Merged
merged 1 commit into from
Mar 13, 2022
Merged

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Mar 12, 2022

Right now AuthorityTemporaryStore keeps a reference to the AuthorityStore. When read_object is called on the temporary store, it first looks for it in the temporary store, if not found, read it from the authority store.
This has a few problems:

  1. It could potentially hide issues. We should only need to read from the authority store if we are executing a move call and need to read the dependent packages. Any other object should be in temporary store. Always falling back to authority store could hide issues where some objects are not available in the temporary store.
  2. The coupling makes it impossible to use AuthorityTemporaryStore independently, for instance, if we are doing local execution and the backing store is different.
  3. This will also allow us eventually get rid of the InMemoryStorage in adapter_tests, which has been a pain to keep with with temporary store changes.

Copy link
Collaborator

@gdanezis gdanezis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Some(o) => match &o.data {
Data::Package(c) => Ok(c
Ok(self
.get_package(&ObjectID::from(*module_id.address()))?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think under the hood this de-serializers to get the package ID and then de-serializes again in the "and_then"? Lets add a TODO here to cache since these things are immutable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't. module_id is just a pair of id and name.
Though we should cache the package object to avoid fetching from the store every time. At the same time, I feel the VM should do this inside it (to also avoid de-serialize it).

@lxfind lxfind merged commit c5d0b80 into main Mar 13, 2022
@lxfind lxfind deleted the decouple-stores branch March 13, 2022 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants