Created
April 18, 2018 23:47
-
-
Save d3x0r/9dbbb5d75504b83971bafb75972db07b to your computer and use it in GitHub Desktop.
A no-op storage driver for gun, in case gun has no other storage; at least one ack from a storage device is required for the engine to work....
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gun.on('opt', function(ctx){ | |
const ACK_ = '@'; | |
const SEQ_ = '#'; | |
var gun = ctx.gun; | |
this.to.next(ctx); | |
ctx.on('put', function(at) { | |
this.to.next(at); | |
ctx.on('in', {[ACK_]: at[SEQ_], gun:gun, ok: 1}); | |
}); | |
ctx.on('get', function(at){ | |
this.to.next(at); | |
ctx.on('in', {[ACK_]: at[SEQ_], gun:gun, err: "no data"}); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Untested; but it should basically work.... I can work with you to fix it if you find it totally flawed.