Nerfing Powerful Megalomaniacs
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    gossipmonger-memory-storagepublic

    gossipmonger-memory-storage

    Stability: 1 - Experimental

    NPM version

    An in-memory storage engine for Gossipmonger (an implementation of the Scuttlebutt gossip protocol endpoint for real-time peer-to-peer replication).

    Usage

    var GossipmongerMemoryStorage = require('gossipmonger-memory-storage');
    var storage = new GossipmongerMemoryStorage();
     
    var deadPeers = storage.deadPeers();
    var livePeers = storage.livePeers();
     
    storage.put("foo", somePeerFoo);
    var peerFoo = storage.get("foo");

    Tests

    npm test
    

    Overview

    Minimalistic default in-memory storage engine for Gossipmonger.

    Documentation

    MemoryStorage

    Public API

    new MemoryStorage()

    Creates a new MemoryStorage instance.

    memoryStorage.deadPeers()

    • Return: Array An array of peers that are dead (peer.live != true).

    memoryStorage.get(id)

    • id: String Id of peer to get.
    • Return: Object Peer with given id or undefined.

    memoryStorage.livePeers()

    • Return: Array An array of peers that are live (peer.live == true).

    memoryStorage.put(id, peer)

    • id: String Id of peer to put.
    • peer: Object Peer to put into storage.

    Keywords

    none

    install

    npm i gossipmonger-memory-storage

    Downloadsweekly downloads

    48

    version

    0.1.0

    license

    none

    last publish

    collaborators

    • avatar