Socket
Socket
Sign inDemoInstall

abstract-skiff-persistence

Package Overview
Dependencies
17
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abstract-skiff-persistence

Abstract Skiff Persistence provider


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
1.69 MB
Created
Weekly downloads
 

Readme

Source

Abstract Skiff Persistence

Abstract prototype for building a Skiff persistence provider.

Install

$ npm install abstract-skiff-persistence

## Implement

```javascript
var AbstractSkiffPersistence = require('abstract-skiff-persistence');
var inherits = require('util').inherits;

module.exports = FakeSkiffPersistence;

function FakeSkiffPersistence() {
}

inherits(FakeSkiffPersistence, AbstractSkiffPersistence);

FakeSkiffPersistence.prototype._
'use strict';

module.exports = AbstractSkiffPersistence;

function AbstractSkiffPersistence(options) {
}

FakeSkiffPersistence.prototype._saveMeta = function(nodeId, state, callback) {
  // ...
};

FakeSkiffPersistence.prototype._loadMeta = function(nodeId, callback) {
  // ...
};

FakeSkiffPersistence.prototype._applyCommand = function(nodeId, commitIndex, command, callback) {
  // ...
};

FakeSkiffPersistence.prototype._lastAppliedCommitIndex = function(nodeId, callback) {
  // ...
};

FakeSkiffPersistence.prototype._saveCommitIndex = function(nodeId, commitIndex, callback) {
  // ...
};

FakeSkiffPersistence.prototype._createReadStream = function(nodeId) {
  // ...
};

FakeSkiffPersistence.prototype._createWriteStream = function(nodeId) {
  // ...
};

FakeSkiffPersistence.prototype._removeAllState = function(nodeId, callback) {
  // ...
};

FakeSkiffPersistence.prototype._close = function(callback) {
  // ...
};

Test

You can use this module to test your Skiff Persistence provider:

'use strict';

var test = require('abstract-skiff-persistence/test/all');

var FakeSkiffPersistence = require('../');
var p = new FakeSkiffPersistence();

var options = {
  commands: [
    {type: 'put', key: 'a', value: 1},
    {type: 'put', key: 'b', value: 2},
    {type: 'del', key: 'a'},
    {type: 'put', key: 'c', value: {some: 'object'}}
  ],
  expectedReads: [
    {key: 'b': value: 2},
    {key: 'c': value: {some: 'object'}}
  },
  newWrites: [
    {type: 'put', key: 'd', value: 3},
    {type: 'put', key: 'e', value: {some: 'other object'}},
    {type: 'put', key: 'f', value: 'some other string'}
  ],
  newReads: [
    {key: 'd', value: 3},
    {key: 'e', value: {some: 'other object'}},
    {key: 'f', value: 'some other string'}
  ]
};

test(p, options);

License

ISC

FAQs

Last updated on 28 Oct 2014

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