Select the types of activity you want to include in your feed.
irmin: add Heap.layer for overlay heaps
Reads fall through from top to bottom; writes and caches go to top. This is the building block for lazy remote navigation: layer a local cache over a remote heap so cursors transparently fetch on miss.
···110110 close = (fun () -> ());
111111 to_seq = (fun () -> List.to_seq blocks);
112112 }
113113+114114+let layer top bottom =
115115+ {
116116+ top with
117117+ find =
118118+ (fun h ->
119119+ match top.find h with
120120+ | Some _ as r -> r
121121+ | None -> (
122122+ match bottom.find h with
123123+ | Some data as r ->
124124+ top.put h data;
125125+ r
126126+ | None -> None));
127127+ mem = (fun h -> top.mem h || bottom.mem h);
128128+ }
+5-2
lib/heap.mli
···8989val of_list : equal:('h -> 'h -> bool) -> ('h * 'v) list -> ('h, 'v, 'b) t
9090(** [of_list ~equal blocks] creates a heap backed by [blocks]. *)
91919292+val layer : ('h, 'v, _) t -> ('h, 'v, _) t -> ('h, 'v, _) t
9393+(** [layer top bottom] reads from [top] first, then [bottom] on miss. Writes go
9494+ to [top]. Found blocks from [bottom] are cached in [top]. *)
9595+9296val to_seq : ('h, 'v, _) t -> ('h * 'v) Seq.t
9393-(** [to_seq heap] enumerates the heap's blocks. For proof subheaps (created by
9494- {!of_list}), returns all blocks. For backend heaps, returns [Seq.empty]. *)
9797+(** [to_seq heap] enumerates the heap's blocks. *)