1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// SPDX-License-Identifier: Apache-2.0
//! The [`BlobStore`] trait.
use Arc;
use async_trait;
use Bytes;
use crate::;
/// Convenience type alias: `Arc<dyn BlobStore>`.
///
/// Use this when you want to pass a [`BlobStore`] handle by value
/// across async tasks without re-introducing the dynamic-dispatch
/// boilerplate at every call site.
pub type SharedBlobStore = ;
/// A content-addressed blob store.
///
/// Implementations are `Send + Sync` and perform their own concurrency
/// control. Callers treat the trait as a key-value store keyed by
/// [`Digest`]; implementations are free to layer caches, compression,
/// or replication beneath it.
///
/// ### `put` semantics
///
/// `put` is responsible for verifying that the SHA-256 (or SHA-512)
/// of the supplied bytes matches the supplied [`Digest`]. On
/// mismatch implementations return
/// [`crate::BlobStoreError::DigestMismatch`].
///
/// Writes SHOULD be atomic: a partial write must not be observable by
/// a concurrent reader. The reference [`crate::FsBlobStore`]
/// achieves this via temp-file + atomic rename; the in-memory
/// implementation is atomic by virtue of holding the write lock for
/// the duration of the insert.
///
/// ### Future evolution
///
/// `v0.1` will add `put_stream` / `get_stream` and a paginated
/// `list` variant. The current method set is stable for the
/// `v0.0.x` series.