انتقل إلى المحتوى الرئيسي

Interface: ArtifactStore

Defined in: packages/artifact-store/src/port.ts:128

The port. Every method validates the key first, makes one logical request (the adapter's own retries aside) and answers null for a key that holds nothing.

Call it outside database transactions: each method waits on the network, and a transaction held open across it starves every other caller of connections (28, section 3). The pattern is sign, assert the signed bytes equal the bytes to store, put, then record the publication.

Extended by​

Methods​

get()​

get(key): Promise<StoredArtifact | null>

Defined in: packages/artifact-store/src/port.ts:173

The object and its bytes, or null when the key holds nothing. For tests, the preview and the conditional-create check; never on a path that serves the public.

Parameters​

key​

string

Returns​

Promise<StoredArtifact | null>


head(key): Promise<ArtifactHead | null>

Defined in: packages/artifact-store/src/port.ts:167

The object's metadata, or null when the key holds nothing.

Parameters​

key​

string

Returns​

Promise<ArtifactHead | null>


put()​

Call Signature​

put(key, bytes, meta, options?): Promise<UnfencedPutResult>

Defined in: packages/artifact-store/src/port.ts:144

Stores bytes at key with meta, unchanged: no content encoding, no re-serialisation, no checksum trailer. Do not mutate bytes until it settles.

Two signatures, one behaviour. Without ifMatch the answer is stored or exists; with it, stale joins them. The first signature is the one that existed before the fence, so a caller that never fences is not asked to handle an answer it cannot get.

Parameters​
key​

string

bytes​

Uint8Array

meta​

ArtifactMeta

options?​

PutOptions & object

Returns​

Promise<UnfencedPutResult>

Throws​

On any failure. When indeterminate is true the write may have landed. For a create or a plain replace, retry with ifNoneMatch: '*' and treat exists with identical: true as success. For a fenced write, get the key: holding these bytes means it landed, and anything else is where the next fenced attempt starts from. Repeating the same ifMatch cannot tell the two apart, because a write that landed changed the tag.

Call Signature​

put(key, bytes, meta, options): Promise<PutResult>

Defined in: packages/artifact-store/src/port.ts:159

The same put, fenced: with ifMatch the bytes are stored only if the key still holds the object that tag names, and the answer may be stale. Everything said above holds, the indeterminate rule for a fenced write included.

Parameters​
key​

string

bytes​

Uint8Array

meta​

ArtifactMeta

options​

PutOptions

Returns​

Promise<PutResult>

Throws​

On any failure, and invalid_request before any request for an ifMatch that is not one quoted entity tag or that comes with ifNoneMatch.