-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#45 implement sync-point labels and global registration
- Loading branch information
1 parent
bb7ecae
commit af4e9bb
Showing
5 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type {ISyncPoint} from "../scheduler/pipeline/sync-point.spec"; | ||
|
||
const syncPoints = new Map<string, ISyncPoint>(); | ||
|
||
/** | ||
* Register a sync-point by name | ||
* @param syncPoint | ||
*/ | ||
export function addSyncPoint(syncPoint: ISyncPoint): void { | ||
if (!syncPoint.name) { | ||
throw new Error('Cannot register a sync point without a name!'); | ||
} | ||
|
||
{ | ||
const name = syncPoint.name; | ||
|
||
if (syncPoints.has(name) && syncPoints.get(name) != syncPoint) { | ||
throw new Error(`Another sync point with the name "${name}" has already been registered!`); | ||
} | ||
|
||
syncPoints.set(name, syncPoint); | ||
} | ||
} | ||
|
||
/** | ||
* Find a sync-point by name, if it exists | ||
* @param name | ||
*/ | ||
export function getSyncPoint(name: string): ISyncPoint | undefined { | ||
return syncPoints.get(name); | ||
} | ||
|
||
/** | ||
* Remove a sync-point from the registry by name, if it exists | ||
* @param name | ||
*/ | ||
export function removeSyncPoint(name: string): void { | ||
syncPoints.delete(name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters