Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Transaction

A transaction can be used similar to a Connection to get references to database and objects and to perform reads and updates.

Example:

    let tx = await antidote.startTransaction()
    // create object reference bound to the transaction:
    let reg = tx.multiValueRegister<number>("some-key");

    // read the register in the transaction:
    let vals = await reg.read();

    // update the register based on current values
    let newval = f(vals)
    await tx.update(
        reg.set(newval)
    )
    await tx.commit()

Hierarchy

Implemented by

Index

Methods

abort

  • abort(): Promise<void>

commit

  • commit(): Promise<any>

counter

fatCounter

flag_dw

flag_ew

gmap

multiValueRegister

readBatch

  • Takes an array of objects and reads the value of all objects in one batch operation. Returns a promise to an array of values in the same order.

    Hint: To read a single object, use the read method on that object.

    Parameters

    Returns Promise<any[]>

readObjectsBatch

  • readObjectsBatch<T>(objects: object): Promise<object>
  • Reads several objects at once. The objects are stored in an object. Returns a new object with the read values stored under the same field in the object.

        let objA = connection.counter("batch-object-read counter a")
        let objB = connection.register<string>("batch-object-read register b")
    
        let vals = await connection.readObjectsBatch({
            a: objA,
            b: objB
        });
        // could return: {a: 1, b: "hi"}
    

    Hint: To read a single object, use the read method on that object.

    Type parameters

    • T

    Parameters

    • objects: object

    Returns Promise<object>

register

rrmap

set

set_removeWins

  • set_removeWins<T>(key: string): CrdtSet<T>

update

  • update(updates: ApbUpdateOp[] | ApbUpdateOp): Promise<any>
  • Sends a single update operation or an array of update operations to Antidote. If an array of updates is given, all updates in the array are executed atomically.

    Parameters

    • updates: ApbUpdateOp[] | ApbUpdateOp

    Returns Promise<any>

Generated using TypeDoc