-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: Introduce ComponentPackage
and ComponentTemplate
#1015
base: next
Are you sure you want to change the base?
Conversation
0cee24f
to
123e92c
Compare
ComponentPackage
and ComponentConfig
f12c492
to
1f66753
Compare
ComponentPackage
and ComponentConfig
ComponentPackage
and ComponentTemplate
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.
Looks good! Thank you! I left just a few comments inline.
/// | ||
/// Each entry can describe: | ||
/// - A value slot (single word or multiple words). | ||
/// - A multi-slot entry (spanning multiple contiguous slots, with multipe values). |
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.
Should this point be about storage maps?
/// The initial value for this slot. | ||
value: WordRepresentation, |
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.
Should this be just Word
? I guess the question is whether it makes sense to keep the original representation at this level as well. The alternative would be to convert WordRepresentation
to Word
when we go from RawStorageEntry
to StorageEntry
.
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.
I debated this as well. I think the only real upside of keeping the representation is to be able to get the original representation when unpacking or inspecting packages. Whether this is valuable, I'm not sure. I think whether the value is defined as elements or as a binary number, for instance, could sometimes give some more semantic context to the entry itself, but obviously not sure it will be very useful versus just parsing as words and keeping that (probably less error prone as well, though this is easily tested).
I was thinking of adding some methods for more simply retrieving Word
from each entry while keeping the original representation, but again maybe this is too much.
objects/src/accounts/package/mod.rs
Outdated
/// library code required for the component's operation. | ||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct ComponentPackage { | ||
config: ComponentTemplate, |
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.
nit: I'm not 100% sure about the naming here. I think of this data more like "metadata" rather than config or template.
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.
Renamed to ComponentMetadata
Part of #550.
Introduces a first draft of
ComponentPackage
andComponentTemplate
.For now it can serialize and deserialize configs such as this one:
Most structs down to the element need to have custom (de)serialization due to the different alternatives discussed in #550, but at least now it's easy if we want to add a new away of encoding things such as felts (for instance, if we want to allow for binary representation for elements).
Planned follow-ups:
{{foo.bar.baz}}
) for matching whole words or single elements