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.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for grugstore-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2ff3f6b4aa988b940178a7e7cbd1b517259396bb5da7b0fe401eca5e00412c |
|
MD5 | 26e94081cc9375d9f155f7ffb908a174 |
|
BLAKE2b-256 | cf3154f30cc8c515f16599792c231cd819d0260f54d504669b1e3beed9e8e807 |