Module Octogram.Global_variables

This modules introduces the table of global variables which can is manipulated by jobs.

type var

The contents of a global variable.

type ty =
  1. | String
  2. | Int
  3. | Bool

The possible types of a global variable, when it exists. If it does not, the global variable is assumed to be null.

type update = {
  1. key : string;
  2. value : string option;
  3. var_type : ty;
}

The description of an update to apply to the table of global variables.

type t
val empty : t
val merge : t -> t -> t

merge old_vars new_vars creates a new set of global variables where the the variables contained in new_vars are added to old_vars, and replace them in case of conflicts. That is, if a variable exists both in old_vars and new_vars, then the value in new_vars is kept.

Accessors

val get : t -> string -> var
val update : t -> update -> t

update vars u applies the update encoded in u to the table of global variables vars. If u.value = None, then the variable u.key is removed from the table.

Templates conversions

The table of global variables is used in conjunction with Jingoo’s template to easily customize jobs based on the dynamic state curated by these states.

val tvalue_of_var : var -> Jingoo.Jg_types.tvalue
val tvalue_of_vars : t -> Jingoo.Jg_types.tvalue

Encodings

val encoding : t Data_encoding.t
val var_encoding : var Data_encoding.t
val updates_encoding : update list Data_encoding.t