FileStorage
Defined in: storage/file.ts:16
File-based storage implementation
Type Parameters
Section titled “Type Parameters”T extends QueueItem = QueueItem
Implements
Section titled “Implements”QueueStorage<T>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FileStorage<
T>(filePath):FileStorage<T>
Defined in: storage/file.ts:17
Parameters
Section titled “Parameters”filePath
Section titled “filePath”string
Returns
Section titled “Returns”FileStorage<T>
Methods
Section titled “Methods”acquireLock()
Section titled “acquireLock()”acquireLock(
holder,ttlMs):Promise<boolean>
Defined in: storage/file.ts:44
Acquire a distributed lock
Parameters
Section titled “Parameters”holder
Section titled “holder”string
Identifier for the lock holder
number
Time-to-live in milliseconds
Returns
Section titled “Returns”Promise<boolean>
true if lock acquired, false if already locked
Implementation of
Section titled “Implementation of”getLock()
Section titled “getLock()”getLock():
Promise<QueueLock|null>
Defined in: storage/file.ts:79
Get the current lock info
Returns
Section titled “Returns”Promise<QueueLock | null>
Implementation of
Section titled “Implementation of”isLocked()
Section titled “isLocked()”isLocked():
Promise<boolean>
Defined in: storage/file.ts:73
Check if a lock is currently held
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”read()
Section titled “read()”read():
Promise<QueueState<T>>
Defined in: storage/file.ts:19
Read the current queue state
Returns
Section titled “Returns”Promise<QueueState<T>>
Implementation of
Section titled “Implementation of”releaseLock()
Section titled “releaseLock()”releaseLock(
holder):Promise<void>
Defined in: storage/file.ts:64
Release a distributed lock
Parameters
Section titled “Parameters”holder
Section titled “holder”string
Must match the holder that acquired the lock
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”write()
Section titled “write()”write(
state):Promise<void>
Defined in: storage/file.ts:32
Write the queue state
Parameters
Section titled “Parameters”QueueState<T>
Returns
Section titled “Returns”Promise<void>