Home Reference Source Test
public interface | source

ISynchronousWritableObjectStore

Extends:

IReadableObjectStoreIObjectStore → ISynchronousWritableObjectStore

Direct Subclass:

ISynchronousObjectStore

Implements:

Indirect Implements:

Indirect Implemented:

This interface represents a synchronous object store. It allows to preload key-value-pairs and store them in a cache.

WARNING: If not all required key-value-pairs are preloaded, the results of any call on a synchronous transaction might be wrong. Only use synchronous variants, if unavoidable.

Method Summary

Public Methods
public abstract

putSync(key: string, value: *)

Inserts or replaces a key-value pair.

public abstract

removeSync(key: string)

Removes the key-value pair of the given key from the object store.

public abstract

Empties the object store.

Inherited Summary

From class IReadableObjectStore
public get

connected: boolean

public get abstract

indices: Map<string, IIndex>

A map of index names to indices.

public abstract

async close(): Promise

Closes the object store and potential connections.

public abstract

async count(query: KeyRange): Promise<number>

Returns the count of entries in the given range.

public abstract

decode(value: *, key: string): *

Method called to decode a single value.

public abstract

encode(value: *): *

Method called to encode a single value.

public abstract

async get(key: string, options: RetrievalConfig): Promise<*>

Returns a promise of the object stored under the given primary key.

public abstract

index(indexName: string): IIndex

Returns the index of the given name.

public abstract

isSynchronous(): boolean

Checks whether an object store implements the ISynchronousObjectStore interface.

public abstract

keyStream(callback: function(key: string): boolean, ascending: boolean, query: KeyRange): Promise

Iterates over the keys in a given range and direction.

public abstract

async keys(query: Query | KeyRange, limit: number): Promise<Set<string>>

Returns a promise of a set of keys fulfilling the given query.

public abstract

async maxKey(query: KeyRange): Promise<string>

Returns a promise of the key being maximal for the given range.

public abstract

async maxValue(query: KeyRange): Promise<*>

Returns a promise of the object whose primary key is maximal for the given range.

public abstract

async minKey(query: KeyRange): Promise<string>

Returns a promise of the key being minimal for the given range.

public abstract

async minValue(query: KeyRange): Promise<*>

Returns a promise of the object whose primary key is minimal for the given range.

public abstract

async truncate(): Promise

Empties the object store.

public abstract

valueStream(callback: function(value: *, key: string): boolean, ascending: boolean, query: KeyRange): Promise

Iterates over the keys and values in a given range and direction.

public abstract

async values(query: Query | KeyRange, limit: number): Promise<Array<*>>

Returns a promise of an array of objects whose primary keys fulfill the given query.

protected abstract

async _apply(tx: Transaction): Promise

Internally applies a transaction to the store's state. This needs to be done in batch (as a db level transaction), i.e., either the full state is updated or no changes are applied.

From class IObjectStore
public abstract

async put(key: string, value: *): Promise

Inserts or replaces a key-value pair.

public abstract

async remove(key: string): Promise

Removes the key-value pair of the given key from the object store.

public abstract

Creates a new synchronous transaction, ensuring read isolation on the most recently successfully committed state.

public abstract

transaction(enableWatchdog: boolean): Transaction

Creates a new transaction, ensuring read isolation on the most recently successfully committed state.

Public Methods

public abstract putSync(key: string, value: *) source

Inserts or replaces a key-value pair.

Params:

NameTypeAttributeDescription
key string

The primary key to associate the value with.

value *

The value to write.

public abstract removeSync(key: string) source

Removes the key-value pair of the given key from the object store.

Params:

NameTypeAttributeDescription
key string

The primary key to delete along with the associated object.

public abstract truncateSync() source

Empties the object store.