package octez-l2-libs

  1. Overview
  2. Docs
Octez layer2 libraries

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/octez-l2-libs.webassembly-interpreter/Tezos_webassembly_interpreter/Input_buffer/index.html

Module Tezos_webassembly_interpreter.Input_buffer

This module implements a FIFO queue to model the input. The messages are queued in an input_buffer in their order of appearance in the inbox.

type message = {
  1. raw_level : int32;
  2. message_counter : Z.t;
  3. payload : bytes;
}
val show_message : message -> Ppx_deriving_runtime.string

An element of type t will have a content which is a lazy_vector of messages and a pointer to the number of elements to be able to dequeue. At this point there is no cleanup operation so an input_buffer content will likely have more than num_elements messages (see #3340).

exception Bounds
exception SizeOverflow
exception Cannot_store_an_earlier_message
exception Dequeue_from_empty_queue
val alloc : unit -> t

alloc () returns an empty input_buffer.

val num_elements : t -> Z.t

num_elements buffer is the number of elements of buffer. It is used by dequeue to pick the current message. Note that it is not necessarily equal to the length of the content of the inbox (see #3340).

val reset : t -> unit

reset buffer removes the current contents of the buffer.

val dequeue : t -> message Lwt.t

dequeue buffer pops the current message from buffer and returns it. Note that the input buffer models a FIFO queue so the current message is the oldest in the queue. If the queue is empty it raises Dequeue_from_empty_queue.

val enqueue : t -> message -> unit Lwt.t

enqueue buffer message pushes the given message into the buffer. Note that the message will have to have a higher raw_level/message_counter than than the newest message in the queue. If that fails it will raise the error Cannot_store_an_earlier_message.

val snapshot : t -> t

snapshot buffer returns snapshotted buffer. You can modify original one, snapshotted one will stay untouched

OCaml

Innovation. Community. Security.