Socket
Socket
Sign inDemoInstall

abstract-scheduler

Package Overview
Dependencies
95
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abstract-scheduler

An interface and test suite to implement various scheduling algorithms.


Version published
Weekly downloads
7
increased by250%
Maintainers
4
Install size
2.19 MB
Created
Weekly downloads
 

Readme

Source

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() // '1.example.com'
servers.get() // '2.example.com'
servers.get() // '1.example.com'

npm version build status minimum Node.js version ISC-licensed

abstract-scheduler-compatible modules

Send a PR by adding yours!

Badge

Include this badge if you make a library compatible with abstract-scheduler.

compatible with abstract-scheduler

[![compatible with abstract-scheduler](https://unpkg.com/abstract-scheduler@4/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. Returns the (0-based) index of the stored value.

scheduler.remove(i)

Remove a value by (0-based) index. Returns true if the scheduler contained value, false otherwise.

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.

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.

Keywords

FAQs

Last updated on 06 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc