-
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
How much metadata behaviour should be implemented on their classes? #1134
Comments
Related discussion: Is there a need for library functions that should be implemented neither on a metadata class nor on a controller class? |
dropping some thoughts here ... On one hand the general preference should be towards composition over inheritance, in this case the controller classes option. Having said that maybe something like option one:
plus a base Controller class that can be extended by a RepositoryController, if needed, seems like the best compromise. I like option three too,
mainly for its simplicity but I can't add much knowledge on potential dependencies issues |
In the current code there are a lot of different functions performing hashing. Probably this can be done using directly securesystemslib but if such a pattern starts to appear again, maybe a helper/utility/wrapper class? |
To answer Luke's question, my 🔥 take is 💯 |
From client implementation experience: The metadata API should definitely handle:
The rest is just nice-to-have functionality, mostly easier accessors to existing attributes. Examples:
|
The stable release of the Metadata API lets me assume that we have made a decision about this. I wonder if we should track it in an ADR. It might keep us from cramming more functionality into the API when designing a repository library (#1136). Opinions? |
The TUF refactor aims at a more idiomatic use of OOP (see #1112). As such it seems reasonable to implement metadata entity behaviour as instance methods on the corresponding classes.
However, not all users of the metadata model need the same behaviour. For instance, a TUF client is likely to only need
Metadata.verify
and read access on all metadata object attributes, but none of the methods to modify attributes, which are needed by a repository library/tool, (e.g.sign
,bump_version
,bump_expiration
,delegate
,add_keys
,add_targets
, etc.).This question about how to draw the line is especially important if unneeded functionality requires 3rd party dependencies, which we would have to vendor on a client.
Some possible approaches (brain storming):
Metadata
andSigned
classes, such assign
,verify
,canonicalise
) and implement all behaviour on metadata user specific controller classes, e.g.Repository
,Client
(or something likeProject
/Developer
/Workspace
for PEP480.RepositoryTargets
,ClientTargets
, etc...UnsupportedLibraryError
if a client callsMetadata.sign
but does not have the underlying optional 3rd-party dependencies (see Revise extra dependency handling secure-systems-lab/securesystemslib#179)Premise: Find a balance between OOP purism and pragmatism
The text was updated successfully, but these errors were encountered: