The 'Transaction Queue' class provides the ability to store and manage transaction tasks in a queue. Queues are used to perform transaction operations on a given collection of 'IArayCollection'.

Constructors

  • Creates a 'TransactionQueue' object.

    Parameters

    • collection: IArrayCollection

      Indicates the collection of arrays to be managed in the transaction queue. You must implement the 'IArayCollection' interface.

    Returns TransactionQueue

Properties

collection: IArrayCollection

The collection of targets that the transaction queue will work on.

queue: object[]

List of transactions stored in the queue.

Methods

  • Commit the transaction task stored in the current queue. All tasks stored in the commit queue are reflected in the actual collection.

    Returns void

    TransactionQueue.commit(); // Reflect all jobs stored in the queue to the collection
    
  • Delete the transaction task from the queue.

    Parameters

    • pos: number

      The location index within the queue to be deleted.

    • clone: object

      Replica of the job to be deleted.

    • etc: any

      Other relevant data, may contain additional information as needed.

    Returns void

    transactionQueue.delete(1, clusteredObject, additionalData); // Delete jobs at index 1 location
    
  • Initializes the transaction queue. Sets the state of the queue to its initial state.

    Returns void

    transactionQueue.init(); // Initialize the queue to leave it empty
    
  • Adds a new transaction task to the queue.

    Parameters

    • pos: number

      The index of the location in the queue to which you want to add the task.

    • target: object

      Destination object to be added to the queue.

    • etc: any

      Other relevant data, may contain additional information as needed.

    Returns void

    transactionQueue.insert(0, targetObject, additionalData); // Add action to index 0 location
    
  • Rolls back transaction operations stored in the current queue. All jobs saved in the rollback queue are canceled, and the collection is restored to its original state.

    Returns void

    transactionQueue.rollback(); // Cancel all operations stored in the queue and restore them to their original state
    
  • Inquires the history of changes in the queue.

    Returns object[]

    List of all transaction tasks currently stored in the queue.

    const changes = transactionQueue.select(); // View all changes in the queue
    
  • Modify the transaction task in the queue.

    Parameters

    • pos: number

      The index of locations in the queue to be modified.

    • target: object

      The object to be modified.

    • clone: object

      This is a replica of the pre-modification operation.

    • etc: any

      Other relevant data, may contain additional information as needed.

    Returns void

    transactionQueue.update(2, updatedObject, clonedObject, additionalData); // 인덱스 2 위치의 작업 수정