Module Peer.Id

Module for representing peer's ID and collections built around the ID (Map, Set, ...).

type t;

The type for ID.

let compare: t => t => int;

compare(a, b) lexicographically compares ids a and b.

let equal: t => t => bool;

equal(a, b) tests whether the ids a and b contain equal IDs.

let toString: t => string;

toString(id) returns string representation of the ID.

let ofString: string => option(t);

ofString(idStr) creates a new ID out of idStr string. idStr must have a non-zero length. Returns None in case of invalid ID.

let ofStringExn: string => t;

Same as ofString but raises InvalidPeerIdString exception in case of invalid ID.

module Map: OcamlDiff.Map.S with type Map.key = t;

Universal Map that uses peer ID as a key.

module Set: OcamlDiff.Set.S with type Set.elt = t;

Set of peer IDs.