Skip to content

Defined in: packages/cas/src/artifact.ts:37

The storage a ContentAddressedStore writes through.

Injected rather than bundled, because the tree ships no runtime that reads files: an in-memory Map, an S3 client, a fetch-backed object store, and a browser cache all satisfy this shape. The backend owns durability, listing, and concurrency; the store owns framing, addressing, and verification.

A backend that returns the wrong bytes for a key is not trusted: get re-hashes what it reads and refuses to decode a mismatch.

The members are get and set, the vocabulary’s settled spellings for a keyed store’s read and write. read and write are reserved for a fixed-width field primitive.

readonly has: (address) => Promise<boolean>

Defined in: packages/cas/src/artifact.ts:39

Whether address is present. O(1) expected for a map-backed backend.

string

Promise<boolean>


readonly set: (address, bytes) => Promise<void>

Defined in: packages/cas/src/artifact.ts:48

Store bytes under address, replacing whatever was there.

Content addressing makes a rewrite idempotent when the hash is deterministic, so a backend need not be idempotent itself: the store writes an address only when it read nothing back, or read back different bytes that it has already reported as a failure.

string

Uint8Array

Promise<void>


readonly get: (address) => Promise<Uint8Array<ArrayBufferLike> | undefined>

Defined in: packages/cas/src/artifact.ts:50

Return the bytes stored under address, or undefined when the address is absent.

string

Promise<Uint8Array<ArrayBufferLike> | undefined>