-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add the possibility to specify an offset for the read value in StorageRead::read #863
base: master
Are you sure you want to change the base?
Conversation
…emory implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!=) Do I understand correct, that after this change is merged, you will rework #847 ?
fuel-storage/src/impls.rs
Outdated
key: &<Type as Mappable>::Key, | ||
buf: &mut [u8], | ||
) -> Result<Option<usize>, T::Error> { | ||
self.0.read(key, buf) | ||
self.0.read(key, 0, buf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can specify offset here as well or add read_with_offset
=)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done here: b2335f9
Is there any reason why StorageRef
does not implement StorageRead
btw? The only thing I see is that it does not implement StorageSize
, which is a requirement for StorageRead
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't implement any traits because it is used like storage::<Mapable>().read
without importing the trait(just calling of the function). This structure is used as a syntax sugar to simplify the work within the code
fuel-vm/src/storage.rs
Outdated
pub use memory::MemoryStorage; | ||
#[cfg(feature = "test-helpers")] | ||
pub use memory::MemoryStorageError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub use memory::MemoryStorage; | |
#[cfg(feature = "test-helpers")] | |
pub use memory::MemoryStorageError; | |
pub use memory::{ | |
MemoryStorage, | |
MemoryStorageError, | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed here: 8855eab
CHANGELOG.md
Outdated
- [863](https://github.com/FuelLabs/fuel-vm/pull/863): Changed StorageRead::read to load a serialized value starting from a offset. The function returns an optional value equal to the number of bytes read when defined, or none if the offset specified in input is outside the boundaries of the serialized value read. | ||
## [Version 0.58.2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [863](https://github.com/FuelLabs/fuel-vm/pull/863): Changed StorageRead::read to load a serialized value starting from a offset. The function returns an optional value equal to the number of bytes read when defined, or none if the offset specified in input is outside the boundaries of the serialized value read. | |
## [Version 0.58.2] | |
- [863](https://github.com/FuelLabs/fuel-vm/pull/863): Changed StorageRead::read to load a serialized value starting from a offset. The function returns an optional value equal to the number of bytes read when defined, or none if the offset specified in input is outside the boundaries of the serialized value read. | |
## [Version 0.58.2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, changed in 5b91da4
Yes, I'll start working on that shortly. IIUC After the release of the next fuel-vm version I'll also have to update |
Yes |
[Link to related issue(s) here, if any]
[Short description of the changes.]
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]