@keetanetwork/anchor 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/certificates.d.ts.map +1 -1
- package/lib/certificates.js +73 -0
- package/lib/certificates.js.map +1 -1
- package/lib/http-server-shared.d.ts +14 -0
- package/lib/http-server-shared.d.ts.map +1 -0
- package/lib/http-server-shared.js +108 -0
- package/lib/http-server-shared.js.map +1 -0
- package/lib/http-server.d.ts +62 -0
- package/lib/http-server.d.ts.map +1 -0
- package/lib/http-server.js +431 -0
- package/lib/http-server.js.map +1 -0
- package/lib/log/common.d.ts +35 -0
- package/lib/log/common.d.ts.map +1 -0
- package/lib/log/common.js +19 -0
- package/lib/log/common.js.map +1 -0
- package/lib/queue/common.d.ts +23 -0
- package/lib/queue/common.d.ts.map +1 -0
- package/lib/queue/common.js +47 -0
- package/lib/queue/common.js.map +1 -0
- package/lib/queue/drivers/queue_file.d.ts +17 -0
- package/lib/queue/drivers/queue_file.d.ts.map +1 -0
- package/lib/queue/drivers/queue_file.js +100 -0
- package/lib/queue/drivers/queue_file.js.map +1 -0
- package/lib/queue/drivers/queue_sqlite3.d.ts +28 -0
- package/lib/queue/drivers/queue_sqlite3.d.ts.map +1 -0
- package/lib/queue/drivers/queue_sqlite3.js +379 -0
- package/lib/queue/drivers/queue_sqlite3.js.map +1 -0
- package/lib/queue/index.d.ts +341 -0
- package/lib/queue/index.d.ts.map +1 -0
- package/lib/queue/index.js +940 -0
- package/lib/queue/index.js.map +1 -0
- package/lib/queue/internal.d.ts +8 -0
- package/lib/queue/internal.d.ts.map +1 -0
- package/lib/queue/internal.js +28 -0
- package/lib/queue/internal.js.map +1 -0
- package/lib/queue/pipeline.d.ts +149 -0
- package/lib/queue/pipeline.d.ts.map +1 -0
- package/lib/queue/pipeline.js +296 -0
- package/lib/queue/pipeline.js.map +1 -0
- package/lib/utils/asleep.d.ts +2 -0
- package/lib/utils/asleep.d.ts.map +1 -0
- package/lib/utils/asleep.js +3 -0
- package/lib/utils/asleep.js.map +1 -0
- package/lib/utils/defer.d.ts +3 -0
- package/lib/utils/defer.d.ts.map +1 -0
- package/lib/utils/defer.js +3 -0
- package/lib/utils/defer.js.map +1 -0
- package/npm-shrinkwrap.json +37 -1375
- package/package.json +1 -1
- package/services/asset-movement/common.d.ts +26 -5
- package/services/asset-movement/common.d.ts.map +1 -1
- package/services/asset-movement/common.js +136 -3
- package/services/asset-movement/common.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/queue/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAkLzD;;GAEG;AACH,MAAM,OAAO,mCAAmC;IACrC,YAAY,GAAoE,EAAE,CAAC;IAC1E,MAAM,CAAsB;IACrC,gBAAgB,GAAG,CAAC,CAAC;IACvB,SAAS,GAAG,KAAK,CAAC;IACjB,IAAI,GAAW,qCAAqC,CAAC;IACrD,EAAE,CAAS;IACX,IAAI,GAAa,EAAE,CAAC;IAE7B,YAAY,OAAwC;QACnD,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,4CA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M,CAAC,gBAAgB,CAAC;QACjD,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { BrandedString, Brand } from '../utils/brand.ts';\nimport type { Logger } from '../log/index.ts';\nimport type { JSONSerializable } from '../utils/json.ts';\nimport type { AssertNever } from '../utils/never.ts';\nimport { asleep } from '../utils/asleep.js';\nimport { Errors } from './common.js';\nimport { MethodLogger } from './internal.js';\nimport { AsyncDisposableStack } from '../utils/defer.js';\n\nexport type KeetaAnchorQueueRequest<REQUEST> = REQUEST;\nexport type KeetaAnchorQueueRequestID = BrandedString<'KeetaAnchorQueueID'>;\nexport type KeetaAnchorQueueWorkerID = Brand<number, 'KeetaAnchorQueueWorkerID'>;\n\nexport type KeetaAnchorQueueStatus = 'pending' | 'processing' | 'completed' | 'failed_temporarily' | 'failed_permanently' | 'stuck' | 'aborted' | 'moved' | '@internal';\nexport type KeetaAnchorQueueEntry<REQUEST, RESPONSE> = {\n\t/**\n\t * The Job ID\n\t */\n\tid: KeetaAnchorQueueRequestID;\n\t/**\n\t * Idempotent IDs from a previous stage\n\t */\n\tidempotentKeys?: Set<KeetaAnchorQueueRequestID> | undefined;\n\trequest: KeetaAnchorQueueRequest<REQUEST>;\n\toutput: RESPONSE | null;\n\tlastError: string | null;\n\tstatus: KeetaAnchorQueueStatus;\n\tcreated: Date;\n\tupdated: Date;\n\tworker: KeetaAnchorQueueWorkerID | null;\n\tfailures: number;\n};\n\n/**\n * Extra information to provide to a request when adding an entry to the queue\n */\nexport type KeetaAnchorQueueEntryExtra = {\n\t[key in 'idempotentKeys' | 'id' | 'status']?: KeetaAnchorQueueEntry<never, never>[key] | undefined;\n};\n\nexport type KeetaAnchorQueueFilter = {\n\t/**\n\t * Only return entries with this status\n\t */\n\tstatus?: KeetaAnchorQueueStatus;\n\t/**\n\t * Only return entries last updated before this date\n\t */\n\tupdatedBefore?: Date;\n\t/**\n\t * Limit the number of entries returned\n\t */\n\tlimit?: number;\n};\n\nexport type KeetaAnchorQueueCommonOptions = {\n\tlogger?: Logger | undefined;\n\tid?: string | undefined;\n};\n\nexport type KeetaAnchorQueueRunnerOptions = KeetaAnchorQueueCommonOptions & {\n\t/**\n\t * If specified, then multiple workers can be used to process this queue\n\t * in parallel by splitting the work among the workers.\n\t *\n\t * By default, only a single worker will process the queue (count=1, id=0)\n\t */\n\tworkers?: {\n\t\tcount: number;\n\t\tid: number;\n\t} | undefined;\n};\n\nexport type KeetaAnchorQueueStorageOptions = KeetaAnchorQueueCommonOptions & {\n\tpath?: string[] | undefined;\n};\n\nexport type KeetaAnchorQueueEntryAncillaryData<RESPONSE> = {\n\t/**\n\t * The previous status of the entry -- if the entry is not currently in this status,\n\t * the status update will fail\n\t */\n\toldStatus?: KeetaAnchorQueueStatus | undefined;\n\t/**\n\t * The worker ID performing the status update\n\t */\n\tby?: KeetaAnchorQueueWorkerID | undefined;\n\t/**\n\t * The output data to store with the entry\n\t */\n\toutput?: RESPONSE | null | undefined;\n\t/**\n\t * An error message to store with the entry\n\t */\n\terror?: string | undefined;\n};\n\nexport type KeetaAnchorQueueStorageDriverConstructor<REQUEST extends JSONSerializable, RESPONSE extends JSONSerializable> = new(options?: KeetaAnchorQueueStorageOptions) => KeetaAnchorQueueStorageDriver<REQUEST, RESPONSE>;\n\nexport interface KeetaAnchorQueueStorageDriver<REQUEST extends JSONSerializable, RESPONSE extends JSONSerializable> {\n\t/**\n\t * An ID for this instance of the storage driver\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The name of the storage driver\n\t */\n\treadonly name: string;\n\n\t/**\n\t * The partition ID for this instance of the storage driver\n\t *\n\t * This is used to divide a single storage backend into multiple\n\t * independent queues.\n\t *\n\t * The root partition is an empty array, and each element is\n\t * a hierarchical partition name.\n\t */\n\treadonly path: string[];\n\n\t/**\n\t * Enqueue an item to be processed by the queue\n\t *\n\t * It will be inserted into the queue as a 'pending' entry\n\t *\n\t * @param request The request to enqueue\n\t * @param id Optional ID to use for the entry -- if not provided, a new\n\t * ID will be generated. If the ID is already in use then\n\t * nothing will be added.\n\t * @returns The ID for the newly created pending entry\n\t */\n\tadd: (request: KeetaAnchorQueueRequest<REQUEST>, info?: KeetaAnchorQueueEntryExtra) => Promise<KeetaAnchorQueueRequestID>;\n\n\t/**\n\t * Update the status of an entry in the queue\n\t *\n\t * If the status is \"failed_temporarily\", the failure count will be incremented\n\t *\n\t * @param id The entry ID to update\n\t * @param status The new status of the entry\n\t * @param ancillary Optional ancillary data for the status update\n\t * @returns void\n\t */\n\tsetStatus: (id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<RESPONSE>) => Promise<void>;\n\n\t/**\n\t * Get entries from storage with an optional filter\n\t *\n\t * @param filter The filter to apply (optional)\n\t * @returns An array of entries matching the criteria\n\t */\n\tquery(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<REQUEST, RESPONSE>[]>;\n\n\t/**\n\t * Get a single entry from storage by ID\n\t *\n\t * @param id The ID of the entry to retrieve\n\t * @returns The entry if found, or null if not found\n\t */\n\tget(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<REQUEST, RESPONSE> | null>;\n\n\t/**\n\t * Perform maintenance tasks on the storage driver\n\t * (e.g. cleaning up old entries, etc)\n\t *\n\t * @returns void\n\t */\n\tmaintain?: () => Promise<void>;\n\n\t/**\n\t * Create a partitioned view of the queue\n\t *\n\t * @param partitionID The partition ID to use\n\t * @returns A new storage driver instance for the partition\n\t */\n\tpartition: (path: string) => Promise<KeetaAnchorQueueStorageDriver<REQUEST, RESPONSE>>;\n\n\t/**\n\t * Close the storage driver and release any resources\n\t */\n\tdestroy(): Promise<void>;\n\t[Symbol.asyncDispose](): Promise<void>;\n}\n\n/**\n * An in-memory implementation of the KeetaAnchorQueueStorageDriver\n */\nexport class KeetaAnchorQueueStorageDriverMemory<REQUEST extends JSONSerializable = JSONSerializable, RESPONSE extends JSONSerializable = JSONSerializable> implements KeetaAnchorQueueStorageDriver<REQUEST, RESPONSE> {\n\tprotected queueStorage: { [path: string]: KeetaAnchorQueueEntry<REQUEST, RESPONSE>[]; } = {};\n\tprotected readonly logger?: Logger | undefined;\n\tprotected partitionCounter = 0;\n\tprivate destroyed = false;\n\treadonly name: string = 'KeetaAnchorQueueStorageDriverMemory';\n\treadonly id: string;\n\treadonly path: string[] = [];\n\n\tconstructor(options?: KeetaAnchorQueueStorageOptions) {\n\t\tthis.id = options?.id ?? crypto.randomUUID();\n\t\tthis.logger = options?.logger;\n\t\tthis.path.push(...(options?.path ?? []));\n\t\tObject.freeze(this.path);\n\n\t\tthis.methodLogger('new')?.debug('Created new in-memory queue storage driver');\n\t}\n\n\tprotected clone(options?: Partial<KeetaAnchorQueueStorageOptions>): KeetaAnchorQueueStorageDriver<REQUEST, RESPONSE> {\n\t\tconst cloned = new KeetaAnchorQueueStorageDriverMemory<REQUEST, RESPONSE>({\n\t\t\tlogger: this.logger,\n\t\t\tid: `${this.id}::${this.partitionCounter++}`,\n\t\t\tpath: [...this.path],\n\t\t\t...options\n\t\t});\n\t\tcloned.queueStorage = this.queueStorage;\n\n\t\treturn(cloned);\n\t}\n\n\tprotected get queue(): KeetaAnchorQueueEntry<REQUEST, RESPONSE>[] {\n\t\tconst pathKey = ['root', ...this.path].join('.')\n\t\tlet retval = this.queueStorage[pathKey];\n\t\tif (retval === undefined) {\n\t\t\tretval = this.queueStorage[pathKey] = [];\n\t\t}\n\t\treturn(retval);\n\t}\n\n\tprotected methodLogger(method: string): Logger | undefined {\n\t\treturn(MethodLogger(this.logger, {\n\t\t\tclass: 'KeetaAnchorQueueStorageDriverMemory',\n\t\t\tfile: 'src/lib/queue/index.ts',\n\t\t\tmethod: method,\n\t\t\tinstanceID: this.id\n\t\t}));\n\t}\n\n\tprivate checkDestroyed(): void {\n\t\tif (this.destroyed) {\n\t\t\tthrow(new Error('Queue has been destroyed'));\n\t\t}\n\t}\n\n\tasync add(request: KeetaAnchorQueueRequest<REQUEST>, info?: KeetaAnchorQueueEntryExtra): Promise<KeetaAnchorQueueRequestID> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('add');\n\n\t\tlet id = info?.id;\n\t\tif (id) {\n\t\t\tconst duplicateID = this.queue.some(function(checkEntry) {\n\t\t\t\treturn(checkEntry.id === id);\n\t\t\t});\n\n\t\t\tif (duplicateID) {\n\t\t\t\tlogger?.debug(`Request with id ${String(id)} already exists, ignoring`);\n\n\t\t\t\treturn(id);\n\t\t\t}\n\t\t}\n\n\t\tconst idempotentIDs = info?.idempotentKeys;\n\t\tif (idempotentIDs) {\n\t\t\tconst matchingIdempotentEntries = new Set<KeetaAnchorQueueRequestID>();\n\t\t\tfor (const idempotentID of idempotentIDs) {\n\t\t\t\tconst idempotentEntryExists = this.queue.some(function(checkEntry) {\n\t\t\t\t\treturn(checkEntry.idempotentKeys?.has(idempotentID) ?? false);\n\t\t\t\t});\n\n\t\t\t\tif (idempotentEntryExists) {\n\t\t\t\t\tmatchingIdempotentEntries.add(idempotentID);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (matchingIdempotentEntries.size !== 0) {\n\t\t\t\tthrow(new Errors.IdempotentExistsError('One or more idempotent entries already exist in the queue', matchingIdempotentEntries));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * The status to use for the new entry\n\t\t */\n\t\tconst status = info?.status ?? 'pending';\n\n\t\t/*\n\t\t * The ID is a branded string, so we must cast the generated UUID\n\t\t */\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tid ??= crypto.randomUUID() as unknown as KeetaAnchorQueueRequestID;\n\n\t\tlogger?.debug(`Enqueuing request with id ${String(id)}`);\n\n\t\tthis.queue.push({\n\t\t\tid: id,\n\t\t\trequest: request,\n\t\t\toutput: null,\n\t\t\tlastError: null,\n\t\t\tstatus: status,\n\t\t\tfailures: 0,\n\t\t\tcreated: new Date(),\n\t\t\tupdated: new Date(),\n\t\t\tworker: null,\n\t\t\tidempotentKeys: idempotentIDs ? new Set(idempotentIDs) : undefined\n\t\t});\n\n\t\treturn(id);\n\t}\n\n\tasync setStatus(id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<RESPONSE>): Promise<void> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('setStatus');\n\n\t\tconst { oldStatus, by, output } = ancillary ?? {};\n\n\t\tconst entry = this.queue.find(function(checkEntry) {\n\t\t\treturn(checkEntry.id === id);\n\t\t});\n\t\tif (!entry) {\n\t\t\tthrow(new Error(`Request with ID ${String(id)} not found`));\n\t\t}\n\n\t\tif (oldStatus && entry.status !== oldStatus) {\n\t\t\tthrow(new Errors.IncorrectStateAssertedError(id, oldStatus, entry.status));\n\t\t}\n\n\t\tlogger?.debug(`Setting request with id ${String(id)} status from \"${entry.status}\" to \"${status}\"`);\n\n\t\t/* XXX -- this needs to be replicated in every driver -- is there a better way ? */\n\t\tif (status === 'failed_temporarily') {\n\t\t\tentry.failures += 1;\n\t\t\tlogger?.debug(`Incrementing failure count for request with id ${String(id)} to ${entry.failures}`);\n\t\t}\n\n\t\tif (status === 'pending' || status === 'completed') {\n\t\t\tlogger?.debug(`Clearing last error for request with id ${String(id)}`);\n\t\t\tentry.lastError = null;\n\t\t}\n\t\t/* END OF XXX */\n\n\t\tif (ancillary?.error) {\n\t\t\tentry.lastError = ancillary.error;\n\t\t\tlogger?.debug(`Setting last error for request with id ${String(id)} to:`, ancillary.error);\n\t\t}\n\n\t\tentry.status = status;\n\t\tentry.updated = new Date();\n\t\tentry.worker = by ?? null;\n\n\t\tif (output !== undefined) {\n\t\t\tlogger?.debug(`Setting output for request with id ${String(id)}:`, output);\n\n\t\t\tentry.output = output;\n\t\t}\n\t}\n\n\tasync get(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<REQUEST, RESPONSE> | null> {\n\t\tthis.checkDestroyed();\n\n\t\tconst entry = this.queue.find(function(checkEntry) {\n\t\t\treturn(checkEntry.id === id);\n\t\t});\n\n\t\tif (!entry) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(structuredClone(entry));\n\t}\n\n\tasync query(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<REQUEST, RESPONSE>[]> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('query');\n\n\t\tconst queueDuplicate = structuredClone(this.queue);\n\n\t\tlogger?.debug(`Querying queue with id ${this.id} with filter:`, filter);\n\n\t\tconst allEntriesInStatus = (function() {\n\t\t\tconst filterStatus = filter?.status;\n\t\t\tconst filterLastUpdateBefore = filter?.updatedBefore;\n\t\t\tif (filterStatus || filterLastUpdateBefore) {\n\t\t\t\treturn(queueDuplicate.filter(function(entry) {\n\t\t\t\t\tif (filterStatus) {\n\t\t\t\t\t\tif (entry.status !== filterStatus) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (filterLastUpdateBefore) {\n\t\t\t\t\t\tif (entry.updated >= filterLastUpdateBefore) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn(true);\n\t\t\t\t}));\n\t\t\t} else {\n\t\t\t\treturn(queueDuplicate);\n\t\t\t}\n\t\t})();\n\n\t\tlet retval = allEntriesInStatus;\n\t\tif (filter?.limit !== undefined) {\n\t\t\tretval = allEntriesInStatus.slice(0, filter.limit);\n\t\t}\n\n\t\tlogger?.debug(`Queried queue with id ${this.id} with filter:`, filter, '-- found', retval.length, 'entries');\n\n\t\treturn(retval);\n\t}\n\n\tasync partition(path: string): Promise<KeetaAnchorQueueStorageDriver<REQUEST, RESPONSE>> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('partition');\n\n\t\tlogger?.debug(`Creating partitioned queue storage driver for path \"${path}\"`);\n\n\t\tconst partitioned = this.clone({\n\t\t\tpath: [...this.path, path]\n\t\t});\n\n\t\treturn(partitioned);\n\t}\n\n\tasync destroy(): Promise<void> {\n\t\tthis.destroyed = true;\n\t\tthis.methodLogger('destroy')?.debug('Destroying in-memory queue');\n\t}\n\n\tasync [Symbol.asyncDispose](): Promise<void> {\n\t\treturn(await this.destroy());\n\t}\n}\n\n/**\n * A Queue Runner and Request Translator for processing entries in a queue\n *\n * The queue runner is responsible for pulling entries from the queue,\n * processing them, and updating their status in the queue. As well\n * as moving jobs between queues by piping the output of one runner\n * to another. Additionally, maintenance tasks such as re-queuing\n * failed jobs and marking stuck jobs are also handled by the runner.\n *\n * This is an abstract base class that must be extended to provide\n * the actual processing logic as well as the encoding and decoding\n * for requests and responses.\n */\nexport abstract class KeetaAnchorQueueRunner<UREQUEST = unknown, URESPONSE = unknown, REQUEST extends JSONSerializable = JSONSerializable, RESPONSE extends JSONSerializable = JSONSerializable> {\n\t/**\n\t * The queue this runner is responsible for running\n\t */\n\tprivate readonly queue: KeetaAnchorQueueStorageDriver<REQUEST, RESPONSE>;\n\t/**\n\t * The logger we should use for logging anything\n\t */\n\tprivate readonly logger?: Logger | undefined;\n\t/**\n\t * The processor function to use for processing entries\n\t */\n\tprotected abstract processor(entry: KeetaAnchorQueueEntry<UREQUEST, URESPONSE>): Promise<{ status: KeetaAnchorQueueStatus; output: URESPONSE | null; error?: string | undefined; }>;\n\n\t/**\n\t * The processor for stuck jobs (optional)\n\t */\n\tprotected processorStuck?(entry: KeetaAnchorQueueEntry<UREQUEST, URESPONSE>): Promise<{ status: KeetaAnchorQueueStatus; output: URESPONSE | null; error?: string | undefined; }>;\n\n\t/**\n\t * The processor for aborted jobs (optional)\n\t */\n\tprotected processorAborted?(entry: KeetaAnchorQueueEntry<UREQUEST, URESPONSE>): Promise<{ status: KeetaAnchorQueueStatus; output: URESPONSE | null; error?: string | undefined; }>;\n\n\t/**\n\t * Worker configuration (not implemented)\n\t */\n\tprivate readonly workers: NonNullable<KeetaAnchorQueueRunnerOptions['workers']>;\n\tprivate readonly workerID: KeetaAnchorQueueWorkerID;\n\n\t/**\n\t * Pipes to other runners we have registered\n\t */\n\tprivate readonly pipes: ({\n\t\tisBatchPipe: false;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\ttarget: KeetaAnchorQueueRunner<URESPONSE, any, RESPONSE, any>\n\t} | {\n\t\tisBatchPipe: true;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\ttarget: KeetaAnchorQueueRunner<URESPONSE[], any, JSONSerializable, any>;\n\t\tminBatchSize: number;\n\t\tmaxBatchSize: number;\n\t})[] = [];\n\n\t/**\n\t * Initialization promise\n\t */\n\tprivate initializePromise: Promise<void> | undefined;\n\n\t/**\n\t * Configuration for this queue\n\t */\n\tprivate maxRetries = 5;\n\tprivate processTimeout = 300_000; /* 5 minutes */\n\tprivate batchSize = 100;\n\n\t/**\n\t * How many runners can process this queue in parallel\n\t */\n\tprotected maxRunners?: number;\n\tprivate runnerLockKey: KeetaAnchorQueueRequestID;\n\n\t/**\n\t * The ID of this runner for diagnostic purposes\n\t */\n\treadonly id: string;\n\n\tconstructor(config: { queue: KeetaAnchorQueueStorageDriver<REQUEST, RESPONSE>; } & KeetaAnchorQueueRunnerOptions) {\n\t\tthis.queue = config.queue;\n\t\tthis.logger = config.logger;\n\t\tthis.workers = config.workers ?? {\n\t\t\tcount: 1,\n\t\t\tid: 0\n\t\t};\n\n\t\tif (this.workers.id < 0) {\n\t\t\tthrow(new Error('Worker ID cannot be negative'));\n\t\t}\n\n\t\tif (this.maxRunners) {\n\t\t\tif (this.workers.id > this.maxRunners - 1 || this.workers.count > this.maxRunners) {\n\t\t\t\tthrow(new Error('Worker ID other than 0 or worker count other than 1 is not supported yet'));\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * The worker ID is just a branded version of the worker number\n\t\t */\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthis.workerID = this.workers.id as KeetaAnchorQueueWorkerID;\n\n\t\t/*\n\t\t * The runner lock key, a unique key used to ensure only\n\t\t * one instance of a given runner is running at a time\n\t\t */\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthis.runnerLockKey = `@runner-lock:9ba756f0-7aa2-41c7-a1ea-b010dc752ae8.worker.${this.workerID}` as unknown as KeetaAnchorQueueRequestID;\n\n\t\t/**\n\t\t * Instance ID\n\t\t */\n\t\tthis.id = config.id ?? crypto.randomUUID();\n\n\t\tthis.methodLogger('new')?.debug('Created new queue runner attached to queue', this.queue.id);\n\t}\n\n\tprivate async initialize(): Promise<void> {\n\t\tif (this.initializePromise) {\n\t\t\treturn(await this.initializePromise);\n\t\t}\n\n\t\t/* Ensure the sequential lock entry exists */\n\t\tthis.initializePromise = (async () => {\n\t\t\t/*\n\t\t\t * We store `null` as the request value because we\n\t\t\t * don't have anything better to store -- it's not\n\t\t\t * always going to be compatible with the type\n\t\t\t * REQUEST but we know that we will never actually\n\t\t\t * use the value.\n\t\t\t */\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tawait this.queue.add(null as unknown as REQUEST, {\n\t\t\t\tid: this.runnerLockKey,\n\t\t\t\tstatus: '@internal'\n\t\t\t});\n\t\t})();\n\n\t\treturn(await this.initializePromise);\n\t}\n\n\tprivate methodLogger(method: string): Logger | undefined {\n\t\treturn(MethodLogger(this.logger, {\n\t\t\tclass: 'KeetaAnchorQueueRunner',\n\t\t\tfile: 'src/lib/queue/index.ts',\n\t\t\tmethod: method,\n\t\t\tinstanceID: this.id\n\t\t}));\n\t}\n\n\t/** @internal */\n\t_Testing(key: string): {\n\t\tsetParams: (maxBatchSize: number, processTimeout: number, maxRetries: number, maxWorkers?: number) => void;\n\t\tqueue: () => KeetaAnchorQueueStorageDriver<REQUEST, RESPONSE>;\n\t\tmarkWorkerAsProcessing: () => Promise<void>;\n\t} {\n\t\tif (key !== 'bc81abf8-e43b-490b-b486-744fb49a5082') {\n\t\t\tthrow(new Error('This is a testing only method'));\n\t\t}\n\n\t\treturn({\n\t\t\tsetParams: (maxBatchSize: number, processTimeout: number, maxRetries: number, maxWorkers?: number) => {\n\t\t\t\tthis.batchSize = maxBatchSize;\n\t\t\t\tthis.processTimeout = processTimeout;\n\t\t\t\tthis.maxRetries = maxRetries;\n\t\t\t\tif (maxWorkers !== undefined) {\n\t\t\t\t\tthis.maxRunners = maxWorkers;\n\t\t\t\t}\n\t\t\t},\n\t\t\tqueue: () => {\n\t\t\t\treturn(this.queue);\n\t\t\t},\n\t\t\tmarkWorkerAsProcessing: async () => {\n\t\t\t\tawait this.queue.setStatus(this.runnerLockKey, 'processing', {\n\t\t\t\t\toldStatus: '@internal',\n\t\t\t\t\tby: this.workerID\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected abstract decodeRequest(request: REQUEST): UREQUEST;\n\tprotected abstract decodeResponse(response: RESPONSE | null): URESPONSE | null;\n\n\tprotected abstract encodeRequest(request: UREQUEST): REQUEST;\n\tprotected abstract encodeResponse(response: URESPONSE | null): RESPONSE | null;\n\n\tprotected decodeEntry(entry: KeetaAnchorQueueEntry<REQUEST, RESPONSE>): KeetaAnchorQueueEntry<UREQUEST, URESPONSE> {\n\t\treturn({\n\t\t\t...entry,\n\t\t\trequest: this.decodeRequest(entry.request),\n\t\t\toutput: this.decodeResponse(entry.output)\n\t\t});\n\t}\n\n\t/**\n\t * Enqueue an item to be processed by the queue\n\t */\n\tasync add(request: UREQUEST, info?: KeetaAnchorQueueEntryExtra): Promise<KeetaAnchorQueueRequestID> {\n\t\tawait this.initialize();\n\n\t\tconst encodedRequest = this.encodeRequest(request);\n\t\tconst newID = await this.queue.add(encodedRequest, info);\n\t\treturn(newID);\n\t}\n\n\t/**\n\t * Get a single entry from storage by ID\n\t */\n\tasync get(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<UREQUEST, URESPONSE> | null> {\n\t\tawait this.initialize();\n\n\t\tconst entry = await this.queue.get(id);\n\t\tif (!entry) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(this.decodeEntry(entry));\n\t}\n\n\t/**\n\t * Get entries from storage with an optional filter\n\t */\n\tasync query(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<UREQUEST, URESPONSE>[]> {\n\t\tawait this.initialize();\n\n\t\tconst entries = await this.queue.query(filter);\n\t\treturn(entries.map((entry) => {\n\t\t\treturn(this.decodeEntry(entry));\n\t\t}));\n\t}\n\n\t/**\n\t * Set the status of an entry in the queue\n\t */\n\tasync setStatus(id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<URESPONSE>): Promise<void> {\n\t\tawait this.initialize();\n\n\t\tlet encodedOutput: RESPONSE | null | undefined = undefined;\n\t\tif (ancillary?.output !== undefined) {\n\t\t\tencodedOutput = this.encodeResponse(ancillary.output);\n\t\t}\n\n\t\treturn(await this.queue.setStatus(id, status, {\n\t\t\t...ancillary,\n\t\t\toutput: encodedOutput\n\t\t}));\n\t}\n\n\t/**\n\t * Checks to see if the queue is runnable\n\t */\n\tasync runnable(): Promise<boolean> {\n\t\tawait this.initialize();\n\n\t\tconst pendingEntries = await this.queue.query({ status: 'pending', limit: 1 });\n\t\tif (pendingEntries.length > 0) {\n\t\t\treturn(true);\n\t\t}\n\n\t\tfor (const pipe of this.pipes) {\n\t\t\tconst pipeRunnable = await pipe.target.runnable();\n\t\t\tif (pipeRunnable) {\n\t\t\t\treturn(true);\n\t\t\t}\n\t\t}\n\n\t\treturn(false);\n\t}\n\n\tprivate async getRunnerLock(cleanup: AsyncDisposableStack): Promise<boolean> {\n\t\tconst logger = this.methodLogger('getRunnerLock');\n\n\t\ttry {\n\t\t\tlogger?.debug('Acquiring sequential processing lock for worker ID', this.workerID);\n\t\t\tawait this.queue.setStatus(this.runnerLockKey, 'processing', {\n\t\t\t\toldStatus: '@internal',\n\t\t\t\tby: this.workerID\n\t\t\t});\n\t\t\tlogger?.debug('Acquired sequential processing lock for worker ID', this.workerID);\n\t\t} catch (error: unknown) {\n\t\t\tif (Errors.IncorrectStateAssertedError.isInstance(error)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\n\t\t\tthrow(error);\n\t\t}\n\n\t\tcleanup.defer(async () => {\n\t\t\tfor (let retry = 0; retry < 10; retry++) {\n\t\t\t\tlogger?.debug(`Releasing sequential processing lock try #${retry + 1} for worker ID`, this.workerID);\n\t\t\t\ttry {\n\t\t\t\t\tawait this.queue.setStatus(this.runnerLockKey, '@internal', {\n\t\t\t\t\t\toldStatus: 'processing',\n\t\t\t\t\t\tby: undefined\n\t\t\t\t\t});\n\t\t\t\t} catch {\n\t\t\t\t\tawait asleep(1000);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\n\t\treturn(true);\n\t}\n\n\tprivate async maintainRunnerLock(): Promise<void> {\n\t\tconst logger = this.methodLogger('maintainRunnerLock');\n\t\tconst moment = new Date();\n\t\tawait using cleanup = new AsyncDisposableStack();\n\n\t\tconst obtained = await this.getRunnerLock(cleanup);\n\t\tif (obtained) {\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * Check to see if the lock is stale\n\t\t */\n\t\tconst lockEntry = await this.queue.get(this.runnerLockKey);\n\n\t\tif (!lockEntry) {\n\t\t\treturn;\n\t\t}\n\t\tconst lockAge = moment.getTime() - lockEntry.updated.getTime();\n\t\tif (lockAge > this.processTimeout * 10) {\n\t\t\tlogger?.warn('Processing lock is stale, taking over lock for worker ID', this.workerID);\n\n\t\t\tawait this.queue.setStatus(this.runnerLockKey, '@internal', {\n\t\t\t\toldStatus: 'processing',\n\t\t\t\tby: this.workerID\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Run the queue processor\n\t *\n\t * Processes up to `batchSize` entries from the queue and returns\n\t * true if there may be more work to do, or false if the queue\n\t * is empty.\n\t *\n\t * @param timeout Optional timeout in milliseconds to limit the total\n\t * \t time spent processing entries\n\t */\n\tasync run(timeout?: number): Promise<boolean> {\n\t\tawait this.initialize();\n\n\t\tconst logger = this.methodLogger('run');\n\t\tconst batchSize = this.batchSize;\n\t\tconst processTimeout = this.processTimeout;\n\t\tawait using cleanup = new AsyncDisposableStack();\n\n\t\tlet retval = true;\n\n\t\tconst startTime = Date.now();\n\n\t\tconst locked = await this.getRunnerLock(cleanup);\n\t\tif (!locked) {\n\t\t\tlogger?.debug('Another worker is already processing the queue, skipping run');\n\n\t\t\treturn(true);\n\t\t}\n\n\t\tconst processJobOk = Symbol('processJobOk');\n\t\tconst processJobTimeout = Symbol('processJobTimeout');\n\n\t\tconst processJob = async (index: number, entry: KeetaAnchorQueueEntry<REQUEST, RESPONSE>, startingStatus: KeetaAnchorQueueStatus, processor: (entry: KeetaAnchorQueueEntry<UREQUEST, URESPONSE>) => Promise<{ status: KeetaAnchorQueueStatus; output: URESPONSE | null; error?: string | undefined; }>): Promise<typeof processJobTimeout | typeof processJobOk> => {\n\t\t\tif (timeout !== undefined) {\n\t\t\t\tconst elapsed = Date.now() - startTime;\n\t\t\t\tif (elapsed >= timeout) {\n\t\t\t\t\tlogger?.debug(`Timeout of ${timeout}ms reached after processing ${index} entries (${startingStatus} phase; elapsed ${elapsed}ms)`);\n\n\t\t\t\t\treturn(processJobTimeout);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet setEntryStatus: { status: KeetaAnchorQueueStatus; output: URESPONSE | null; error?: string | undefined; } = { status: 'failed_temporarily', output: null };\n\n\t\t\tlogger?.debug(`Processing entry request with id ${String(entry.id)}`);\n\n\t\t\ttry {\n\t\t\t\t/*\n\t\t\t\t * Get a lock by setting it to 'processing'\n\t\t\t\t */\n\t\t\t\tawait this.queue.setStatus(entry.id, 'processing', { oldStatus: startingStatus, by: this.workerID });\n\n\t\t\t\t/*\n\t\t\t\t * Process the entry with a timeout, if the timeout is reached\n\t\t\t\t * we should mark the process as aborted because we no longer\n\t\t\t\t * know what state the work is in and someone will need to\n\t\t\t\t * inspect the job and determine through some other means if\n\t\t\t\t * it is completed or failed.\n\t\t\t\t */\n\t\t\t\tlet timeoutTimer: ReturnType<typeof setTimeout> | null = null;\n\t\t\t\tsetEntryStatus = await Promise.race([\n\t\t\t\t\tnew Promise<{ status: 'aborted', output: null }>(function(resolve) {\n\t\t\t\t\t\ttimeoutTimer = setTimeout(function() {\n\t\t\t\t\t\t\tresolve({ status: 'aborted', output: null });\n\t\t\t\t\t\t}, processTimeout);\n\t\t\t\t\t}),\n\t\t\t\t\t(async () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn(await processor(this.decodeEntry(entry)));\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tif (timeoutTimer) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutTimer);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})()\n\t\t\t\t]);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tif (Errors.IncorrectStateAssertedError.isInstance(error)) {\n\t\t\t\t\tlogger?.info(`Skipping request with id ${String(entry.id)} because it is no longer in the expected state \"${startingStatus}\"`, error);\n\n\t\t\t\t\treturn(processJobOk);\n\t\t\t\t}\n\n\t\t\t\tlogger?.error(`Failed to process request with id ${String(entry.id)}, setting state to \"${setEntryStatus.status}\":`, error);\n\t\t\t\tsetEntryStatus.status = 'failed_temporarily';\n\t\t\t\tsetEntryStatus.error = String(error);\n\t\t\t}\n\n\t\t\tif (setEntryStatus.status === 'processing') {\n\t\t\t\tlogger?.error(`Processor for request with id ${String(entry.id)} returned invalid status \"processing\"`);\n\t\t\t\tsetEntryStatus.status = 'failed_temporarily';\n\t\t\t\tsetEntryStatus.error = 'Processor returned invalid status \"processing\"';\n\t\t\t}\n\n\t\t\tlet by: KeetaAnchorQueueWorkerID | undefined = this.workerID;\n\t\t\tif (setEntryStatus.status === 'pending') {\n\t\t\t\tby = undefined;\n\t\t\t}\n\n\t\t\tawait this.queue.setStatus(entry.id, setEntryStatus.status, { oldStatus: 'processing', by: by, output: this.encodeResponse(setEntryStatus.output), error: setEntryStatus.error });\n\n\t\t\treturn(processJobOk);\n\t\t};\n\n\t\t/*\n\t\t * Process pending jobs first\n\t\t */\n\t\tfor (let index = 0; index < batchSize; index++) {\n\t\t\tconst entries = await this.queue.query({ status: 'pending', limit: 1 });\n\t\t\tconst entry = entries[0];\n\t\t\tif (entry === undefined) {\n\t\t\t\tretval = false;\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst result = await processJob(index, entry, 'pending', this.processor.bind(this));\n\t\t\tif (result === processJobTimeout) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * Next process any pipes to other runners\n\t\t */\n\t\tconst pipes = [...this.pipes];\n\t\tfor (const pipe of pipes) {\n\t\t\tlet remainingTime: number | undefined = undefined;\n\t\t\tif (timeout !== undefined) {\n\t\t\t\tconst elapsed = Date.now() - startTime;\n\t\t\t\tremainingTime = timeout - elapsed;\n\t\t\t\tif (remainingTime <= 0) {\n\t\t\t\t\tremainingTime = -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst pipeHasMoreWork = await pipe.target.run(remainingTime);\n\t\t\tif (pipeHasMoreWork) {\n\t\t\t\tretval = true;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process stuck or aborted jobs (if possible)\n\t\t */\n\t\tconst conditions = [{\n\t\t\tstatus: 'aborted' as const,\n\t\t\tprocessor: this.processorAborted?.bind(this)\n\t\t}, {\n\t\t\tstatus: 'stuck' as const,\n\t\t\tprocessor: this.processorStuck?.bind(this)\n\t\t}];\n\n\t\tlet timeoutReached = false;\n\t\tfor (const condition of conditions) {\n\t\t\tif (condition.processor === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (let index = 0; index < batchSize; index++) {\n\t\t\t\tconst entries = await this.queue.query({ status: condition.status, limit: 1 });\n\t\t\t\tconst entry = entries[0];\n\t\t\t\tif (entry === undefined) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst result = await processJob(index, entry, condition.status, condition.processor);\n\t\t\t\tif (result === processJobTimeout) {\n\t\t\t\t\ttimeoutReached = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (timeoutReached) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn(retval);\n\t}\n\n\tprivate async markStuckRequestsAsStuck(): Promise<void> {\n\t\tconst stuckThreshold = this.processTimeout * 10;\n\n\t\tconst logger = this.methodLogger('markStuckRequestsAsStuck');\n\t\tconst now = Date.now();\n\n\t\tconst requests = await this.queue.query({ status: 'processing', limit: 100, updatedBefore: new Date(now - stuckThreshold) });\n\t\tfor (const request of requests) {\n\t\t\ttry {\n\t\t\t\tlogger?.warn(`Marking request with id ${String(request.id)} as stuck`);\n\n\t\t\t\tawait this.queue.setStatus(request.id, 'stuck', { oldStatus: 'processing', by: this.workerID });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.error(`Failed to mark request with id ${String(request.id)} as stuck:`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async requeueFailedRequests(): Promise<void> {\n\t\tconst retryDelay = this.processTimeout * 10;\n\t\tconst maxRetries = this.maxRetries;\n\n\t\tconst logger = this.methodLogger('requeueFailedRequests');\n\t\tconst now = Date.now();\n\n\t\tconst requests = await this.queue.query({ status: 'failed_temporarily', limit: 100, updatedBefore: new Date(now - retryDelay) });\n\t\tfor (const request of requests) {\n\t\t\ttry {\n\t\t\t\tif (request.failures >= maxRetries) {\n\t\t\t\t\tlogger?.info(`Request with id ${String(request.id)} has exceeded maximum retries, not requeuing -- moving to failed_permanently`);\n\t\t\t\t\tawait this.queue.setStatus(request.id, 'failed_permanently', { oldStatus: 'failed_temporarily', by: this.workerID });\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tlogger?.debug(`Requeuing failed request with id ${String(request.id)}`);\n\n\t\t\t\tawait this.queue.setStatus(request.id, 'pending', { oldStatus: 'failed_temporarily', by: this.workerID });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.error(`Failed to requeue request with id ${String(request.id)}:`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async moveCompletedToNextStage(): Promise<void> {\n\t\tconst logger = this.methodLogger('moveCompletedToNextStage');\n\n\t\tconst pipes = [...this.pipes];\n\t\tif (pipes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst allRequests = await this.queue.query({ status: 'completed', limit: 100 });\n\t\tlet requests = allRequests;\n\n\t\tconst RequestSentToPipes = new Map<KeetaAnchorQueueRequestID, number>();\n\t\tfunction IncrRequestSentToPipes(requestID: KeetaAnchorQueueRequestID): void {\n\t\t\tconst sentCount = RequestSentToPipes.get(requestID) ?? 0;\n\t\t\tRequestSentToPipes.set(requestID, sentCount + 1);\n\t\t}\n\n\n\t\tfor (const pipe of pipes) {\n\t\t\tlogger?.debug('Processing pipe to target', pipe.target.id, pipe.isBatchPipe ? '(batch pipe)' : '(single item pipe)');\n\n\t\t\tif (pipe.isBatchPipe) {\n\t\t\t\t/**\n\t\t\t\t * Keep track of all the requests we successfully\n\t\t\t\t * sent to the target stage\n\t\t\t\t */\n\t\t\t\tconst allTargetSeenRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * During each iteration of the batch processing, we keep track\n\t\t\t\t * of the IDs we have already seen by the target and processed\n\t\t\t\t * so we don't try to reprocess them again\n\t\t\t\t */\n\t\t\t\tconst iterationTargetSeenRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * If we get a batch that cannot be added to the target pipe,\n\t\t\t\t * we just skip over them for retrying at a later date\n\t\t\t\t */\n\t\t\t\tconst skipRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * Compute a durable ID for this batch and target\n\t\t\t\t */\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\tlet batchID = crypto.randomUUID() as unknown as KeetaAnchorQueueRequestID;\n\n\t\t\t\t/**\n\t\t\t\t * Keep track of sequential failures to find enough entries\n\t\t\t\t * and stop processing if we can't find enough after a few tries\n\t\t\t\t * in a row\n\t\t\t\t */\n\t\t\t\tlet sequentialFailureCount = 0;\n\n\t\t\t\tfor (;requests.length >= pipe.minBatchSize;\n\t\t\t\t\t/*\n\t\t\t\t\t * Remove any entries we have already seen during\n\t\t\t\t\t * the last iteration of the loop\n\t\t\t\t\t */\n\t\t\t\t\trequests = requests.filter(function(entry) {\n\t\t\t\t\t\treturn(!iterationTargetSeenRequestIDs.has(entry.id) && !skipRequestIDs.has(entry.id));\n\t\t\t\t\t})\n\t\t\t\t) {\n\t\t\t\t\titerationTargetSeenRequestIDs.clear();\n\n\t\t\t\t\tlogger?.debug(`Preparing to move completed requests to next stage ${pipe.target.id} (min=${pipe.minBatchSize}, max=${pipe.maxBatchSize}), have ${requests.length} completed requests available`);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Compute a batch of entries to send to the next stage,\n\t\t\t\t\t * constrained to the max batch size of the pipe and\n\t\t\t\t\t * the entries which have non-null outputs\n\t\t\t\t\t */\n\t\t\t\t\tconst batchRaw = requests.map((entry) => {\n\t\t\t\t\t\treturn({ output: this.decodeResponse(entry.output), id: entry.id });\n\t\t\t\t\t}).filter(function(entry): entry is { output: URESPONSE; id: KeetaAnchorQueueRequestID; } {\n\t\t\t\t\t\tif (entry === null) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn(true);\n\t\t\t\t\t}).slice(0, pipe.maxBatchSize);\n\n\t\t\t\t\t/*\n\t\t\t\t\t * If we don't have enough entries to meet the minimum\n\t\t\t\t\t * batch size, skip this iteration\n\t\t\t\t\t */\n\t\t\t\t\tif (batchRaw.length < pipe.minBatchSize) {\n\t\t\t\t\t\tsequentialFailureCount++;\n\t\t\t\t\t\tif (sequentialFailureCount >= 3) {\n\t\t\t\t\t\t\tlogger?.debug(`Not enough completed requests to move to next stage ${pipe.target.id}, stopping batch processing`);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlogger?.debug(`Not moving completed requests to next stage ${pipe.target.id} because batch size ${batchRaw.length} is less than minimum size ${pipe.minBatchSize}`);\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tsequentialFailureCount = 0;\n\n\t\t\t\t\t/**\n\t\t\t\t\t * The IDs for the entries we are sending to the next stage\n\t\t\t\t\t * target -- this may get reduced if we find there are already\n\t\t\t\t\t * jobs in the next stage that have the idempotentIDs of one of\n\t\t\t\t\t * these jobs\n\t\t\t\t\t */\n\t\t\t\t\tconst batchLocalIDs = new Set(batchRaw.map(function(entry) {\n\t\t\t\t\t\treturn(entry.id);\n\t\t\t\t\t}));\n\t\t\t\t\t/**\n\t\t\t\t\t * The outputs for the batch we are sending to the next stage\n\t\t\t\t\t */\n\t\t\t\t\tconst batchOutput = batchRaw.map(function(entry) {\n\t\t\t\t\t\treturn(entry.output);\n\t\t\t\t\t});\n\n\t\t\t\t\tlogger?.debug(`Moving batch of ${batchOutput.length} completed requests to next pipe`, pipe.target.id, '(input entry IDs:', Array.from(batchLocalIDs), '->', `${pipe.target.id}:${String(batchID)})`);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait pipe.target.add(batchOutput, {\n\t\t\t\t\t\t\tid: batchID,\n\t\t\t\t\t\t\t/* Use the set of IDs as the idempotent IDs for the batch */\n\t\t\t\t\t\t\tidempotentKeys: batchLocalIDs\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\t\t\t\tbatchID = crypto.randomUUID() as unknown as KeetaAnchorQueueRequestID;\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tif (Errors.IdempotentExistsError.isInstance(error) && error.idempotentIDsFound) {\n\t\t\t\t\t\t\tlogger?.debug('Some of the jobs have already been added to the target queue, skipping those:', error.idempotentIDsFound.values());\n\t\t\t\t\t\t\tfor (const requestID of error.idempotentIDsFound) {\n\t\t\t\t\t\t\t\titerationTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\t\t\tallTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * If we got some kind of other error adding these\n\t\t\t\t\t\t\t * items to the target queue runner, just skip them\n\t\t\t\t\t\t\t * and we will retry them on the next iteration\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tlogger?.error(`Failed to move completed batch to next stage ${pipe.target.id}, will try to create another batch without them:`, error);\n\n\t\t\t\t\t\t\tfor (const requestID of batchLocalIDs) {\n\t\t\t\t\t\t\t\tskipRequestIDs.add(requestID);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const requestID of batchLocalIDs) {\n\t\t\t\t\t\titerationTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\tallTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * For every request we know the target has definitely seen, mark it\n\t\t\t\t * as moved for this pipe\n\t\t\t\t */\n\t\t\t\tfor (const requestID of allTargetSeenRequestIDs) {\n\t\t\t\t\tIncrRequestSentToPipes(requestID);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const request of requests) {\n\t\t\t\t\tlet shouldMarkAsMoved = true;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst output = this.decodeResponse(request.output);\n\t\t\t\t\t\tif (output === null) {\n\t\t\t\t\t\t\tlogger?.debug(`Completed request with id ${String(request.id)} has no output -- next stage will not be run`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlogger?.debug(`Moving completed request with id ${String(request.id)} to next pipe`, pipe.target.id);\n\t\t\t\t\t\t\tawait pipe.target.add(output, { id: request.id });\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tlogger?.error(`Failed to move completed request with id ${String(request.id)} to next stage:`, error);\n\t\t\t\t\t\tshouldMarkAsMoved = false;\n\t\t\t\t\t}\n\t\t\t\t\tif (shouldMarkAsMoved) {\n\t\t\t\t\t\tIncrRequestSentToPipes(request.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst TotalPipes = pipes.length;\n\t\tfor (const request of allRequests) {\n\t\t\tconst sentCount = RequestSentToPipes.get(request.id) ?? 0;\n\t\t\tif (sentCount !== TotalPipes) {\n\t\t\t\tlogger?.debug(`Completed request with id ${String(request.id)} was only moved to ${sentCount} out of ${TotalPipes} pipes -- not marking as moved`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlogger?.debug(`Marking completed request with id ${String(request.id)} as moved`);\n\n\t\t\tawait this.queue.setStatus(request.id, 'moved', { oldStatus: 'completed', by: this.workerID });\n\t\t}\n\n\t}\n\n\tasync maintain(): Promise<void> {\n\t\tconst logger = this.methodLogger('maintain');\n\n\t\tif (this.workers.id !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait this.initialize();\n\t\ttry {\n\t\t\tawait this.maintainRunnerLock();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to maintain runner lock:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.markStuckRequestsAsStuck();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to mark stuck requests as stuck:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.requeueFailedRequests();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to requeue failed requests:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.moveCompletedToNextStage();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to move completed requests to next stage:', error);\n\t\t}\n\n\t\tfor (const pipe of this.pipes) {\n\t\t\ttry {\n\t\t\t\tawait pipe.target.maintain();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.debug(`Failed to maintain piped runner with ID ${pipe.target.id}:`, error);\n\t\t\t}\n\t\t}\n\n\t\tif (this.queue.maintain) {\n\t\t\ttry {\n\t\t\t\tawait this.queue.maintain();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.debug(`Failed to maintain queue storage driver with ID ${this.queue.id}`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Pipe the the completed entries of this runner to another runner\n\t */\n\tpipe<T1, T2 extends JSONSerializable>(target: KeetaAnchorQueueRunner<URESPONSE, T1, RESPONSE, T2>): typeof target {\n\t\tthis.pipes.push({\n\t\t\tisBatchPipe: false,\n\t\t\ttarget: target\n\t\t});\n\t\treturn(target);\n\t}\n\n\t/**\n\t * Pipe batches of completed entries from this runner to another runner\n\t */\n\tpipeBatch<T1, T2 extends JSONSerializable>(target: KeetaAnchorQueueRunner<URESPONSE[], T1, JSONSerializable, T2>, maxBatchSize = 100, minBatchSize = 1): typeof target {\n\t\tthis.pipes.push({\n\t\t\tisBatchPipe: true,\n\t\t\ttarget: target,\n\t\t\tminBatchSize: minBatchSize,\n\t\t\tmaxBatchSize: maxBatchSize\n\t\t});\n\t\treturn(target);\n\t}\n\n\tasync destroy(): Promise<void> {\n\t\tthis.methodLogger('destroy')?.debug('Destroying queue runner attached to queue', this.queue.id);\n\t}\n\n\tasync [Symbol.asyncDispose](): Promise<void> {\n\t\tawait this.destroy();\n\t}\n}\n\n/**\n * A KeetaAnchorQueueRunner for use when you want to process already\n * JSON-serializable data without any encoding/decoding needed\n */\nexport abstract class KeetaAnchorQueueRunnerJSON<UREQUEST extends JSONSerializable = JSONSerializable, URESPONSE extends JSONSerializable = JSONSerializable> extends KeetaAnchorQueueRunner<UREQUEST, URESPONSE, JSONSerializable, JSONSerializable> {\n\tprotected decodeRequest(request: JSONSerializable): UREQUEST {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(request as UREQUEST);\n\t}\n\n\tprotected decodeResponse(response: JSONSerializable | null): URESPONSE | null {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(response as URESPONSE | null);\n\t}\n\n\tprotected encodeRequest(request: JSONSerializable): JSONSerializable {\n\t\treturn(request);\n\t}\n\n\tprotected encodeResponse(response: JSONSerializable | null): JSONSerializable | null {\n\t\treturn(response);\n\t}\n}\n\n/**\n * A KeetaAnchorQueueRunnerJSON that takes a processor function\n * in the constructor -- this is mainly useful for testing\n */\nexport class KeetaAnchorQueueRunnerJSONConfigProc<UREQUEST extends JSONSerializable = JSONSerializable, URESPONSE extends JSONSerializable = JSONSerializable> extends KeetaAnchorQueueRunnerJSON<UREQUEST, URESPONSE> {\n\tprotected readonly processor: KeetaAnchorQueueRunner<UREQUEST, URESPONSE>['processor'];\n\n\tconstructor(config: ConstructorParameters<typeof KeetaAnchorQueueRunner>[0] & {\n\t\tprocessor: KeetaAnchorQueueRunner<UREQUEST, URESPONSE>['processor'];\n\t\tprocessorStuck?: KeetaAnchorQueueRunner<UREQUEST, URESPONSE>['processorStuck'] | undefined;\n\t\tprocessorAborted?: KeetaAnchorQueueRunner<UREQUEST, URESPONSE>['processorAborted'] | undefined;\n\t}) {\n\t\tsuper(config);\n\t\tthis.processor = config.processor;\n\t\tif (config.processorStuck) {\n\t\t\tthis.processorStuck = config.processorStuck;\n\t\t}\n\t\tif (config.processorAborted) {\n\t\t\tthis.processorAborted = config.processorAborted;\n\t\t}\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype _ignore_static_assert_memory = AssertNever<typeof KeetaAnchorQueueStorageDriverMemory<{ a: string; }, number> extends KeetaAnchorQueueStorageDriverConstructor<{ a: string; }, number> ? never : false>;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Logger } from '../log/index.ts';
|
|
2
|
+
export declare function MethodLogger<T extends Logger | undefined>(input: T, from: {
|
|
3
|
+
file: string;
|
|
4
|
+
method: string;
|
|
5
|
+
class: string;
|
|
6
|
+
instanceID: string;
|
|
7
|
+
}): T extends Logger ? Logger : undefined;
|
|
8
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/lib/queue/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG9C,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;CAAE,GAAG,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,SAAS,CA2BtL"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* XXX: Move this somewhere more common */
|
|
2
|
+
export function MethodLogger(input, from) {
|
|
3
|
+
if (input === undefined) {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
const fromStr = `${from.class}${from.instanceID ? `:${from.instanceID}` : ''}::${from.method}`;
|
|
8
|
+
const retval = {
|
|
9
|
+
debug: function (...logArgs) {
|
|
10
|
+
input.debug(fromStr, ...logArgs);
|
|
11
|
+
},
|
|
12
|
+
info: function (...logArgs) {
|
|
13
|
+
input.info(fromStr, ...logArgs);
|
|
14
|
+
},
|
|
15
|
+
warn: function (...logArgs) {
|
|
16
|
+
input.warn(fromStr, ...logArgs);
|
|
17
|
+
},
|
|
18
|
+
error: function (...logArgs) {
|
|
19
|
+
input.error(fromStr, ...logArgs);
|
|
20
|
+
},
|
|
21
|
+
log: function (...logArgs) {
|
|
22
|
+
input.log(fromStr, ...logArgs);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
26
|
+
return retval;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/lib/queue/internal.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,MAAM,UAAU,YAAY,CAA+B,KAAQ,EAAE,IAA0E;IAC9I,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,yEAAyE;QACzE,OAAO,SAAmD,CAAC;IAC5D,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;IAC/F,MAAM,MAAM,GAAW;QACtB,KAAK,EAAE,UAAS,GAAG,OAAkB;YACpC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,EAAE,UAAS,GAAG,OAAkB;YACnC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,EAAE,UAAS,GAAG,OAAkB;YACnC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,KAAK,EAAE,UAAS,GAAG,OAAkB;YACpC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;QAClC,CAAC;QACD,GAAG,EAAE,UAAS,GAAG,OAAkB;YAClC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;QAChC,CAAC;KACD,CAAC;IAEF,yEAAyE;IACzE,OAAO,MAAgD,CAAC;AACzD,CAAC","sourcesContent":["import type { Logger } from '../log/index.ts';\n\n/* XXX: Move this somewhere more common */\nexport function MethodLogger<T extends Logger | undefined>(input: T, from: { file: string; method: string; class: string; instanceID: string; }): T extends Logger ? Logger : undefined {\n\tif (input === undefined) {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(undefined as T extends Logger ? Logger : undefined);\n\t}\n\n\tconst fromStr = `${from.class}${from.instanceID ? `:${from.instanceID}` : ''}::${from.method}`;\n\tconst retval: Logger = {\n\t\tdebug: function(...logArgs: unknown[]): void {\n\t\t\tinput.debug(fromStr, ...logArgs);\n\t\t},\n\t\tinfo: function(...logArgs: unknown[]): void {\n\t\t\tinput.info(fromStr, ...logArgs);\n\t\t},\n\t\twarn: function(...logArgs: unknown[]): void {\n\t\t\tinput.warn(fromStr, ...logArgs);\n\t\t},\n\t\terror: function(...logArgs: unknown[]): void {\n\t\t\tinput.error(fromStr, ...logArgs);\n\t\t},\n\t\tlog: function(...logArgs: unknown[]): void {\n\t\t\tinput.log(fromStr, ...logArgs);\n\t\t}\n\t};\n\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(retval as T extends Logger ? Logger : undefined);\n}\n"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { KeetaAnchorQueueRunner } from './index.js';
|
|
2
|
+
import type { KeetaAnchorQueueStorageDriver, KeetaAnchorQueueRequestID, KeetaAnchorQueueCommonOptions, KeetaAnchorQueueEntry } from './index.ts';
|
|
3
|
+
import type { Logger } from '../log/index.ts';
|
|
4
|
+
import type { JSONSerializable } from '../utils/json.js';
|
|
5
|
+
/**
|
|
6
|
+
* A KeetaAnchorQueueRunner that uses `any` for the user types
|
|
7
|
+
* This is helpful for expressing pipelines where the inputs
|
|
8
|
+
* and outputs of various stages are not known ahead of time
|
|
9
|
+
*/
|
|
10
|
+
declare class KeetaAnchorQueueRunnerAny<UREQUEST = any, URESPONSE = any, REQUEST extends JSONSerializable = JSONSerializable, RESPONSE extends JSONSerializable = JSONSerializable> extends KeetaAnchorQueueRunner<UREQUEST, URESPONSE, REQUEST, RESPONSE> {
|
|
11
|
+
protected processor(): ReturnType<KeetaAnchorQueueRunner<UREQUEST, URESPONSE, REQUEST, RESPONSE>['processor']>;
|
|
12
|
+
protected decodeRequest(): UREQUEST;
|
|
13
|
+
protected decodeResponse(): URESPONSE | null;
|
|
14
|
+
protected encodeRequest(): REQUEST;
|
|
15
|
+
protected encodeResponse(): RESPONSE | null;
|
|
16
|
+
}
|
|
17
|
+
type KeetaAnchorQueuePipelineStage<REQUEST, RESPONSE> = {
|
|
18
|
+
/**
|
|
19
|
+
* Name of the stage (must be unique within the pipeline)
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* Constructor of the runner to use for this stage
|
|
24
|
+
*/
|
|
25
|
+
runner: typeof KeetaAnchorQueueRunner<REQUEST, RESPONSE, JSONSerializable, JSONSerializable>;
|
|
26
|
+
/**
|
|
27
|
+
* Arguments to pass to the runner constructor
|
|
28
|
+
*/
|
|
29
|
+
args?: [{
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}?, ...unknown[]];
|
|
32
|
+
};
|
|
33
|
+
export interface KeetaAnchorQueuePipeline<REQUEST, FINALRESPONSE> {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Add a new request to the queue pipeline at the first stage
|
|
37
|
+
*
|
|
38
|
+
* @param request The request to add
|
|
39
|
+
* @returns The ID of the newly added request
|
|
40
|
+
*/
|
|
41
|
+
add: (request: REQUEST) => Promise<KeetaAnchorQueueRequestID>;
|
|
42
|
+
/**
|
|
43
|
+
* Get the entry of a request at the final stage of the pipeline
|
|
44
|
+
* stage or `null` if not in the final stage
|
|
45
|
+
*
|
|
46
|
+
* The original request is also returned if available
|
|
47
|
+
*
|
|
48
|
+
* @param id The ID of the request to get
|
|
49
|
+
* @returns The entry at the final stage or `null` if not found, with the original request (may be `null` if not available)
|
|
50
|
+
*/
|
|
51
|
+
get: (id: KeetaAnchorQueueRequestID) => Promise<(Omit<KeetaAnchorQueueEntry<REQUEST, FINALRESPONSE>, 'request'> & {
|
|
52
|
+
request: REQUEST | null;
|
|
53
|
+
}) | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Run the pipeline processing jobs for up to the specified timeout (in milliseconds)
|
|
56
|
+
* The process may take longer than the timeout if a job is already in progress
|
|
57
|
+
* when the timeout is reached, in which case the process will complete the current job
|
|
58
|
+
* before returning.
|
|
59
|
+
*
|
|
60
|
+
* @param timeoutMs The maximum time to run the processing jobs (in milliseconds). If not specified, runs until all available jobs are processed.
|
|
61
|
+
* @returns `true` if there are more jobs to process, `false` otherwise
|
|
62
|
+
*/
|
|
63
|
+
run: (timeoutMs?: number) => Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Run maintenance tasks for the pipeline -- this includes moving tasks from various states
|
|
66
|
+
* and between stages of the pipeline
|
|
67
|
+
*/
|
|
68
|
+
maintain: () => Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Destroy the pipeline and release any resources it allocated
|
|
71
|
+
*/
|
|
72
|
+
destroy: () => Promise<void>;
|
|
73
|
+
[Symbol.asyncDispose]: () => Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Abstract base class for queue advanced pipelines -- this provides
|
|
77
|
+
* a standardized way to implement custom processing pipelines that
|
|
78
|
+
* consist of multiple stages with custom behavior
|
|
79
|
+
*/
|
|
80
|
+
export declare abstract class KeetaAnchorQueuePipelineAdvanced<IN1 = unknown, FINALOUT = unknown> implements KeetaAnchorQueuePipeline<IN1, FINALOUT> {
|
|
81
|
+
readonly id: string;
|
|
82
|
+
protected readonly baseQueue: KeetaAnchorQueueStorageDriver<JSONSerializable, JSONSerializable>;
|
|
83
|
+
protected readonly logger?: Logger | undefined;
|
|
84
|
+
protected queues: KeetaAnchorQueueStorageDriver<JSONSerializable, JSONSerializable>[];
|
|
85
|
+
protected initPromise?: Promise<void>;
|
|
86
|
+
protected destroyed: boolean;
|
|
87
|
+
static readonly StageID: {
|
|
88
|
+
readonly first: unique symbol;
|
|
89
|
+
readonly last: unique symbol;
|
|
90
|
+
};
|
|
91
|
+
constructor(options: KeetaAnchorQueueCommonOptions & {
|
|
92
|
+
baseQueue: KeetaAnchorQueueStorageDriver<JSONSerializable, JSONSerializable>;
|
|
93
|
+
});
|
|
94
|
+
protected methodLogger(method: string): Logger | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Create the pipeline stages -- will be called by the initialization process
|
|
97
|
+
*/
|
|
98
|
+
protected abstract createPipeline(): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Get the stage runner for the specified stage name, or the first/last stage
|
|
101
|
+
*/
|
|
102
|
+
protected abstract getStage(stageID: typeof KeetaAnchorQueuePipelineAdvanced.StageID.first): KeetaAnchorQueueRunner<IN1, unknown>;
|
|
103
|
+
protected abstract getStage(stageID: typeof KeetaAnchorQueuePipelineAdvanced.StageID.last): KeetaAnchorQueueRunner<unknown, FINALOUT>;
|
|
104
|
+
protected abstract getStage(stageID: typeof KeetaAnchorQueuePipelineAdvanced.StageID.first | typeof KeetaAnchorQueuePipelineAdvanced.StageID.last | string): KeetaAnchorQueueRunnerAny | null;
|
|
105
|
+
/**
|
|
106
|
+
* Create a new queue to use in a pipeline stage
|
|
107
|
+
* It will be released when the pipeline is destroyed
|
|
108
|
+
*
|
|
109
|
+
* @param name The name of the queue
|
|
110
|
+
* @returns The created queue
|
|
111
|
+
*/
|
|
112
|
+
protected createQueue(name: string): Promise<KeetaAnchorQueueStorageDriver<JSONSerializable, JSONSerializable>>;
|
|
113
|
+
protected init(): Promise<void>;
|
|
114
|
+
add(request: IN1): ReturnType<KeetaAnchorQueueRunner<IN1, unknown>['add']>;
|
|
115
|
+
get(id: KeetaAnchorQueueRequestID): Promise<(Omit<KeetaAnchorQueueEntry<IN1, FINALOUT>, 'request'> & {
|
|
116
|
+
request: IN1 | null;
|
|
117
|
+
}) | null>;
|
|
118
|
+
run(timeoutMs?: number): Promise<boolean>;
|
|
119
|
+
maintain(): Promise<void>;
|
|
120
|
+
destroy(): Promise<void>;
|
|
121
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
122
|
+
}
|
|
123
|
+
type MapKeetaAnchorQueuePipelineStages<In extends readonly [any, ...any[]]> = In extends [infer First, ...infer Rest extends [any, ...any[]]] ? readonly [KeetaAnchorQueuePipelineStage<First, Rest[0]>, ...MapKeetaAnchorQueuePipelineStages<Rest>] : [];
|
|
124
|
+
type MapKeetaAnchorQueueRunner<In extends readonly [any, ...any[]]> = In extends [infer First, ...infer Rest extends [any, ...any[]]] ? readonly [KeetaAnchorQueueRunner<First, Rest[0]>, ...MapKeetaAnchorQueueRunner<Rest>] : [];
|
|
125
|
+
type FirstElement<T extends readonly any[]> = T extends [infer First, ...any[]] ? First : never;
|
|
126
|
+
type LastElement<T extends readonly any[]> = T extends [...any[], infer Last] ? Last : never;
|
|
127
|
+
/**
|
|
128
|
+
* Abstract base class for queue basic pipelines -- this provides
|
|
129
|
+
* a standardized way to implement custom processing pipelines that
|
|
130
|
+
* consist of multiple stages but do not require batching
|
|
131
|
+
*/
|
|
132
|
+
export declare abstract class KeetaAnchorQueuePipelineBasic<Stages extends readonly [any, ...any[]]> extends KeetaAnchorQueuePipelineAdvanced<FirstElement<Stages>, LastElement<Stages>> implements KeetaAnchorQueuePipeline<FirstElement<Stages>, LastElement<Stages>> {
|
|
133
|
+
protected readonly abstract stages: MapKeetaAnchorQueuePipelineStages<Stages>;
|
|
134
|
+
protected stageRunners: MapKeetaAnchorQueueRunner<Stages>;
|
|
135
|
+
constructor(options: KeetaAnchorQueueCommonOptions & {
|
|
136
|
+
baseQueue: KeetaAnchorQueueStorageDriver<JSONSerializable, JSONSerializable>;
|
|
137
|
+
});
|
|
138
|
+
protected methodLogger(method: string): Logger | undefined;
|
|
139
|
+
protected getStage(stageID: typeof KeetaAnchorQueuePipelineAdvanced.StageID.first): KeetaAnchorQueueRunner<FirstElement<Stages>, unknown>;
|
|
140
|
+
protected getStage(stageID: typeof KeetaAnchorQueuePipelineAdvanced.StageID.last): KeetaAnchorQueueRunner<unknown, LastElement<Stages>>;
|
|
141
|
+
protected getStage(stageID: typeof KeetaAnchorQueuePipelineAdvanced.StageID.first | typeof KeetaAnchorQueuePipelineAdvanced.StageID.last | string): KeetaAnchorQueueRunnerAny | null;
|
|
142
|
+
/**
|
|
143
|
+
* Create the pipeline from the user-defined stages
|
|
144
|
+
*/
|
|
145
|
+
protected createPipeline(): Promise<void>;
|
|
146
|
+
destroy(): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
149
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/lib/queue/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACX,6BAA6B,EAC7B,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;GAIG;AAEH,cAAM,yBAAyB,CAAC,QAAQ,GAAG,GAAG,EAAE,SAAS,GAAG,GAAG,EAAE,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EAAE,QAAQ,SAAS,gBAAgB,GAAG,gBAAgB,CAAE,SAAQ,sBAAsB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC;IACjP,SAAS,CAAC,SAAS,IAAI,UAAU,CAAC,sBAAsB,CAAC,QAAQ,E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