Crate rstr[][src]

Expand description

rstr is a library for managing a content-addressable blob store.

The BlobStore struct manages the interaction with the blob store. An entry in the blob store is represented by an instance of the struct BlobRef.


Add files or directories to the blob store:

use rstr::{BlobStore,BlobRef};
use std::path::{Path, PathBuf};

let blob_store = BlobStore::new("../tests/test_data_store").unwrap();
let n_threads: u8 = 8;
let (blob_refs_with_paths, _): (Vec<(PathBuf, BlobRef)>, _) = blob_store.add_files(
        // Can add files
        // or directories
let blob_refs: Vec<BlobRef> = blob_refs_with_paths.into_iter().map(|(_, b)| b).collect();

Retrieve a blob from the blob store

use rstr::{BlobStore, BlobRef};

let blob_store = BlobStore::new("../tests/test_data_store").unwrap();

// Retrieve a blob from the blob store
let reference = "f29bc64a9d3732b4b9035125fdb3285f5b6455778edca72414671e0ca3b2e0de";
let blob_ref = BlobRef::new(reference).unwrap();


// Get the blob's content
let content = blob_store.get(&blob_ref).unwrap();

// Get the blob's metadata
let metadata = blob_store.metadata(&blob_ref).unwrap();
assert_eq!(metadata.filename, "test_file.txt");
assert_eq!(metadata.mime_type, "text/plain");


Struct representing the metadata associated to a blob

Struct representing a reference to an entry in the blob store

Struct for interacting with the blob store


Error raised by the blob store


The Digest trait specifies an interface common for digest functions.

Type Definitions

Shorthand for Result type