question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New API: Revise "update" methods in tuf/api/metadata.py

See original GitHub issue

Description of issue or feature request: Currently, we are using a method called update to update certain fields of the metadata represented by our classes. In Timestamp we are updating the information about the meta part from signed or more precisely the information about snapshot.json In Snapshot we are updating the information about target.json or a specific delegation which are again in meta part from signed portion of the metadata file. In Targets we are updating information about a specific target which is in targets part from signed portion of the metadata file.

It’s clear that by update the different classes are doing different stuff and it’s a little ambiguous. One could easily ask the following questions: In Snapshot with update do we update one or all files from meta? In Targets with update do we update the information about one or many target files? In Timestamp with update what are we updating? The spec version, the expiry date?

@lukpueh gave more insight with the following comment:

I would say the name "update" in {Targets, Snapshot, Timestamp}.update(...) does not stand for 
"update attributes of an object" but rather for "update attributes of an object in the course 
of a repository update". 
I am talking about the Update in The Update Framework.

Right now a TUF integrator needs to call exactly these update methods explicitly 
whenever target files are added, thus the above meaning of update made sense to me.

here: https://github.com/theupdateframework/tuf/pull/1223#discussion_r532665409

We need to revise the need for the update functions, their naming, and purpose.

Important Consideration We know that Warehouse is using our current version of tuf/api/metadata which means they are using the update methods. Resolving this issue will be a breaking change and we should be careful when to do it.

Solution Revise the need of the update functions as a whole. Maybe we can replace them with add/remove functions?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jkucommented, Dec 14, 2020

in the future we will add a controller class which will handle the update.

Following is my gut feeling on this, not going to fight on these: I think it makes sense to keep the metadata API unaware of the complexities of the client update process (and just include things that are truly common to all of the tools that need to handle metadata) – but do agree that a client metadata controller is required somewhere: I estimate that that component will include most of the tricky bits of the updater code so I’d be inclined to make it an implementation detail of the updater (instead of part of the public API) at least in the beginning

0reactions
lukpuehcommented, Nov 10, 2021

Closing in favor of #1627

Read more comments on GitHub >

github_iconTop Results From Across the Web

Updating features in a feature layer | ArcGIS API for Python
Method 1: editing individual features as updated datasets are available; Method 2: overwriting feature layers altogether with updated datasets. Depending on the ...
Read more >
Revisions: update | Drive API - Google Developers
If successful, this method returns a Revisions resource in the response body. Examples. Note: The code examples available for this method do not ......
Read more >
Python and REST APIs: Interacting With Web Services
Partially update an existing resource. DELETE, Delete a resource. A REST API client application can use these five HTTP methods to manage the...
Read more >
Update and delete table rows using the Web API
Unsure about entity vs. table? See Developers: Understand terminology in Microsoft Dataverse. Operations to modify data are a core part of the ...
Read more >
Google Sheets API (Python Client) is inserting data ...
I will insert data using the update and append methods, the execution is completed successfully with no errors. Then I'll change the range ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found