Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/api/client.py
Show First 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | def revision_metadata_add(self, metadatas, conflict_update=False): | ||||
}) | }) | ||||
def revision_metadata_missing(self, metadatas): | def revision_metadata_missing(self, metadatas): | ||||
return self.post('revision_metadata/missing', {'metadatas': metadatas}) | return self.post('revision_metadata/missing', {'metadatas': metadatas}) | ||||
def revision_metadata_get(self, ids): | def revision_metadata_get(self, ids): | ||||
return self.post('revision_metadata', {'ids': ids}) | return self.post('revision_metadata', {'ids': ids}) | ||||
def origin_metadata_add(self, origin, ts, provenance, metadata): | |||||
return self.post('/origin/metadata/add', {'origin': origin, | |||||
'ts': ts, | |||||
'provenance': provenance, | |||||
'metadata': metadata}) | |||||
def origin_metadata_get(self, origin_metadata_id): | |||||
return self.post('/origin/metadata/get', {'id': origin_metadata_id}) | |||||
def origin_metadata_get_all(self, origin_id): | |||||
return self.post('/origin/metadata/getall', {'origin_id': origin_id}) | |||||
def origin_metadata_get_by_provenance(self, origin_id, provenance): | |||||
return self.post('/origin/metadata/getbyprovenance', { | |||||
'origin_id': origin_id, | |||||
'provenance': provenance}) | |||||
def indexer_configuration_get(self, tool): | def indexer_configuration_get(self, tool): | ||||
return self.post('indexer_configuration/data', {'tool': tool}) | return self.post('indexer_configuration/data', {'tool': tool}) | ||||
ardumont: We should merge those methods (get/get_all).
If someone wants only 1 origin_metadata, (s)he… | |||||
Done Inline Actionsindentation :) ardumont: indentation :) | |||||
Done Inline Actionsprovider/get? ardumont: `provider/get`? | |||||
Done Inline ActionsI think this is some dead code. ardumont: I think this is some dead code. |
We should merge those methods (get/get_all).
If someone wants only 1 origin_metadata, (s)he should simply asks for one origin_metadata (list of 1 element).
That's what we do for most of our endpoints content, revision, etc...
Not sure why we diverge for cache_content_get/get_all endpoint.
That was either a mistake, either possibly unavoidable.
(Plus that endpoint seems to no longer be used so it should go away anyways).
To sum up, as we can avoid the duplication here, we should stick to the standard :)