Module Node.Make
Parameters
Signature
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 age : t -> int
age t
returns the age of nodet
val version : t -> int
version t
returns the version of node profilet
val trust : t -> float
trust t
returns the trust value associated with nodet
val known : t -> bool
known t
returns whether the nodet
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 profilet
val sim : t -> float
sim t
returns the similarity metric for nodet
val signature : t -> Stdlib.Bytes.t
signature t
returns the signature of node profilet
val compare : t -> t -> int
compare a b
compares IDs of nodesa
&b
. SeeNode_id.compare
val distance : t -> t -> nid
distance a b
calculates distance between IDs of nodesa
&b
. SeeNode_id.distance
val distance_ring : t -> t -> int * nid
distance_ring a b
calculates distance on a ring between IDs of nodesa
&b
. SeeNode_id.distance_ring
val adjust_trust : t -> float -> t
adjust_trust t r
adjusts the trust value of nodet
by multiplying it withr
.
val set_signature : t -> Stdlib.Bytes.t -> t
set_signature t signature
sets the version of node profile tover
.
val to_string : t -> string
to_string t
returns a string representation of nodet
val pp : Stdlib.Format.formatter -> t -> unit
pp fmt t
pretty-prints nodet