module Nn_blocklist: sig
.. end
Support module for blocklists
module Blockinfo: Mergable
with type key = int64 and type t = Pfs_rpcapi_aux.blockinfo
Keys are indexes!
module BlockRM: RangeMapType
with type point = int64 and type value = Pfs_rpcapi_aux.blockinfo
Represents blocks from a single datanode as (index) ranges start..end
type
blocklist = BlockRM.t Plasma_util.StrMap.t
Common representation of blocklists: This maps datanode identities
to range sets as represented by BlockRM
val to_blocklist : Pfs_rpcapi_aux.blockinfo list -> blocklist
Converts any list of blocks to the official blocklist
representation
val to_blockinfo_list : blocklist -> Pfs_rpcapi_aux.blockinfo list
Returns the blocks for a blocklist
val to_string : blocklist -> string
String repr for debugging
val empty_ticket : Pfs_rpcapi_aux.ticket
A dummy ticket (used during blocklist construction)
Set/map operations on blocklists
val empty : blocklist
an empty blocklist
val sub : int64 * int64 -> blocklist -> blocklist
sub (min,max) blist
: Returns the blocklist with the subset of
blist
that intersects with the interval (min,max)
val remove : int64 * int64 -> blocklist -> blocklist
remove (min,max) blist
: Returns the blocklist where the interval
(min,max)
is deleted
val merge : blocklist -> blocklist -> blocklist
merge blist1 blist2
: Merges both blocklists. If both lists contain
a blockinfo for the same datanode identity and the same block index,
the data from blist2
wins and is included in the resulting
blocklist only. Other than this special case, this operation just
merges the blockinfos from both arguments.
val iter : (string -> int64 * int64 -> Pfs_rpcapi_aux.blockinfo -> unit) ->
blocklist -> unit
iter f blist
: Calls f identity (min,max) bi
for all elementary
ranges that can be compressed to one blockinfo bi
. The
identity
is just the identity from bi
. In min
and max
the
covered range of indexes is passed.
val fold : (string -> int64 * int64 -> Pfs_rpcapi_aux.blockinfo -> 'a -> 'a) ->
blocklist -> 'a -> 'a
Fold operator
val map : (Pfs_rpcapi_aux.blockinfo -> Pfs_rpcapi_aux.blockinfo) ->
blocklist -> blocklist
map f blist
: Returns a blocklist where each element is mapped
via f
val domain : blocklist -> (int64 * int64) list
Returns the list of ranges covered by the blocklist (i.e. the
union of all ranges for all datanode identities)
val cardinal : blocklist -> int64
The number of covered blocks (incl. replicas)