package mnet

  1. Overview
  2. Docs

Module KeSource

Sourcetype t

Type of a ringbuffer.

Utilities.

Length of a ring buffer must be a power of two. Here we have few functions to help to user to generate a power of two value or to check if a value is a power of two. Due to this constraint, a ring buffer can not be larger than max_ke_length (otherwise, we raise an exception).

Sourceval is_power_of_two : int -> bool
Sourceval to_power_of_two : int -> int
Sourceval max_ke_length : int

Ringbuffer.

Sourceval create : ?limit:int option -> int -> t
Sourceval unsafe_create : ?limit:int option -> int -> t
Sourceval push : t -> string -> unit
Sourceval peek : t -> string option
Sourceval peek_into : t -> (bytes -> off:int -> len:int -> unit) -> unit
Sourceval peek_into_bytes : t -> ?off:int -> ?len:int -> bytes -> int
Sourceval length : t -> int
Sourceval shift : t -> int -> unit
Sourceval unsafe_shift : t -> int -> unit
Sourceval available : t -> int
Sourceval compress : t -> unit