Module type S.NODE_ID

Node ID

type t
val zero : t

zero returns node ID 0

val one : t

one returns node ID 1

val random : unit -> t

random returns a random node ID.

val compare : t -> t -> int

compare a b compares node IDs a & b.

returns
  • 0 if a = b
  • -1 if a < b
  • 1 if b < a
val distance : t -> t -> t

distance a b calculates distance between node IDs a & b.

val distance_ring : t -> t -> int * t

distance_ring a b calculates distance between node IDs a & b.

val to_uint64 : t -> Stdint.Uint64.t

to_uint64 t returns a uint64 representation of node ID t

val to_string : t -> string

to_string t returns a string representation of node ID t

val pp : Stdlib.Format.formatter -> t -> unit

pp fmt t pretty-prints node ID t