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

tallship-manifest

v0.1.12

Published

High availability service management - a list of the cargo carried by a ship, made for the use of various agents and officials at the ports of destination.

Downloads

8

Readme

tallship-manifest

High availability service management

build status

RAND: Ship's manifests, sir. I think they're in order now. KIRK: Thank you, Yeoman.

-- A list of the cargo carried by a ship, made for the use of various agents and officials at the ports of destination.

Each manifest on the network will maintain (eventually consistent) information on the services available.

methods

var Manifest = require('tallship-manifest');

A manifest may exist in client mode or server mode or both. Cyclic connections have no effect on the network (other than the increase in data being transmitted around the network).

var m = Manifest(opts)

Create a new manifest instance.

opts can be used to set the following properties:

  • registrationLifetime - amount of time a registration is valid before it expires in milliseconds [5000];
  • heartbeatInterval - how often to send (renew) registrations [5000];

var socket = manifest.connect(opts)

Connect to a manifest server.

Note: Connections to more than one server are permitted and are encouraged for high availability.

opts should include a host and port.

Default:

{port: 3100, host: '0.0.0.0'}

Returns: socket - the high level socket (wrapper around net.Socket)

var socket = manifest.createServer(opts)

Create a server for other manifest clients to connect to.

opts should include a host and port.

Default:

{port: 3100, host: '0.0.0.0'}

Returns: socket - a net.Socket

var service = m.register(role, data)

Register a service on the network.

role - the role the service will play on the network. Should be in the form name@semver.

data - optional data to include in the record. (Warning: Keep it small, this gets broadcast a lot)

Note: If you want to use the address of this host, set { address: null }, this will wait until the manifest instance is actively listening for connections before setting the address and registering the service.

Optionally - role may instead be an Object that contains the necessary service information.

var service = m.free(service)

Free (unregister) a service on the network. You must be the owner of the service to free it.

service - object must include either an id or a port or both

ie:

{id: 'ASDNX93WX9XX', port: '3001'}

Returns the service object removed from the network, or undefined if it does not exist.

var services = m.services()

Returns a copy of the underlying service database for the services on the network.

example:

 {
   BDE40A1384EA8E955D3DFC: {
     role: '[email protected]',
     id: 'BDE40A1384EA8E955D3DFC',
     address: '127.0.0.1',
     port: 4100,
     owner: '7190E29DE507F838D0F28ECD',
     timestamp: 1394636407332
   },
   '521FA1549183337802DE531F': {
     role: '[email protected]',
     id: '521FA1549183337802DE531F',
     address: '127.0.0.1',
     port: 3100,
     owner: '54FA7DD59B31D4971FF4311F',
     timestamp: 1394636405385
   },
   '0EAB299D4C21E21F5887CE65': {
     role: '[email protected]',
     address: '127.0.0.1',
     id: '0EAB299D4C21E21F5887CE65',
     owner: '7190E29DE507F838D0F28ECD',
     timestamp: 1394636407332
   }
 }

var services = m.get(role)

Returns a copy of the underlying services that match role.

role can be a formatted as [email protected], example, or a (partial) service object '{ role: "example" }'.

example => m.get('manifest'):

 {
   BDE40A1384EA8E955D3DFC: {
     role: '[email protected]',
     id: 'BDE40A1384EA8E955D3DFC',
     address: '127.0.0.1',
     port: 4100,
     owner: '7190E29DE507F838D0F28ECD',
     timestamp: 1394636407332
   },
   '521FA1549183337802DE531F': {
     role: '[email protected]',
     id: '521FA1549183337802DE531F',
     address: '127.0.0.1',
     port: 3100,
     owner: '54FA7DD59B31D4971FF4311F',
     timestamp: 1394636405385
   }
 }

m.close()

Closes all the upstream and downstream sockets.

Emits close event when finished.

events

m.on('register', function (service) {})

Emitted whenever a new service is registered.

m.on('free', function (service) {})

Emitted whenever a service is freed (unregistered).

m.on('close', function (service) {})

Emitted when the sockets have all been closed after calling m.close().

m.on('connect', function () {})

Emitted after a connect() to a manifest.

m.on('connection', function (net.Socket) {})

Emitted after another manifest connects to this manifest, --when an incoming connection has been made.

m.on('sync', function (net.Socket) {})

Emitted after the initial handshake. At this point, the registry will contain any services that were in the remote registry when the connection was established. --The remote registry sends a copy of their registry during the handshake.

m.on('heartbeat', function () {})

Emitted after each heartbeat. This becomes useful when you want to know when / ensure any new registrations have been broadcast.

Thanks

  • Heavily inspired by https://github.com/substack/seaport
  • Built on top of https://github.com/visionmedia/axon
  • and https://github.com/visionmedia/node-amp-message

License

(The MIT License)

Copyright (c) 2014 Nick Poorman [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.