Revision d17dc44c2ddcee89538b2a6e112b71080738b3ce authored by Ilias Garnier on 06 April 2023, 10:04:03 UTC, committed by Marge Bot on 12 April 2023, 07:06:24 UTC
1 parent 14cc146
committee_cache.mli
(*****************************************************************************)
(* *)
(* Open Source License *)
(* Copyright (c) 2023 Marigold <contact@marigold.dev> *)
(* *)
(* Permission is hereby granted, free of charge, to any person obtaining a *)
(* copy of this software and associated documentation files (the "Software"),*)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)
(* and/or sell copies of the Software, and to permit persons to whom the *)
(* Software is furnished to do so, subject to the following conditions: *)
(* *)
(* The above copyright notice and this permission notice shall be included *)
(* in all copies or substantial portions of the Software. *)
(* *)
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)
(* DEALINGS IN THE SOFTWARE. *)
(* *)
(*****************************************************************************)
(** Cache for the DAL committee. *)
type t
(** Represents shard indexes from [start_index] to [start_index + offset - 1]. *)
type shard_indices = {start_index : int; offset : int}
(** [create ~max_size] returns an empty cache. If the cache size exceeds [max_size],
committees of old [level]s are removed in FIFO order. *)
val create : max_size:int -> t
(** [find t ~level] returns shard indexes that is assigned to the at level [level].
When the committee for block level [level] is not stored in the cache it returns [None]. *)
val find :
t ->
level:int32 ->
shard_indices Tezos_crypto.Signature.Public_key_hash.Map.t option
(** [add t ~level ~committee] adds the committee [committee] for level [level].
If the committee for [level] already exists in the cache, it is removed and
replaced by the given [committee]. *)
val add :
t ->
level:int32 ->
committee:shard_indices Tezos_crypto.Signature.Public_key_hash.Map.t ->
unit
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...