package aws-s3-async

  1. Overview
  2. Docs

Module mimicking Async.Pipe

type ('a, 'b) pipe = ('a, 'b) Async_kernel.Pipe.t

Generic pipe

type 'a writer = 'a Async_kernel.Pipe.Writer.t
type 'a reader = 'a Async_kernel.Pipe.Reader.t
val create_reader : f:('a writer -> unit Deferred.t) -> 'a reader

Create a reader given a function f that fills the reader. Once f completes, the reader is closed

val create_writer : f:('a reader -> unit Deferred.t) -> 'a writer

Create a writer given a function f that reads off the writer. Once f completes, the writer is closed

val create : unit -> 'a reader * 'a writer

Create a reader/writer pipe. Data written to the reader can be read by the writer. Closing one end will close both ends.

val flush : 'a writer -> unit Deferred.t

Flush a writer. The result we be determined once all elements in the pipe has been consumed

val write : 'a writer -> 'a -> unit Deferred.t

Write to a writer. If the writer is closed, the function raises an exception

val close : 'a writer -> unit

Close a writer

val close_reader : 'a reader -> unit

Close a reader

val read : 'a reader -> 'a option Deferred.t

Read one element from a reader. The function will block until an element becomes available or the reader is closed, in which case None is returned

val transfer : 'a reader -> 'a writer -> unit Deferred.t

Transfer all data from the reader to the writer. The function becomes determined when the reader or writer is closed

val is_closed : ('a, 'b) pipe -> bool

Return the state of a pipe

val closed : ('a, 'b) pipe -> unit Deferred.t

Wait for a pipe to be closed. The function is determined once the pipe is closed. the function can be called multiple times.

Note that not all elements may have been consumed yet.

OCaml

Innovation. Community. Security.