IBackend
Extends:
Implements:
Direct Implemented:
This interface provides the methods specific to backends.
Method Summary
Public Methods | ||
public abstract |
async applyCombined(tx: Transaction): function(): Promise> Returns the necessary information in order to flush a combined transaction. |
|
public abstract |
createIndex(indexName: string, keyPath: string | Array<string>, options: IndexConfig) Creates a new secondary index on the object store. |
|
public abstract |
deleteIndex(indexName: *, options: function(oldVersion: number, newVersion: number): boolean}) Deletes a secondary index from the object store. |
|
public abstract |
isSynchronous(): boolean Checks whether an object store implements the ISynchronousObjectStore interface. |
Inherited Summary
From class IReadableObjectStore | ||
public get |
connected: boolean |
|
public get abstract |
A map of index names to indices. |
|
public abstract |
async close(): Promise Closes the object store and potential connections. |
|
public abstract |
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 |
Returns the index of the given name. |
|
public abstract |
isSynchronous(): boolean Checks whether an object store implements the ISynchronousObjectStore interface. |
|
public abstract |
Iterates over the keys in a given range and direction. |
|
public abstract |
Returns a promise of a set of keys fulfilling the given query. |
|
public abstract |
Returns a promise of the key being maximal for the given range. |
|
public abstract |
Returns a promise of the object whose primary key is maximal for the given range. |
|
public abstract |
Returns a promise of the key being minimal for the given range. |
|
public abstract |
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 |
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. |
Public Methods
public abstract async applyCombined(tx: Transaction): function(): Promise> source
Returns the necessary information in order to flush a combined transaction.
Params:
Name | Type | Attribute | Description |
tx | Transaction | The transaction that should be applied to this backend. |
Return:
function(): Promise> | For non-persistent backends: a function that effectively applies the transaction. Native backends otherwise specify their own information as needed by their JungleDB instance. |
public abstract createIndex(indexName: string, keyPath: string | Array<string>, options: IndexConfig) source
Creates a new secondary index on the object store. Currently, all secondary indices are non-unique. They are defined by a key within the object or alternatively a path through the object to a specific subkey. For example, ['a', 'b'] could be used to use 'key' as the key in the following object: { 'a': { 'b': 'key' } } Secondary indices may be multiEntry, i.e., if the keyPath resolves to an iterable object, each item within can be used to find this entry. If a new object does not possess the key path associated with that index, it is simply ignored.
This function may only be called before the database is connected. Moreover, it is only executed on database version updates or on first creation.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index. |
|
keyPath | string | Array<string> |
|
The path to the key within the object. May be an array for multiple levels. |
options | IndexConfig |
|
An options object. |
public abstract deleteIndex(indexName: *, options: function(oldVersion: number, newVersion: number): boolean}) source
Deletes a secondary index from the object store.
Params:
Name | Type | Attribute | Description |
indexName | * | ||
options | function(oldVersion: number, newVersion: number): boolean} |
|
public abstract isSynchronous(): boolean source
Checks whether an object store implements the ISynchronousObjectStore interface.
Override:
IReadableObjectStore#isSynchronousReturn:
boolean | The transaction object. |