pub struct BlobDecl {
pub id_column: String,
pub size_column: String,
pub hash_column: String,
pub namespace: String,
pub cloud_path_column: Option<String>,
pub scope: BlobScope,
pub provenance: Provenance,
pub fill: CacheFill,
pub replacement: BlobReplacement,
}Expand description
Where a blob-bearing table’s blob columns live, declared by the host so coven
can derive every blob a row references without a runtime callback. Resolved
against the live schema into a [crate::blob::decl::BlobDecls] each cycle.
A blob declares two orthogonal properties: provenance
(its Local story) and fill (its Remote story).
Fields§
§id_column: StringThe column holding the blob id. Defaults to the primary key (id, column
0), which is the blob id for most tables.
size_column: StringThe column holding the blob’s plaintext length in bytes.
hash_column: StringThe column holding the blob’s content hash — the lowercase-hex SHA-256 of
its plaintext, computed at import (see [crate::blob::content_hash]). The
row carries it in a signed changeset, so it is signed by the row’s author;
on download coven hashes the decrypted plaintext and requires equality with
this value, so the bytes are pinned by the author, not by where they were
found. Defaults to hash.
namespace: StringCloud namespace for the blob, e.g. "images" or "audio".
cloud_path_column: Option<String>The column holding the consumer’s readable cloud-relative path, used as the
object key under the plain (browsable) blob-path scheme. None means the
blob is keyed only by its hashed id (the default obfuscated scheme).
scope: BlobScopeHow the blob is scoped for encryption (see crate::blob::BlobScope).
provenance: ProvenanceThe blob’s Local story: crate::blob::Provenance::UserProvided (the
user’s file at a path) or crate::blob::Provenance::HostProvided (coven’s
own copy in the local store).
fill: CacheFillThe blob’s Remote story: crate::blob::CacheFill::CacheEager (fetched
into the cache on every pull) or crate::blob::CacheFill::CacheLazy
(fetched into the cache on first read).
replacement: BlobReplacementThe blob’s replacement story: whether this row may be repointed at a
different blob (crate::blob::BlobReplacement). Decides what coven requires of
the blob’s cloud key so that a cloud object is never rewritten with different
bytes. Defaults to crate::blob::BlobReplacement::Replaceable.
Implementations§
Source§impl BlobDecl
impl BlobDecl
Sourcepub fn new(
namespace: impl Into<String>,
provenance: Provenance,
fill: CacheFill,
) -> BlobDecl
pub fn new( namespace: impl Into<String>, provenance: Provenance, fill: CacheFill, ) -> BlobDecl
A blob declaration in namespace with the given provenance (its Local
story) and cache fill (its Remote story), the blob id taken from the
primary key (id), no readable cloud path, master-scoped, and
Replaceable. Refine with the
with_* builders.
Sourcepub fn write_once(self) -> BlobDecl
pub fn write_once(self) -> BlobDecl
Declare that this table’s row is never repointed at a different blob
(crate::blob::BlobReplacement::WriteOnce), which frees its readable
cloud_path to be a stable, fully human-readable name. coven refuses a
repointing. Read that variant’s docs before reaching for this: it is a weaker
contract than the default, and it asks the consumer to guarantee the part coven
cannot see — that a path is never reused by a different blob.
Sourcepub fn with_id_column(self, column: impl Into<String>) -> BlobDecl
pub fn with_id_column(self, column: impl Into<String>) -> BlobDecl
Take the blob id from column instead of the primary key.
Sourcepub fn with_size_column(self, column: impl Into<String>) -> BlobDecl
pub fn with_size_column(self, column: impl Into<String>) -> BlobDecl
Take the plaintext byte length from column instead of size.
Sourcepub fn with_hash_column(self, column: impl Into<String>) -> BlobDecl
pub fn with_hash_column(self, column: impl Into<String>) -> BlobDecl
Take the content hash from column instead of hash.
Sourcepub fn with_cloud_path_column(self, column: impl Into<String>) -> BlobDecl
pub fn with_cloud_path_column(self, column: impl Into<String>) -> BlobDecl
Key the blob at the readable cloud path in column (the plain scheme).
Sourcepub fn with_scope(self, scope: BlobScope) -> BlobDecl
pub fn with_scope(self, scope: BlobScope) -> BlobDecl
Scope the blob’s encryption (defaults to crate::blob::BlobScope::Master).
Trait Implementations§
impl Eq for BlobDecl
impl StructuralPartialEq for BlobDecl
Auto Trait Implementations§
impl Freeze for BlobDecl
impl RefUnwindSafe for BlobDecl
impl Send for BlobDecl
impl Sync for BlobDecl
impl Unpin for BlobDecl
impl UnsafeUnpin for BlobDecl
impl UnwindSafe for BlobDecl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more