package tezos-webassembly-interpreter

  1. Overview
  2. Docs
type output_info = {
  1. outbox_level : int32;
    (*

    The outbox level at which the message exists.

    *)
  2. message_index : Z.t;
    (*

    The index of the message in the outbox.

    *)
}
exception Non_initialized_outbox
exception Already_initialized_outbox
exception Invalid_outbox_limit
exception Full_outbox
exception Outdated_level
exception Invalid_level
exception Invalid_id
exception Invalid_diff
type t = {
  1. outboxes : bytes Messages.t Outboxes.t;
  2. mutable last_level : int32 option;
  3. validity_period : int32;
  4. message_limit : Z.t;
    (*

    Limit of messages per outbox

    *)
}

Set of outboxes of levels last_key - validity_period to last_key.

val level_range : t -> (int32 * int32) option
val first_level : t -> int32 option
val get_outbox_last_message_index : 'a Messages.t -> Z.t option

Predicates on the outboxes

val is_outbox_full : Z.t -> 'a Messages.t -> bool
val is_outbox_available : t -> int32 -> bool
val is_message_available : 'a Messages.t -> Z.t -> bool

Outboxes creation and manipulation

val allocate_outbox : t -> Outboxes.key -> unit
val alloc : validity_period:int32 -> message_limit:Z.t -> last_level:int32 option -> t

alloc ~validity_period ~last_level allocates a new output_buffer. If last_level is Some level, the corresponding outbox is allocated.

val is_initialized : t -> bool

is_initialized buffer returns true if the output buffer has been initialized.

val initialize_outbox : t -> Outboxes.key -> unit

initialize_outbox buffer level initialize the output_buffer with a fresh inbox at the given level.

val move_outbox_forward : t -> unit

move_outbox_forward outboxes increments the last level of the outbox, allocates a new outbox and removes the outbox at the previous first level, according to the validity period.

val push_message : t -> bytes -> output_info Lwt.t

push_message outboxes msg push a new message in the last outbox, and returns the its level and index in the outbox.

val get_outbox : t -> Outboxes.key -> bytes Messages.t Lwt.t
val get_message : t -> output_info -> bytes Lwt.t

get_message outboxes message_info finds a message in the output buffer.

  • raises Outdated_level

    if the outbox is outdated according to the validity period.

  • raises Invalid_id

    if no message with the given id exists in the outbox at this level.

module Internal_for_tests : sig ... end
OCaml

Innovation. Community. Security.