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

obsy

v0.0.7

Published

atomic object/namespace sync across processes using observe and redis

Downloads

16

Readme

ObSy

atomic ObjectSync across nodeJS processes

The idea behind ObSy is that there are many cases where one has different nodeJS processes that need to share 'memory'. ObSy greatly simplifies sharing a namespace/object between processes by turning the task into ONE LINE OF CODE.

how ObSy works

ObSy uses the observed library (the new/upcoming ECMA harmony Object.observe method) to handle changes to a local namespace. Those changes are then sent to a redis instance for persistence and, via publish/subscribe, to other processes that registered the same namespace. Changes are encoded, so that they are (pseudo-) atomic, meaning that changes to a deep property do not require syncing the complete object.

limitations

  • Functions are not synced (no plan of supporting that any time soon).
  • Special objects (using non-standard constructors like e.g. mongoDB ObjectID, ...) are not synced correctly. I am planning to include a 'plugin' system that will allow anybody to handle special object types.
  • when using a direct set to the observed namespace will simply wipe the ObSy handler and thus break the sync.

requirements

ObSy needs nodeJS 0.11+ to work (harmony required to allow Object.observe) and a redis instance reachable from all processes that want to sync the object

planned features

  • plugin system for object constructor helpers
  • option to use passive publishing via redis' built-in Redis Keyspace Notifications

version

0.02 : ObSy is really young and innocent. it's hardly tested and not at all optimized. better test coverage is next on the ToDo list (see issues).

installing

npm install obsy

tests

make

example

var ObSy = require('obsy');
var someParentNamespace = {
	syncedObject: {}
};
var myObjectSync = new ObSy('theNameOfYourSyncGroup', someParentNamespace.syncedObject);

demo

assuming you have n installed AND screen / multiple terminals running AND a local redis instance :

$ cd demo
$ n use 0.11.12 --harmony node0.js
// switch to new terminal quickly !
$ n use 0.11.12 --harmony node1.js
// with debug active you will see both nodes syncing the demo namespace ... 
// kind of feels like magic to me ;)