Home Reference Source Test
public class | source

SnapshotManager

Defines the functionality needed for handling snapshots.

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

Returns an iterator over the snapshots.

public

abortSnapshot(snapshot: Snapshot): boolean

Aborts a snapshot.

public

async applyTx(tx: Transaction, backend: IObjectStore): Promise

Updates the snapshots managed by this class.

public

createSnapshot(objectStore: ObjectStore, backend: IObjectStore): Snapshot

Creates an in-memory snapshot of the current state.

Public Constructors

public constructor() source

Public Methods

public [Symbol.iterator](): Iterator<Snapshot> source

Returns an iterator over the snapshots.

Return:

Iterator<Snapshot>

public abortSnapshot(snapshot: Snapshot): boolean source

Aborts a snapshot.

Params:

NameTypeAttributeDescription
snapshot Snapshot

Return:

boolean

A promise of the success outcome.

public async applyTx(tx: Transaction, backend: IObjectStore): Promise source

Updates the snapshots managed by this class.

Params:

NameTypeAttributeDescription
tx Transaction

The transaction to apply.

backend IObjectStore

Return:

Promise

The promise resolves after applying the transaction.

public createSnapshot(objectStore: ObjectStore, backend: IObjectStore): Snapshot source

Creates an in-memory snapshot of the current state. This snapshot only maintains the differences between the state at the time of the snapshot and the current state. To stop maintaining the snapshot, it has to be aborted.

Params:

NameTypeAttributeDescription
objectStore ObjectStore
backend IObjectStore

Return:

Snapshot