Socket
Socket
Sign inDemoInstall

volos-spikearrest-memory

Package Overview
Dependencies
4
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    volos-spikearrest-memory

In-memory provider for Spike Arrest enforcement in the Volos system.


Version published
Weekly downloads
130
decreased by-13.33%
Maintainers
1
Install size
729 kB
Created
Weekly downloads
 

Readme

Source

volos-quota-memory

This is a memory-backed implementation of Spike Arrest support for Volos.

Once initialized, the interface to the module is exactly what is in the "volos-spikearrest-common" module. See that module for detailed docs.

Initialization

To initialize a SpikeArrest, you call "create" on the exported module and pass a single "options" object. It can contain the following parameters:

  • timeUnit: How often the SpikeArrest resets - may be in seconds or minutes
  • allow: The maximum number of requests to allow during the timeUnit.
  • bufferSize: (optional, default = 0) if bufferSize > 0, SpikeArrest will attempt to smooth requests by returning only when the next appropriate execution window is available. bufferSize is how many requests to "queue" before returning (immediately) with a isAllowed = false.

Once the quota has been initialized, the module that is returned has the programming interface defined by the "volos-quota-common" module.

Example

var SpikeArrest = require('volos-spikearrest-memory');
var spikeArrest = SpikeArrest.create({
  timeUnit: 'second',
  allow: 10,
  bufferSize: 10
});

spikeArrest.apply({ key: 'Foo', weight: 1 }, function(err, result) {
  if (err) { throw err; }
  console.log('Status: %s', result.isAllowed);
});

Keywords

FAQs

Last updated on 07 Jun 2019

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