package shuttle

  1. Overview
  2. Docs

Module Shuttle.Output_channelSource

module Logger : Async_unix.Log.Global_intf
Sourcetype t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourceval create : ?buf_len:int -> ?write_timeout:Core.Time_ns.Span.t -> ?time_source:[> Core.read ] Async_kernel.Time_source.T1.t -> Async_unix.Fd.t -> t

create ?max_buffer_size ?buf_len ?write_timeout fd creates a new writer.

The writer doesn't flush automatically and the user is responsible for calling flush, which triggers a write system call if needed.

Sourceval write_timeout : t -> Core.Time_ns.Span.t

write_timeout is the maximum amount of time the writer will wait when attempting to write data to the underlying file descriptor.

Sourceval buffer_size : t -> int
Sourceval time_source : t -> Async_kernel.Time_source.t
Sourceval monitor : t -> Async_kernel.Monitor.t

monitor returns the async monitor used by Output_channel for performing all write operations.

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

remote_closed is a deferred that's resolved when the consumer that's reading the bytes written to the Output_channel is closed, i.e. the channel has received an EPIPE or ECONNRESET when it attempts to perform a write.

Sourceval is_closed : t -> bool
Sourceval is_open : t -> bool
Sourceval close_started : t -> unit Async_kernel.Deferred.t
Sourceval close_finished : t -> unit Async_kernel.Deferred.t
Sourceval write_bigstring : t -> ?pos:int -> ?len:int -> Core.Bigstring.t -> unit

write_bigstring copies the bigstring into the channel's internal buffer. It is safe to modify the bigstring once write_bigstring returns.

Sourceval schedule_bigstring : t -> ?pos:int -> ?len:int -> Core.Bigstring.t -> unit
  • deprecated schedule_bigstring will be removed in a future release. Use [write_bigstring] instead.
Sourceval write : t -> ?pos:int -> ?len:int -> string -> unit

write copies the string into the channel's internal buffer. The string will surface the next time the writer schedules a write.

Sourceval write_string : t -> ?pos:int -> ?len:int -> string -> unit
  • deprecated write_string will be removed in a future release. Use [write] instead.
Sourceval write_char : t -> char -> unit
Sourceval writef : t -> ('a, unit, string, unit) Core.format4 -> 'a
Sourceval close : t -> unit Async_kernel.Deferred.t

close will close the underlying file descriptor after waiting for the writer to be flushed.

Sourceval schedule_flush : t -> unit

schedule_flush will schedule a write system call if one is needed.

Sourcemodule Flush_result : sig ... end
Sourceval flushed_or_fail : t -> Flush_result.t Async_kernel.Deferred.t

flushed_or_fail t returns a Deferred that is resolved when all previous writes complete, or if any of the write operations fail.

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

flushed t returns a deferred that will get resolved when all previous writes have finished. Unlike flushed_or_fail if a write call fails then the deferred will never be resolved.

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

flush schedules a write system call if one is needed and returns a deferred that is resolved when all prior writes have finished. If a write call fails then the deferred will never be resolved.

Sourceval flush_or_fail : t -> Flush_result.t Async_kernel.Deferred.t

flush_or_fail schedules a write system call if one is needed and returns a deferred that is resolved when all previous writes complete, or if any of the write operations fail.

Sourceval pipe : t -> string Async_kernel.Pipe.Writer.t
Sourceval of_pipe : ?buf_len:int -> Core.Info.t -> string Async_kernel.Pipe.Writer.t -> (t * unit Async_kernel.Deferred.t) Async_kernel.Deferred.t
OCaml

Innovation. Community. Security.