package shuttle

  1. Overview
  2. Docs

Module Shuttle.Input_channelSource

Alternative to Async_unix.Reader, based on the low latency transport in async_rpc.

Sourcetype 'a handle_chunk_result = [
  1. | `Stop of 'a
    (*

    Stop a indicates that the read loop's handler consumed 0 bytes and that the read loop should stop.

    *)
  2. | `Continue
    (*

    Continue indicates that the read loop's handler consumed some bytes, and would like to keep reading.

    *)
]
Sourceval sexp_of_handle_chunk_result : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a handle_chunk_result -> Ppx_sexp_conv_lib.Sexp.t
Sourcetype t
Sourceval sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
Sourceval create : ?buf_len:int -> Async_unix.Fd.t -> t
Sourceval is_closed : t -> bool
Sourceval closed : t -> unit Async_kernel.Deferred.t
Sourceval close : t -> unit Async_kernel.Deferred.t
Sourceval read_one_chunk_at_a_time : t -> on_chunk:(Bytebuffer.t -> 'a handle_chunk_result) -> [ `Stopped of 'a | `Eof | `Eof_with_unconsumed of Core.Bigstring.t ] Async_kernel.Deferred.t

read_one_chunk_at_a_time ~on_chunk reads bytes into the reader's internal buffer, and calls on_chunk whenever there is data available.

Sourceval drain : t -> unit Async_kernel.Deferred.t

drain t reads chunks of data from the reader and discards them.

Sourceval pipe : t -> string Async_kernel.Pipe.Reader.t

pipe returns a reader pipe that contains the results of reading chunks from an input_channel.

Sourceval transfer : t -> string Async_kernel.Pipe.Writer.t -> unit Async_kernel.Deferred.t

transfer will read chunks from an input channel and write them to the provided writer end of an async pipe. The deferred returned by the function will be determined on EOF or if the writer is closed. Use transfer in scenarios where pipe is needed, but if there is a need to not close the channel automatically once the transfer is finished.

Sourceval of_pipe : Core.Info.t -> string Async_kernel.Pipe.Reader.t -> t Async_kernel.Deferred.t
OCaml

Innovation. Community. Security.