abstract-scheduler
An interface and test suite to implement various scheduling algorithms. The goal is to define a simple and flexible standard for libraries that implement scheduling algorithms, so that you can replace them easily.
const createScheduler = require('any-abstract-scheduler-compatible')
const servers = createScheduler(['1.example.com', '2.example.com'])
servers.get()
servers.get()
servers.get()
abstract-scheduler
-compatible modules
todo
Send a PR by adding yours!
Badge
Include this badge if you make a library compatible with abstract-scheduler
.
[![compatible with abstract-scheduler](https://github.com/derhuerst/abstract-scheduler/raw/master/badge.svg)](https://github.com/derhuerst/abstract-scheduler)
How to test for abstract-scheduler
compatibility
npm i abstract-scheduler --save-dev
Include this in your test file:
const runAbstractSchedulerTests = require('abstract-scheduler')
const createMyScheduler = require('.')
runAbstractSchedulerTests(createMyScheduler)
tape
will be used to test, writing TAP to stdout
.
The abstract-scheduler
API
createScheduler(values = [])
Create an empty scheduler or provide some initial values.
scheduler.add(value)
Add a value to the scheduler.
scheduler.remove(value)
Remove a value from the scheduler. Returns true
if the value was in the scheduler and false
if it wasn't.
scheduler.has(value)
Checks whether the given value is already in the scheduler. Returns either true
or false
.
scheduler.get()
Get the next value according to the scheduling algorithm.
Related
abstract-scheduler
is inspired by abstract-chunk-store
, abstract-blob-store
and abstract-point-store
.
Contributing
If you have a question or need support using abstract-scheduler
, refer to the issues page.