Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/interface.py
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | def __contains__(self, obj_id): | ||||
Returns: | Returns: | ||||
True if and only if the object is present in the current object | True if and only if the object is present in the current object | ||||
storage. | storage. | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("content/add") | @remote_api_endpoint("content/add") | ||||
def add(self, content, obj_id=None, check_presence=True): | def add(self, content, obj_id, check_presence=True): | ||||
"""Add a new object to the object storage. | """Add a new object to the object storage. | ||||
Args: | Args: | ||||
content (bytes): object's raw content to add in storage. | content (bytes): object's raw content to add in storage. | ||||
obj_id (bytes): checksum of [bytes] using [ID_HASH_ALGO] | obj_id (bytes): checksum of [bytes] using [ID_HASH_ALGO] | ||||
algorithm. When given, obj_id will be trusted to match | algorithm. It is trusted to match the bytes. | ||||
the bytes. If missing, obj_id will be computed on the | |||||
fly. | |||||
check_presence (bool): indicate if the presence of the | check_presence (bool): indicate if the presence of the | ||||
content should be verified before adding the file. | content should be verified before adding the file. | ||||
Returns: | Returns: | ||||
the id (bytes) of the object into the storage. | the id (bytes) of the object into the storage. | ||||
""" | """ | ||||
... | ... | ||||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |