swh.shard package#
Submodules#
Module contents#
- class swh.shard.Shard(self: swh.shard._shard.ShardReader, path: str)[source]#
- Bases: - ShardReader- Instantiate a ShardReader object - Parameters:
- path – the filename of the shard to read 
 
- class swh.shard.ShardCreator(self: swh.shard._shard.ShardCreator, path: str, n: SupportsInt)#
- Bases: - pybind11_object- A shard file creator helper class - Instantiate a ShardCreator object - Parameters:
- path – the filename of the shard file to create 
- n – number of objects the shard file will store 
 
 - Typical usage will be: - with ShardCreate(‘my.shard’, 10) as shard:
- for i in range(10):
- shard.write(key_i, content_i) 
 
 - property header#
 - key_len = 32#
 - write(self: swh.shard._shard.ShardCreator, key: bytes, object: bytes) None#
- Write a new object in the shard file identified by given key