pub struct BlobKey { /* private fields */ }Expand description
A blob’s content hash and storage namespace. Pack RPCs construct only
Pack keys, so an upload marker cannot be fetched as a pack.
Implementations§
Source§impl BlobKey
impl BlobKey
Sourcepub const fn upload_marker(hash: Hash) -> Self
pub const fn upload_marker(hash: Hash) -> Self
Construct an upload marker key.
Sourcepub const fn object(id: Hash) -> Self
pub const fn object(id: Hash) -> Self
Construct a global object key: the extracted content of object id.
Sourcepub const fn object_offsets(manifest_id: Hash) -> Self
pub const fn object_offsets(manifest_id: Hash) -> Self
Construct an offsets sidecar key for the ChunkedBlob manifest_id.
Sourcepub fn expected_root(&self, root: Option<Hash>) -> Result<Hash, StoreError>
pub fn expected_root(&self, root: Option<Hash>) -> Result<Hash, StoreError>
The hash a sink verifies the bytes against: the key’s own hash for
root = None (pack and marker keys), or the caller’s content root
for an object key, whose hash is an object id rather than a content
hash. An object key without a root, and a root on any other key, are
refused, so no backend can publish bytes under an object id without
checking them.
§Errors
StoreError::Invalid for either mismatch.
Sourcepub fn relative_path(&self, pack_keyspace: &str) -> Result<String, StoreError>
pub fn relative_path(&self, pack_keyspace: &str) -> Result<String, StoreError>
Path relative to a blob root, given the pack keyspace (which may include a deployment prefix). Markers and objects use its sibling namespaces.
§Errors
StoreError::Invalid for a namespace this backend does not support.
Sourcepub const fn namespace(&self) -> BlobNamespace
pub const fn namespace(&self) -> BlobNamespace
Physical namespace.