@npmcorp/seq-save

2.0.1 • Public • Published

seq-save

Save CouchDB sequence #s to a configurable backend. This allows you to resume CouchDB replication from the point where you left off.

see also: changes-stream.

This is a replacement to seq-file, adding support for additional backends.

API

  • SeqSave(path, opts): where path is the path on disk to save the file to or the key to use for an alternative backend, such as etcd. Returns a new sequence saving instance.
  • <Promise> save.save(sequence): save the sequence to the configured backend. Returns a Promise which will resolve once the value is saved.
  • <Promise> save.read(): Returns a Promise that will resolve with the current sequence #.

Backends

File (Default)

To save sequence files to the filesystem, simply provide the following configuration:

const SeqSave = require('seq-save')
const seq = new SeqSave('my-sequence.seq', {
  type: 'file'
})

It's worth noting that file is the default backend, so you can also simply provide an empty configuration object..

etcd

To save sequence files to etcd, simply provide the following configuration:

NOTE: if you specify a path in the etcd backend that begins with a leading dot character ., it will be removed.

const Save = require('seq-save')
const seq = new SeqSave('my-sequence.seq', {
  type: 'etcd',
  host: 'http://127.0.0.1:2379'
})

/@npmcorp/seq-save/

    Package Sidebar

    Install

    npm i @npmcorp/seq-save

    Weekly Downloads

    4

    Version

    2.0.1

    License

    ISC

    Unpacked Size

    8.89 kB

    Total Files

    11

    Last publish

    Collaborators

    • shmam
    • dipeshpatel01
    • kartykp
    • jithinpg
    • reggi
    • karenjli
    • tayvongh
    • navin22
    • dhei
    • tiagonbotelho
    • hashtagchris
    • nishantms
    • feelepxyz.github
    • monishcm
    • jumoel
    • trevrosen
    • fritzy
    • npm
    • npmci
    • saquibkhan
    • gar
    • mylesborins