Class SimpleTransaction

Transaction for simple stores.

See

  • SimpleSyncStore
  • SimpleAsyncStore

Hierarchy (view full)

Constructors

Properties

done: boolean = false

Whether the transaction was commited or aborted

modifiedKeys: Set<bigint> = ...

List of keys modified in this transaction, if any.

originalData: Map<bigint, void | Uint8Array> = ...

Stores data in the keys we modify prior to modifying them. Allows us to roll back commits.

Methods

  • Retrieves the data at the given key. Throws an error if an error occurs or if the key does not exist.

    Parameters

    • ino: bigint

      The key to look under for data.

    Returns Uint8Array

    The data stored under the key, or undefined if not present.

  • Marks the given key as modified, and stashes its value if it has not been stashed already.

    Parameters

    • ino: bigint

    Returns void

  • Adds the data to the store under the given key. Overwrites any existing data.

    Parameters

    • ino: bigint

      The key to add the data under.

    • data: Uint8Array

      The data to add to the store.

    Returns Promise<void>

  • Adds the data to the store under the given key.

    Parameters

    • ino: bigint

      The key to add the data under.

    • data: Uint8Array

      The data to add to the store.

    Returns void

    True if storage succeeded, false otherwise.

  • Stashes given key value pair into originalData if it doesn't already exist. Allows us to stash values the program is requesting anyway to prevent needless get requests if the program modifies the data later on during the transaction.

    Parameters

    • ino: bigint
    • Optional value: Uint8Array

    Returns void