# abstract-skiff-persistence

> Abstract Skiff Persistence provider

Latest version **0.8.0** (published 2014-10-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install abstract-skiff-persistence
pnpm add abstract-skiff-persistence
yarn add abstract-skiff-persistence
bun add abstract-skiff-persistence
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.0 |
| Published | 2014-10-28 |
| First published | 2014-10-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | pgte |
| Maintainers | pgte |

## Links

- npm: https://www.npmjs.com/package/abstract-skiff-persistence
- Repository: https://github.com/pgte/abstract-skiff-persistence
- Issues: https://github.com/pgte/abstract-skiff-persistence/issues
- npm.io page: https://npm.io/package/abstract-skiff-persistence

## Dependencies (4)

- [cuid](https://npm.io/package/cuid.md) ^1.2.4
- [tape](https://npm.io/package/tape.md) ^3.0.0
- [async](https://npm.io/package/async.md) ^0.9.0
- [colors](https://npm.io/package/colors.md) ^1.0.3

## Recent versions

- 0.8.0 (latest) — 2014-10-28
- 0.7.0 — 2014-10-22
- 0.5.3 — 2014-10-20
- 0.5.2 — 2014-10-16
- 0.5.1 — 2014-10-16
- 0.5.0 — 2014-10-16

## README

# Abstract Skiff Persistence

Abstract prototype for building a [Skiff](https://github.com/pgte/skiff) persistence provider.

## Install

```bash
$ 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:

```javascript
'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

---
_Source: https://npm.io/package/abstract-skiff-persistence · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
