-
Notifications
You must be signed in to change notification settings - Fork 275
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
Metadata API: Consider if Metadata class should contain role name #1425
Comments
So I've done a rough conversion... and I'm not convinced:
Conclusion: Considered adding role name to Metadata: suggestion is to not implement it at this time. |
Thanks for doing the research. If you have your WIP changes somewhere, might be good to link them here? |
let me rebase before pushing a branch so we see at least the the verify_delegate() improvement... Something I forgot to mention in the first comment: The non-targets roles of course would be super easy to work with (as the rolename is the signed type...) but that still leaves all targets. So if the Metadata constructors were in Signed implementations (as in the generics experiment branch) that might make things a bit simpler -- but still targets does need a solution. |
Copying comment from the commit:
So this has some links to the other ongoing discussions... let's keep it open: maybe you or someone else has better ideas than I did |
To be re-assessed when we have figured out #1457 |
Seems like a major API change that we won't consider for now. Removing the backlog label but let's keep the discussion open. |
This looks unlikely to happen now: it would be a big change. I'll close this. |
I'm not sure if this is worth the trouble, writing it out anyway...
Description of issue or feature request:
I've been looking at our data structures lately, trying to improve their usability... and one theme that comes up is that objects should include their identifier if they have one -- the json file format does not do this because it would be wasteful in a wire format but the same does not apply to python objects. There's a PR for Key already but I think the same logic applies to Metadata itself: Our Metadata objects always have a role name that is available when the Metadata is constructed, the name is immutable during lifetime of the object and often needed with the Metadata object (e.g. verify_delegate(), writing to file)
Quick estimates of what this means to API:
Metadata.__init__()
: Add argumentrole_name: str
Metadata.from_bytes()
: Add argumentrole_name: str
Metadata.from_dict()
: Add argumentrole_name: str
Metadata.from_file()
: No change -- the role name can be deciphered from file name. Alternatively the argument could be split to two (to match to_file() below): directory and role nameMetadata.to_dict()
: No changeMetadata.to_file()
: Hmm... not sure how to do this in a nice way: there's three components to the path: directory, basename and extension. Maybe the argument should be just the directory, the basename is then the role name and extension should be a class variable of Serializer?verify_delegate()
: (once it exists) remove argument role_name -- this is included in metadata alreadyThe text was updated successfully, but these errors were encountered: