New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

volos-quota-common

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

volos-quota-common - npm Package Compare versions

Comparing version 0.9.0 to 0.9.2

lib/memory_buffer.js

30

lib/quota.js

@@ -56,2 +56,4 @@ /****************************************************************************

// options.consistency (string) A hint to some SPIs about how to distribute quota around
// options.bufferSize (Number) optional, use a memory buffer up to bufferSize to hold quota elements
// options.bufferTimeout (Number) optional, flush the buffer every Number ms (default: 300)

@@ -64,2 +66,3 @@ function Quota(Spi, o) {

options.rollingWindow = o.rollingWindow || false;
options.bufferSize = checkNumber(o.bufferSize, 'bufferSize') || 0;

@@ -91,4 +94,15 @@ if (!options.timeUnit in TimeUnits) {

if (options.bufferSize > 0) {
options.bufferTimeout = checkNumber(o.bufferTimeout, 'bufferTimeout') || 300;
}
this.options = options;
this.quota = new Spi(options);
var spi = new Spi(options);
if (options.bufferSize > 0) {
var Buffer = require('./memory_buffer');
var buffer = Buffer.create(spi, options);
this.quota = buffer;
} else {
this.quota = spi;
}
}

@@ -100,5 +114,7 @@ module.exports = Quota;

// options.allow (Number) default = whatever was set in policy setup, and this allows override
// cb is invoked with first parameter error, second whether it was allowed, third stats on the quota
// cb is invoked with first parameter error, second with stats on the quota
// stats.allowed = setting of "allow"
// stats.used = current value
// stats.isAllowed = true if allowed
// stats.expiryTime = end time (ms) for this window

@@ -121,1 +137,11 @@ Quota.prototype.apply = function(o, cb) {

};
Quota.prototype.expressMiddleware = function(options) {
var mw = require('./quota-express');
return new mw(this, options);
};
Quota.prototype.argoMiddleware = function(options) {
var mw = require('./quota-argo');
return new mw(this, options);
};

19

package.json
{
"name": "volos-quota-common",
"version": "0.9.0",
"version": "0.9.2",
"main": "lib/quota.js",

@@ -8,11 +8,12 @@ "license": "MIT",

"homepage": "https://github.com/apigee/volos",
"keywords": ["quota", "memory"],
"dependencies": {
},
"devDependencies": {
},
"repository" : {
"type" : "git",
"url" : "https://github.com/apigee/volos.git"
"keywords": [
"quota",
"memory"
],
"dependencies": {},
"devDependencies": {},
"repository": {
"type": "git",
"url": "https://github.com/apigee/volos.git"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc