Libraries v5.0.0
    Preparing search index...

    Interface JobStorageTransaction

    Transactional storage primitives for adapter authors. Locked rows remain locked until atomic() commits. Reads/writes must be detached. Implementations must roll back every write on callback failure.

    interface JobStorageTransaction {
        appendEvent(event: JobEvent): Promise<void>;
        attempts(runId: string): Promise<JobAttempt[]>;
        cleanup(namespace: string, limit: number): Promise<number>;
        dueSchedules(namespace: string, limit: number): Promise<ScheduleRecord[]>;
        events(runId: string, after: number, limit: number): Promise<JobEvent[]>;
        health(namespace: string): Promise<JobRepositoryHealth>;
        insertRun(
            run: RunRecord,
        ): Promise<{ inserted: boolean; record: RunRecord }>;
        insertSchedule(schedule: ScheduleRecord): Promise<ScheduleRecord>;
        now(): Promise<number>;
        run(
            namespace: string,
            id: string,
            lock?: boolean,
        ): Promise<RunRecord | undefined>;
        runnable(
            namespace: string,
            supported: readonly SupportedJob[],
        ): Promise<RunRecord | undefined>;
        saveAttempt(attempt: JobAttempt): Promise<void>;
        saveRun(run: RunRecord): Promise<void>;
        saveSchedule(schedule: ScheduleRecord): Promise<void>;
        schedule(
            namespace: string,
            id: string,
        ): Promise<ScheduleRecord | undefined>;
        unfinishedScheduleRun(
            namespace: string,
            scheduleId: string,
        ): Promise<boolean>;
    }
    Index
    • Lock and remove expired terminal runs plus dependent events/attempts.

      Parameters

      • namespace: string
      • limit: number

      Returns Promise<number>

    • Current repository time, obtained after any blocking lock acquisition.

      Returns Promise<number>

    • Parameters

      • namespace: string
      • id: string
      • Optionallock: boolean

      Returns Promise<RunRecord | undefined>

    • Parameters

      • namespace: string
      • scheduleId: string

      Returns Promise<boolean>