Type Alias IDatabaseReaderSemaphoreTransaction

IDatabaseReaderSemaphoreTransaction: {
    findSemaphore(
        context: IReadableContext,
        key: string,
    ): Promise<null | IReaderSemaphoreData>;
    findSlots(
        context: IReadableContext,
        key: string,
    ): Promise<IReaderSemaphoreSlotData[]>;
    removeAllSlots(
        context: IReadableContext,
        key: string,
    ): Promise<IReaderSemaphoreSlotExpirationData[]>;
    removeSlot(
        context: IReadableContext,
        key: string,
        slotId: string,
    ): Promise<null | IReaderSemaphoreSlotExpirationData>;
    updateExpiration(
        context: IReadableContext,
        key: string,
        slotId: string,
        expiration: Date,
    ): Promise<number>;
    upsertSemaphore(
        context: IReadableContext,
        key: string,
        limit: number,
    ): Promise<void>;
    upsertSlot(
        context: IReadableContext,
        key: string,
        lockId: string,
        expiration: null | Date,
    ): Promise<void>;
}

Transaction context for reader (shared) semaphore operations. Provides methods to manage reader slots within a database transaction.

Reader semaphores allow multiple concurrent readers (up to limit). Each reader occupies a "slot" identified by a unique slot ID.

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

Type declaration