aboutsummaryrefslogblamecommitdiffstats
path: root/lib/protocols/Cursor.mli
blob: deccf2a42fbdad0cfa8f3ada6531d5afdd1e5a47 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                                                        









                                                                                     

                                                                                               
            
                                                                                                 
 




                                                                         





                                                                      
type batch = {tuples: Concepts.Tuple.t BatFingerTree.t; exhausted: bool}
type t

class type implementation = object
  method fetch : int -> (batch, Concepts.Condition.condition) result
end

val make : #implementation -> Handle.protocol
val from : Handle.t -> t Handle.interface option
val require : Handle.t -> (t Handle.interface, Concepts.Condition.condition) result
val fetch : t Handle.interface -> int -> (batch, Concepts.Condition.condition) result
val next : t Handle.interface -> (Concepts.Tuple.t option, Concepts.Condition.condition) result

val exists :
  t Handle.interface -> (Concepts.Tuple.t -> bool) -> (bool, Concepts.Condition.condition) result

val drain :
  t Handle.interface ->
  ?limit:int ->
  unit ->
  (Concepts.Tuple.t BatFingerTree.t, Concepts.Condition.condition) result

(** [f] over [cursor], which is released once [f] returns. *)
val consuming :
  Handle.t ->
  (t Handle.interface -> ('a, Concepts.Condition.condition) result) ->
  ('a, Concepts.Condition.condition) result