Parameter Make.3-Node

type t
type nid
val init : ?⁠age:int -> ?⁠version:int -> ?⁠trust:float -> ?⁠known:bool -> ?⁠subs:Bitv.t -> ?⁠sim:float -> ?⁠signature:Stdlib.Bytes.t -> nid -> t

init ?age ?version ?subs ?signature node_id

val id : t -> nid

id t returns the ID of node t

val age : t -> int

age t returns the age of node t

val version : t -> int

version t returns the version of node profile t

val trust : t -> float

trust t returns the trust value associated with node t

val known : t -> bool

known t returns whether the node t is known locally, and thus its trust value was set explicitly

val subs : t -> Bitv.t

subs t returns the subscriptions Bloom filter of node profile t

val sim : t -> float

sim t returns the similarity metric for node t

val signature : t -> Stdlib.Bytes.t

signature t returns the signature of node profile t

val compare : t -> t -> int

compare a b compares IDs of nodes a & b. See Node_id.compare

val distance : t -> t -> nid

distance a b calculates distance between IDs of nodes a & b. See Node_id.distance

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

distance_ring a b calculates distance on a ring between IDs of nodes a & b. See Node_id.distance_ring

val zero_age : t -> t

zero_age t sets the age of node profile to zero.

val set_age : t -> int -> t

set_age t sets the age of node profile to age.

val inc_age : t -> t

inc_age t increments the age of node profile.

val set_version : t -> int -> t

set_version t version sets the version of node profile to version.

val adjust_trust : t -> float -> t

adjust_trust t r adjusts the trust value of node t by multiplying it with r.

val set_trust : t -> float -> t

set_trust t trust sets the trust of node t to trust.

val set_known : t -> bool -> t

set_known t known sets the known flag for node t.

val set_subs : t -> Bitv.t -> t

set_subs t subs sets the Bloom filter with subscriptions to subs.

val set_sim : t -> float -> t

set_sim t sim sets the similarity metric for node t to sim

val set_signature : t -> Stdlib.Bytes.t -> t

set_signature t signature sets the version of node profile to ver.

val inc_version : t -> t

inc_version t version increments the version of node profile t.

val to_string : t -> string

to_string t returns a string representation of node t

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

pp fmt t pretty-prints node t