ICommittable
Direct Implemented:
Indirect Implemented:
This interface represents an object store (roughly corresponding to a table in a relational database). It stores key-value pairs where the key is generally considered to be a string and the value is any object. The key is the entry's primary key. Other keys within the object may be accessed by indices as offered by the store.
Member Summary
Public Members | ||
public get |
|
|
public get |
objectStore: * Returns the object store this transaction belongs to. |
Protected Members | ||
protected set |
_dependency(dependency: CombinedTransaction) Sets a new CombinedTransaction as dependency. |
|
protected get abstract |
Retrieve a transactions immediate parent. |
Method Summary
Public Methods | ||
public abstract |
async abort(tx: Transaction): Promise Is used to abort an open transaction. |
|
public abstract |
async commit(tx: Transaction): Promise<boolean> Is used to commit the state of an open transaction. |
Protected Methods | ||
protected abstract |
async _checkConstraints(): Promise<boolean> Is used to check constraints before committing. |
|
protected abstract |
async _commitBackend(): Promise<boolean> Commits the transaction to the backend. |
|
protected abstract |
async _commitInternal(tx: Transaction): Promise Is used to commit the transaction. |
|
protected abstract |
_isCommittable(tx: Transaction): boolean Is used to probe whether a transaction can be committed. |
|
protected abstract |
_setParent(parent: *) Allows to change the backend of a Transaction when the state has been flushed. |
Public Members
public get dependency: CombinedTransaction source
Protected Members
protected set _dependency(dependency: CombinedTransaction) source
Sets a new CombinedTransaction as dependency.
Public Methods
public abstract async abort(tx: Transaction): Promise source
Is used to abort an open transaction. A user only needs to call this method on Transactions without arguments. The optional tx argument is only used internally, in order to abort a transaction on the underlying store.
Params:
Name | Type | Attribute | Description |
tx | Transaction |
|
The transaction to be aborted, only used internally. |
Return:
Promise | The promise resolves after successful abortion of the transaction. |
public abstract async commit(tx: Transaction): Promise<boolean> source
Is used to commit the state of an open transaction. A user only needs to call this method on Transactions without arguments. The optional tx argument is only used internally, in order to commit a transaction to the underlying store. If the commit was successful, the method returns true, and false otherwise.
Params:
Name | Type | Attribute | Description |
tx | Transaction |
|
The transaction to be applied, only used internally. |
Return:
Promise<boolean> | A promise of the success outcome. |
Protected Methods
protected abstract async _checkConstraints(): Promise<boolean> source
Is used to check constraints before committing. If a constraint is not satisfied, the commitable is aborted and an exception is thrown.
Return:
Promise<boolean> |
Throw:
* |
protected abstract async _commitBackend(): Promise<boolean> source
Commits the transaction to the backend.
Return:
Promise<boolean> | A promise of the success outcome. |
protected abstract async _commitInternal(tx: Transaction): Promise source
Is used to commit the transaction.
Params:
Name | Type | Attribute | Description |
tx | Transaction | The transaction to be applied. |
Return:
Promise | A promise that resolves upon successful application of the transaction. |
protected abstract _isCommittable(tx: Transaction): boolean source
Is used to probe whether a transaction can be committed. This, for example, includes a check whether another transaction has already been committed.
Params:
Name | Type | Attribute | Description |
tx | Transaction |
|
The transaction to be applied, if not given checks for the this transaction. |
Return:
boolean | Whether a commit will be successful. |
protected abstract _setParent(parent: *) source
Allows to change the backend of a Transaction when the state has been flushed.
Params:
Name | Type | Attribute | Description |
parent | * |