Home Reference Source Test
public interface | source

ICommittable

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

Returns the object store this transaction belongs to.

Protected Members
protected set

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

public get objectStore: * source

Returns the object store this transaction belongs to.

Protected Members

protected set _dependency(dependency: CombinedTransaction) source

Sets a new CombinedTransaction as dependency.

protected get abstract _parent: IObjectStore source

Retrieve a transactions immediate parent.

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:

NameTypeAttributeDescription
tx Transaction
  • optional

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:

NameTypeAttributeDescription
tx Transaction
  • optional

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:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
tx Transaction
  • optional

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:

NameTypeAttributeDescription
parent *