Skip to content

AsyncTransaction

Defined in: src/backends/store/store.ts:188

Transaction that implements synchronous operations with a cache Implementors: You must update the cache and wait for store.asyncDone in your asynchronous methods.

Make sure we handle abortions correctly, especially since the cache is shared between transactions.

T extends AsyncStore = AsyncStore

new AsyncTransaction<T>(store): AsyncTransaction<T>

Defined in: src/backends/store/store.ts:85

T

AsyncTransaction<T>

Transaction.constructor

protected asyncDone: Promise<unknown>

Defined in: src/backends/store/store.ts:189


readonly store: T

Defined in: src/backends/store/store.ts:85

Transaction.store

_cached(id, info?): Resource<number> | undefined

Defined in: src/backends/store/store.ts:204

Internal

Gets a cache resource If info is set and the resource doesn’t exist, it will be created

number

number

Resource<number> | undefined


optional abort(): Promise<void>

Defined in: src/backends/store/store.ts:139

Discards the changes, which stores with the atomic flag must implement

Promise<void>

Transaction.abort


optional abortSync(): void

Defined in: src/backends/store/store.ts:142

Discards the changes, which stores with the atomic flag must implement

void

Transaction.abortSync


protected async(promise): void

Defined in: src/backends/store/store.ts:195

Internal

Run a asynchronous operation from a sync context. Not magic and subject to (race) conditions.

Promise<unknown>

void


optional commit(): Promise<void>

Defined in: src/backends/store/store.ts:133

Applies the changes, which stores with the atomic flag must implement

Promise<void>

Transaction.commit


optional commitSync(): void

Defined in: src/backends/store/store.ts:136

Applies the changes, which stores with the atomic flag must implement

void

Transaction.commitSync


abstract get(id, offset, end?): Promise<Uint8Array<ArrayBufferLike> | undefined>

Defined in: src/backends/store/store.ts:96

Retrieves data.

number

The key to look under for data.

number

number

Promise<Uint8Array<ArrayBufferLike> | undefined>

Transaction.get


getSync(id, offset, end?): Uint8Array<ArrayBufferLike> | undefined

Defined in: src/backends/store/store.ts:212

Retrieves data. Throws an error if an error occurs or if the key does not exist.

number

The key to look under for data.

number

number

Uint8Array<ArrayBufferLike> | undefined

The data stored under the key, or undefined if not present.

Transaction.getSync


abstract keys(): Promise<Iterable<number, any, any>>

Defined in: src/backends/store/store.ts:90

Gets all of the keys

Promise<Iterable<number, any, any>>

Transaction.keys


abstract remove(id): Promise<void>

Defined in: src/backends/store/store.ts:124

Deletes the data at ino.

number

The key to delete from the store.

Promise<void>

Transaction.remove


removeSync(id): void

Defined in: src/backends/store/store.ts:238

Deletes the data at ino.

number

The key to delete from the store.

void

Transaction.removeSync


abstract set(id, data, offset?): Promise<void>

Defined in: src/backends/store/store.ts:111

Stores data under an id. Without offset, replaces any existing data. With offset, writes the data at offset and keeps the rest, which partial stores must support.

number

Uint8Array

number

Promise<void>

Transaction.set


setSync(id, data, offset?): void

Defined in: src/backends/store/store.ts:234

Stores data under an id. Without offset, replaces any existing data. With offset, writes the data at offset and keeps the rest, which partial stores must support.

number

Uint8Array

number

void

Transaction.setSync