Simplest possible file store for blobs.
Project description
Simplest Possible Content-Addressable Blob Store
This is a simple content-addressable blob store. It stores blobs of data and associated metadata. The blobs are stored in a directory hierarchy based on the base58 encoding of their SHA-256 hash. Metadata is stored as siblings to the blob file.
# Create a blob store (does nothing)
blobstore = BlobStore('some-dir', hierarchy_depth=3)
# Save a blob ('some-dir/hash[0]/hash[1]/hash[2]/hash')
hash_str, file_path = blobstore.save(b'Hello, World!')
# Load a blob
blob = blobstore.load(hash_str)
# Save metadata
blobstore.store_sibling(hash_str, 'json', b'{"key": "value"}')
# Load metadata
metadata = blobstore.load_sibling(hash_str, 'json')
# Iter all items in the store
for hash_str, file_path in blobstore.iter_files(no_sibling=True):
print(hash_str, file_path)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
grugstore-0.0.2.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for grugstore-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e919f04a57fc81f17d13265db1a382666bc8f3e4f1add5cac62b4dc4326d23c9 |
|
MD5 | b568bdfe9193ada1066f8025e992be0b |
|
BLAKE2b-256 | de03107ecfb64b5e4dbebeb19b20fc911f2bd310750c64934576877a552611c7 |