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.
Extends
Section titled “Extends”Transaction<T>
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”T extends AsyncStore = AsyncStore
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AsyncTransaction<
T>(store):AsyncTransaction<T>
Defined in: src/backends/store/store.ts:85
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”AsyncTransaction<T>
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”asyncDone
Section titled “asyncDone”
protectedasyncDone:Promise<unknown>
Defined in: src/backends/store/store.ts:189
readonlystore:T
Defined in: src/backends/store/store.ts:85
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”_cached()
Section titled “_cached()”_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
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”Resource<number> | undefined
abort()?
Section titled “abort()?”
optionalabort():Promise<void>
Defined in: src/backends/store/store.ts:139
Discards the changes, which stores with the atomic flag must implement
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”abortSync()?
Section titled “abortSync()?”
optionalabortSync():void
Defined in: src/backends/store/store.ts:142
Discards the changes, which stores with the atomic flag must implement
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”async()
Section titled “async()”
protectedasync(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.
Parameters
Section titled “Parameters”promise
Section titled “promise”Promise<unknown>
Returns
Section titled “Returns”void
commit()?
Section titled “commit()?”
optionalcommit():Promise<void>
Defined in: src/backends/store/store.ts:133
Applies the changes, which stores with the atomic flag must implement
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”commitSync()?
Section titled “commitSync()?”
optionalcommitSync():void
Defined in: src/backends/store/store.ts:136
Applies the changes, which stores with the atomic flag must implement
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”
abstractget(id,offset,end?):Promise<Uint8Array<ArrayBufferLike> |undefined>
Defined in: src/backends/store/store.ts:96
Retrieves data.
Parameters
Section titled “Parameters”number
The key to look under for data.
offset
Section titled “offset”number
number
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike> | undefined>
Inherited from
Section titled “Inherited from”getSync()
Section titled “getSync()”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.
Parameters
Section titled “Parameters”number
The key to look under for data.
offset
Section titled “offset”number
number
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | undefined
The data stored under the key, or undefined if not present.
Overrides
Section titled “Overrides”keys()
Section titled “keys()”
abstractkeys():Promise<Iterable<number,any,any>>
Defined in: src/backends/store/store.ts:90
Gets all of the keys
Returns
Section titled “Returns”Promise<Iterable<number, any, any>>
Inherited from
Section titled “Inherited from”remove()
Section titled “remove()”
abstractremove(id):Promise<void>
Defined in: src/backends/store/store.ts:124
Deletes the data at ino.
Parameters
Section titled “Parameters”number
The key to delete from the store.
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”removeSync()
Section titled “removeSync()”removeSync(
id):void
Defined in: src/backends/store/store.ts:238
Deletes the data at ino.
Parameters
Section titled “Parameters”number
The key to delete from the store.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”
abstractset(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.
Parameters
Section titled “Parameters”number
Uint8Array
offset?
Section titled “offset?”number
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”setSync()
Section titled “setSync()”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.
Parameters
Section titled “Parameters”number
Uint8Array
offset?
Section titled “offset?”number
Returns
Section titled “Returns”void