Type Alias IDatabaseLockTransaction

IDatabaseLockTransaction: {
    find(context: IReadableContext, key: string): Promise<null | ILockData>;
    upsert(
        context: IReadableContext,
        key: string,
        lockId: string,
        expiration: null | Date,
    ): Promise<void>;
}

Transactional operations interface for lock state in database. Used within database transactions to ensure atomic lock updates and consistency.

IMPORT_PATH: "@daiso-tech/core/lock/contracts"

Type declaration

  • find:function
  • upsert:function
    • Creates a new lock record if it doesn't exist, or updates the existing one. Used to persist the current owner and expiration state of a lock.

      Parameters

      • context: IReadableContext

        Readable execution context for the operation

      • key: string

        Unique identifier for the lock

      • lockId: string

        The unique identifier of the lock owner

      • expiration: null | Date

        The date and time when the lock expires, or null for indefinite locks

      Returns Promise<void>

      Promise that resolves when the upsert operation completes