Skip to content

protocolclub/tildelink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tildelink

tildelink is a distributed service discovery mechanism. The problem that lead to the creation of tildelink is: how do we allow people to discover services without creating hierarchy or single points of failure?

More concretely, tildelink is a distributed ZeroMQ-based key-value store that maps service names to ZeroMQ endpoints, a daemon that implements this store, and a collection of tools to establish connections from the command line.

Usage

TODO

Installation

tildelink can be installed via OPAM:

opam pin add -y tildelink .

Architecture

All communication in tildelink is done via ZeroMQ.

The central concept of tildelink is the notion of service. A service is a collection of ZeroMQ endpoints and is identified by a tilde:// URI. The URI contains the Curve25519 public key associated with the service; all communication is encrypted.

The discovery service is just another tildelink service.

tilde:// URIs

A tildelink URI is a RFC3986-conformant URI. The schema component must be tilde. The userinfo, port and fragment components must be empty. The query fragment must contain a Curve25519 public key, encoded using Base64 with URL- and filename-safe alphabet (specified in RFC4648). Since any 32 bytes constitute a valid Curve25519 public key, no validation besides length is required.

The host component contains a FQDN that identifies a node. The path component contains an arbitrary string starting with / that identifies a service logically associated with a node; by convention:

  • a path component equal to / identifies a discovery service;
  • all other path components should start with a path segment of the form ~user, where ~user is the name of the user who is maintaining the service; the rest of path segments are arbitrary.

Discovery service

The discovery service is a tildelink service that performs two jobs:

  • it accepts registration and discovery requests from the clients wishing to use the network;
  • it disseminates the updated service mappings among the network.

The discovery service uses the request-reply pattern and JSON for serialization.

The requests are of the form {"version": "<ver>", "command": "<cmd>", ..}, where <cmd> is the command name and .. is command-specific fields. The responses are either of the form {"ok": ..}, where .. is a command-specific value, or {"error": {"code": "<code>", "message": "<msg>"}}, where <code> is a command-specific error code, and <msg> is a human-readable error message.

Currently, <ver> is 1. If the service is unable to recognize the version, an error with code unknown-version is returned.

If the service is unable to parse JSON or required fields are missing, an error with code protocol-error is returned.

Node information

{"version": 1, "command": "node-info"}

{"ok": {"domain": "<domain>"}}

The node information command allows to request metadata from the current node. Currently, only node domain is returned.

Service list

{"version": 1, "command": "service-list"}

{"ok": {"<uri>": [{"host": "<host>", "port": <port>}, ..], ..}

The service list command returns all registered services.

Service discovery

{"version": 1, "command": "discover", "uri": "<uri>"}

{"ok": [{"host": "<host>", "port": <port>}, ..]}

{"error": {"code": "not-found", ..}}

The service discovery command returns the list of endpoints (host:port pairs) associated with the given service.

OCaml API

The documentation for the OCaml API is available online.

License

tildelink is distributed under the terms of MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published