npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

histo-revisions

v0.0.2

Published

peer-to-peer synchronizable database written in javascript

Downloads

1

Readme

#histo-revisions Build Status

NPM

A database that tracks changing revisions of data.

Each revision is accessible through a unique ref which is based on a cryptographic hash of the data's content and history. A ref is similar to a git commit hash.

Each written data object is combined with a link to its ancestors - the combination is called a revision. A revision can be compared to a git commit object.

Revisions look like this:

{
  ancestors: ['someref'],
  data: 'some data'
}

The cryptographic hash of the revision is its ref.

##Documentation

###require('histo-revisions') -> revisions

{
  name: 'your-db-name', // will generate uuid if omitted
  revisionStore: revStore,
  branchStore: branchStore
}

With revStore being an object with a content-addressable store interface:

  • put(data, cb): should write some data and responds with a unique identifier of the data in the callback
  • get(identifier, cb): should respond with the data in the callback
  • del(identifier, cb): should delete the data for the specified identifier

branchStore is expected to be a simple key-value store interface:

  • put(key, value, cb)
  • get(key, cb)
  • del(key, cb)

The difference is computed using the graph-difference module.

The common ancestor is computed using the ancestor module.

  • name
  • head(cb)
  • refDifference(fromRef, toRef, cb)
  • createStream(refs) -> stream

targetDB requires the following set of functions:

  • head(cb)
  • remoteHead(remoteName, cb)
  • writeStream(stream, cb)
  • setRemoteHead(remoteName, ref, cb)
function readRemoteRev(db, remoteName, cb) {
  db.remoteHead(remoteName, function(err, remoteHead) {
    db.get(remoteHead, function(err, remoteData) {
      cb(null, {head: remoteHead, data: remoteData});
    });
  });
}

function readLocalRev(db, cb) {
  db.head(function(err, localHead) {
    db.get(localHead, function(localData) {
      cb(null, {head: localHead, data: remoteData});
    });
  });
}

readRemoteRev(targetDB, 'your-remote-name', function(err, remoteRev) {
  readLocalRev(targetDB, function(err, localRev) {
    var mergedData = yourMergeFunction(remoteRev.data, localRev.data);
    var ancestors = [remoteRev.head, localRev.head];
    targetDB.put(mergedData, ancestors, function(err, mergedRef) {
      targetDB.setHead(mergedRef, localRev.head, function(err) {
        // on err repeat merging with new local head
      });
    });
  });
});

##Todo

  • list of remotes
  • garbage collect history

##Contributors This project was created by Mirko Kiefer (@mirkokiefer).