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

@swarm/ron-uuid

v0.1.1

Published

A Swarm Replicated Object Notation UUID variant

Downloads

7

Readme

UIDs

(from https://github.com/gritzko/swarm-ron-docs/tree/2.0)

Swarm RON UIDs are roughly equivalent to RFC4122 Version 1 UUIDs. These are 128-bit logical timestamps serving as globally unique identifiers to anything. RON UIDs employ different formats mostly to achieve better compression.

Regular RON UIDs have two components: time (calendar time) and origin (process/replica id). Both parts are 64-bit ints. Transcendent UIDs have origin of 0. Those are global constants precisely defined mathematically, hence independent of any origin or time.

As UIDs are extensively used in the protocol, the format is made as compact as possible, while preserving human readability. RON UIDs are serialized in Base64 instead of decimal or hex. Also, the full 128-bit bit capacity is often excessive, so unnecessary tail bits are zeroed and trimmed.

UIDs are serialized to Base64 as two Base64x64 ints using - as a pair separator, e.g. 1CQKneD1-X~ (time 1CQKneD1, origin replica id X~).

Time part format

Swarm timestamps are Gregorian calendar based, not milliseconds-since-epoch because they are hybrid (logical, but calendar-aware). Intuitive understanding of timestamps is a higher priority than easy calculation of time intervals.

Timestamp values have the MMDHmSssnn format. Namely, ten 6-bit values encode months-since-epoch, days, hours, minutes, seconds, milliseconds and an additional sequence number. The resulting bit loss is tolerable (no month is 64 days long). In case of Base64 serialization, those ten positions correspond to ten Base64 chars. With binary serializations, those are lower 60 bits of a 64-bit integer.

The resulting resolution is ~4mln timestamps per second, which is often excessive. It is OK to shorten timestamps by zeroing the tail (sequence number, milliseconds, etc). For example, 1CQAneD is 7 chars and 1CQAn is 5 chars (MMDHm, no seconds - Fri May 27 20:50:00 UTC 2016)

Time value of ~ means "infinity"/"never". Time value of ~~~~~~~~~~ means "error".

Origin part format

In general, RON accepts any 60-bit globally unique replica identifiers. It is OK to use MAC addressses or random numbers.

Still, it is strongly recommended to use hierarchical replica ids of four parts: peer id, server id, user id and session id bits. For example, in the 0163 scheme, replica id Xgritzk0_D has server id X, user id gritzk and session id 0_D.

Theoretically, Swarm RON UIDs are based on a product of two very basic models: Lamport timestamps and process trees. It is like sequential processes (replicas) exchanging messages asynchronously AND those processes can fork off child replicas.

Transcendent UID format

Transcendent values use arbitrary 60-bit values. Typically, those are short human-readable strings in Base64x64, e.g. inc, sum, txt and so on. A bit counter-intuitively, all such constants (like reducer UIDs) are very big numbers. For example, inc decodes to 824893205576155136.