Skip to main content

FileContentStore

@forge/monorepo


@forge/monorepo / backend/src / FileContentStore

Interface: FileContentStore

Defined in: backend/src/persistence/index.ts:1282

The bytes.

Separate from FileMetadataStore because object storage cannot join a database transaction, and pretending otherwise is what produces orphans. Every method is tenant-scoped: a contentKey from one tenant must never resolve another's object, and the key alone must not be sufficient.

Methods

deleteFile()

deleteFile(input): Promise<void>

Defined in: backend/src/persistence/index.ts:1314

Idempotent: deleting an absent object is a no-op, because a retried sweep must not fail.

Parameters

input

TenantScope & object

Returns

Promise<void>


listObjects()

listObjects(input): Promise<Page<StoredObject>>

Defined in: backend/src/persistence/index.ts:1322

Objects this tenant has stored.

For reconciliation's second direction — bytes with no metadata — which is the one that costs money silently and which the metadata store cannot see at all.

Parameters

input

TenantScope & PageRequest & object

Returns

Promise<Page<StoredObject>>


putFile()

putFile(input): Promise<StoredContent>

Defined in: backend/src/persistence/index.ts:1290

Write bytes and report what was written.

maxBytes is enforced while reading, not checked beforehand. A declared size is a claim; the cap is the defence. An adapter must stop consuming and discard the partial object when the cap is passed — reading to the end and then refusing is a denial of service that happens to return an error.

Parameters

input

TenantScope & object

Returns

Promise<StoredContent>


readFile()

readFile(input): Promise<AsyncIterable<Uint8Array<ArrayBufferLike>, any, any> | null>

Defined in: backend/src/persistence/index.ts:1300

null when absent, or when the key belongs to another tenant.

Parameters

input

TenantScope & object

Returns

Promise<AsyncIterable<Uint8Array<ArrayBufferLike>, any, any> | null>


signedUrl()

signedUrl(input): Promise<string | null>

Defined in: backend/src/persistence/index.ts:1309

A short-lived authorised URL, or null when this adapter proxies reads instead.

expiresInSeconds is required, and there is deliberately no method that returns a durable URL — that is AC-6 of #129 made structural rather than left as a rule an adapter has to remember. An adapter with no signing mechanism returns null and the caller streams through readFile.

Parameters

input

TenantScope & object

Returns

Promise<string | null>