seq-file
A module for storing the ever-increasing sequence files when following couchdb _changes feeds.
Saves the sequence ID in an atomic way, so that it doesn't clobber the file if it crashes mid-save. Only does a single save at a time, so you can bang on it repeatedy, and it'll avoid doing unnecessary file IO or weird cases where two writes cross paths in odd ways.
USAGE
var SF = var s = 'sequence.seq' sconsole // 10s // won't actually save, because still saving the 10console // 11. You get the idea. // some time in the future, another change comes ins // oh no! crash while saving!sthrow 'pwn' // file now contains "21", not ""
OPTIONS
- frequency: modify how frequently a sequence number is saved.
var SF = var s = 'sequence.seq's // this won't save (we only save every 4 increments).s // this will totally save.