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

Update resource_groups.md #35

Merged
merged 3 commits into from
Jan 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions aips/resource_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ During compilation and publishing, these attributes are checked to ensure that:

From a storage perspective, a resource group is stored as a BCS-encoded `BTreeMap<StructTag, BCS encoded MoveValue>`, where a `StructTag` is a known structure in Move of the form: `{ account: Address, module_name: String, struct_name: String }`. Whereas, a typical resource is stored as a `BCS encoded MoveValue`.

Resource groups introduce a new storage access path: `ResourceGroup` to distinguish from existing access paths. This provides a cleaner interface and segration of different types of storage. This becomes advantageous to indexers and other direct readers of storage that can now parse storage without inspecting module metadata.
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a bit lengthy but can we also clarify that since the current APIs only allow accessing specific resources via Resource access path or modules via Module access path, there's no way to access a specific resource group and load all of the contained resources. These individual resources, however, can be accessed via the list account resources API or by referring to each of these resources specifically. There are no use cases for fetching resource groups and they can be viewed as an internal data structure for smart contracts and VM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure


At read time, a resource must be checked to see if that resource is part of a resource group by reading the associated metadata with a resource. If it is, the data is read from the resource group’s `StructTag` instead.

At write time, an element of a resource group must be appropriately updated into a resource group by determining the delta the resource group as a result of the write operation. This results in the handful of possibilities:
Expand Down