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

rinzler

v0.0.2

Published

A Cassandra connection pooling agent that supports node rediscovery and health checks.

Downloads

8

Readme

Rinzler

Rinzler is a Cassandra connection pooling agent that supports node rediscovery and health checks. Rinzler uses the node-cassandra-cql driver.

$ npm i rinzler

API

rinzler(seedNode, options)

Constructs a Cassandra discovery pool.

  • seedNode (String): Specifies a {host}:{port}-formatted discovery seed node, where {host} may be a host name, IPv4 address, or IPv6 address. IPv6 addresses must be enclosed in square brackets if a port number is specified (e.g., [::1]:9042). If a port is not specified, it will default to 9042.

options is an object that may contain the following fields:

  • pingInterval (Number >= 0): The health check interval, expressed in milliseconds. Defaults to 5 seconds.
  • discoveryInterval (Number >= 0): The ring rediscovery interval, expressed in milliseconds. Defaults to 30 seconds.
  • maxRetries (Number >= 0): The maximum number of times to retry failed health checks. Defaults to 5 attempts.
  • retryDelay (Number >= 0): The scaling delay for exponential backoff when retrying failed health checks, expressed in milliseconds. Defaults to 20 ms.
  • maxDelay (Number >= 0): The maximum delay between retried health checks, expressed in milliseconds. Defaults to 2.5 seconds.
  • lookupSeed (Boolean): Specifies whether a second query should be executed against one of the seed node's peers to discover the IP address of the seed node. This is useful if the seed node is a load balancing proxy.
var rinzler = require('rinzler');

var discoveryPool = rinzler('cassandra.discovery.example.net:9042', {
    pingInterval: 5000,
    discoveryInterval: 30000,
    maxRetries: 5,
    retryDelay: 20,
    maxDelay: 2500,
    lookupSeed: true
});

discoveryPool.connect(callback)

Opens a connection to the seed node, retrieves a list of nodes in the associated Cassandra ring, and constructs a node-cassandra-cql Client instance with the resulting nodes. Yields (error, client) to the callback. Emits connect and connectError events. If a connectError listener is not attached, an error event will be emitted instead. Multiple successive calls to #connect() will be debounced. If the pool is already connected, the callback will be called on the next tick.

discoveryPool.ping(callback)

Pings a node in the Cassandra connection pool to verify that the pool can respond to queries. The ping will be retried using exponential backoff if necessary. Yields (error, keyspaceNames) to the callback. Emits ping and pingError events, and error events if no pingError listeners are attached.

discoveryPool.rediscover(callback)

Rediscovers all nodes in the Cassandra ring. Stale connections will be removed from the pool and closed; new connections will be opened before being added to the pool. All prepared queries executed on any stale connections will be cleaned up. Yields (error) to the callback. Emits discover and discoverError events, following the same policy for the error event as #connect() and #ping().

discoveryPool.close()

Closes the Cassandra connection pool and cleans up any associated timers and listeners. Emits a close event.

discoveryPool.health(callback)

Retrieves the health status for each node in the connection pool. Yields (error, healthInfo) to the callback, where healthInfo is a tuple in the form of { healthy: [String...], unhealthy: String[...] }.

License

MIT.