Staging instance, all changes can be removed at any time

Skip to content

Implement Shard.delete()

In order to be able to remove objects from objstorage–in the case of takedown notices–we add a new Shard.delete() method.

As Shard files uses a perfect hash function computed on creation, and fixed offsets, completely removing an object would amount to recreate a new Shard from scratch. As these files are meant to be quite large and removals should be rare, we just overwrite the object size and data with zeros.

The object position in the hash table is also replaced with UINT64_MAX in order to signal that the object has been removed. Shard.lookup() has been updated accordingly and will throw a KeyError if the object matching a key has been deleted.

The interface is not ideal but it is due to a more general problem of the design of API. The caller must be careful not to run delete() on a “created” or “loaded” Shard as the method will take care of opening the Shard file in read/write mode, overwrite the right bytes and close the file again.

Related to swh-alter#4 (closed) (for Winery)

Edited by Jérémy Bobbio (Lunar)

Merge request reports

Loading