Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
5bf568d0cd | |||
173e1ca35d | |||
ce258c76d2 | |||
4d2756b743 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/taskbuffer",
|
||||
"version": "3.0.6",
|
||||
"version": "3.0.8",
|
||||
"private": false,
|
||||
"description": "flexible task management. TypeScript ready!",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/taskbuffer',
|
||||
version: '3.0.6',
|
||||
version: '3.0.8',
|
||||
description: 'flexible task management. TypeScript ready!'
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ import * as plugins from './taskbuffer.plugins.js';
|
||||
* constains all data for the final coordinator to actually make an informed decision
|
||||
*/
|
||||
export interface IDistributedDecisionInfoBasis {
|
||||
/**
|
||||
* this needs to correlate to the consultationResult
|
||||
*/
|
||||
submitterRandomId: string;
|
||||
taskName: string;
|
||||
taskVersion: string;
|
||||
@ -14,33 +17,18 @@ export interface IDistributedDecisionInfoBasis {
|
||||
status: 'requesting' | 'gotRejected' | 'failed' | 'succeeded';
|
||||
}
|
||||
|
||||
export interface ITaskConsultationResult {
|
||||
export interface IDsitributedTaskConsultationResult {
|
||||
/**
|
||||
* this needs to correlate to the decisionInfoBasis
|
||||
*/
|
||||
submitterRandomId: string;
|
||||
considered: boolean;
|
||||
rank: string;
|
||||
reason: string;
|
||||
shouldTrigger: boolean;
|
||||
}
|
||||
|
||||
export interface IDistributedCoordinatorConstructorOptions {
|
||||
/**
|
||||
* each execution should be announced
|
||||
*/
|
||||
announceDistributedDecisionInfoBasis: (distributedCoordinatorArg: DistributedCoordinator, infoBasisArg: IDistributedDecisionInfoBasis) => Promise<ITaskConsultationResult>
|
||||
updateDistributedDecisionInfoBasis: (distributedCoordinatorArg: DistributedCoordinator, infoBasisArg: IDistributedDecisionInfoBasis) => Promise<void>
|
||||
}
|
||||
|
||||
export class DistributedCoordinator {
|
||||
public options: IDistributedCoordinatorConstructorOptions;
|
||||
|
||||
constructor(optionsArg: IDistributedCoordinatorConstructorOptions) {
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
public async announceDistributedDecisionInfoBasis(infoBasisArg: IDistributedDecisionInfoBasis): Promise<ITaskConsultationResult> {
|
||||
return this.options.announceDistributedDecisionInfoBasis(this, infoBasisArg);
|
||||
}
|
||||
public async updateDistributedDevisionInfoBasis(infoBasisArg: IDistributedDecisionInfoBasis): Promise<void> {
|
||||
return this.options.updateDistributedDecisionInfoBasis(this, infoBasisArg)
|
||||
}
|
||||
|
||||
export abstract class AbstractDistributedCoordinator {
|
||||
public abstract announceDistributedDecisionInfoBasis(infoBasisArg: IDistributedDecisionInfoBasis): Promise<IDsitributedTaskConsultationResult>
|
||||
public abstract updateDistributedDevisionInfoBasis(infoBasisArg: IDistributedDecisionInfoBasis): Promise<void>
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './taskbuffer.plugins.js';
|
||||
import { Task } from './taskbuffer.classes.task.js';
|
||||
import { DistributedCoordinator } from './taskbuffer.classes.distributedcoordinator.js';
|
||||
import { AbstractDistributedCoordinator } from './taskbuffer.classes.distributedcoordinator.js';
|
||||
|
||||
export interface ICronJob {
|
||||
cronString: string;
|
||||
@ -9,7 +9,7 @@ export interface ICronJob {
|
||||
}
|
||||
|
||||
export interface ITaskManagerConstructorOptions {
|
||||
distributedCoordinator?: DistributedCoordinator
|
||||
distributedCoordinator?: AbstractDistributedCoordinator
|
||||
}
|
||||
|
||||
export class TaskManager {
|
||||
|
Reference in New Issue
Block a user