Module Incr_map_collate

module Collate_params : sig ... end
module Collated : sig ... end
module Store_params = Incr_memoize.Store_params
module Instrumentation : sig ... end
module Compare : sig ... end
module Fold : sig ... end
type ('k, 'v, 'cmp, 'fold_result, 'w) t
val collate : ?operation_order:[ `Filter_first | `Sort_first ] -> ?instrumentation:Instrumentation.t -> filter_equal:('filter -> 'filter -> bool) -> order_equal:('order -> 'order -> bool) -> filter_to_predicate:('filter -> (key:'k -> data:'v -> bool) option) -> order_to_compare:('order -> ('k, 'v, 'cmp) Compare.t) -> (('k, 'v, 'cmp) Core.Map.t, 'w) Incremental.t -> (('k, 'filter, 'order) Collate_params.t, 'w) Incremental.t -> ('k, 'v, 'cmp, unit, 'w) t @@ portable

Perform filtering, sorting and restricting to ranges.

The Collate_params.t Incr.t contains the parameters for filtering and sorting, and ranges. It can be updated incrementally, but note that filtering & sorting isn't really incremental on filter & order since we bind to these.

For sorting & filtering, technically all this function should need is a compare function and a filtering predicate. However, the interface is slightly different: we require users to provide 'filter and 'order opaque types in Collate_params.t, and ways to convert them to predicate & compare here.

It is done this way for better interaction with Incr. We believe that most users would have such types, being simple algebraic data types, anyways. You can always set e.g. filter_to_predicate=Fn.id, and just pass the functions directly, but be prepared to explore the fascinating world of functions' physical equality.

val collate_and_fold : ?operation_order:[ `Filter_first | `Sort_first ] -> ?instrumentation:Instrumentation.t -> filter_equal:('filter -> 'filter -> bool) -> order_equal:('order -> 'order -> bool) -> filter_to_predicate:('filter -> (key:'k -> data:'v -> bool) option) -> order_to_compare:('order -> ('k, 'v, 'cmp) Compare.t) -> fold:('k, 'v, 'fold_result) Fold.t -> (('k, 'v, 'cmp) Core.Map.t, 'w) Incremental.t -> (('k, 'filter, 'order) Collate_params.t, 'w) Incremental.t -> ('k, 'v, 'cmp, 'fold_result, 'w) t @@ portable
val collated : ('k, 'v, _, 'fold_result, 'w) t -> (('k, 'v) Collated.t, 'w) Incremental.t @@ portable

Gets the collated data produced by a collation function like collate.

val key_rank : ('k, _, _, 'fold_result, 'w) t -> ('k -> int option, 'w) Incremental.t @@ portable

A function for finding the index into the collated map of a particular key. The resulting index is "pre-range-restriction", which means that even if the key is not in the collation range, key_rank can still respond with its index. However, the index is after filtering and ordering, which means that if it is filtered out of the map (or isn't in the original map), then the result will be None.

module Key_rank : sig ... end

This Key_rank module and it's associated key_rank' accessor function are primarily used to allow key ranking to move between threads using OCaml's portability mode. If you dont' care about using Incr_map_collate in a separate thread, then you can ignore this and just use the regular key_rank function.

val key_rank' : ('k, 'v, 'cmp, 'fold_result, 'w) t -> (('k, 'v, 'cmp) Key_rank.t, 'w) Incremental.t @@ portable
val fold_result : (_, _, _, 'fold_result, 'w) t -> ('fold_result, 'w) Incremental.t @@ portable
module With_caching : sig ... end

A version of collate with caching.