Inspirel banner

Programming Distributed Systems with YAMI4

3.2 Parameters

The parameters object is a collection of named values. Parameters are used to define payloads for messages and their replies, and also to define configuration options.

A single parameters object can contain zero or more named values of the following types:

The above types are supported in the same way for all programming languages, so that for example parameters created within a Java program can be properly interpreted in C++. This portability is also ensured across hardware with different byte ordering schemes (little-endian and big-endian).

Each entry in the parameters object has a name. In other words, the parameters object can be treated as a map where keys are strings (entry names) and values can be of any type from the list above.

When the parameters object is created it contains no entries and is conceptually similar to an empty map. It still a perfectly valid object and can be used for regular data transmission and for implementing remote invocations that would correspond to the function call with an empty list of arguments.

After the parameters object is created, new entries can be inserted into it, inspected, replaced, removed and iterated.

The whole parameters object can be serialized to a set of binary buffers and deserialized from existing buffers. In most use-cases these actions are handled automatically, but in some specific cases users might want to perform them on demand.

Even though the concept of parameters is implemented with a dedicated API in each supported programming language, a special exception was made for Python, which quite naturally provides a similar functionality at the language level - whenever a parameters object is expected, a regular dictionary object can be passed, which increases readability and can be easier to learn. Still, the dedicated API for controlling parameters object is provided for those users who need complete control over item order and serialization.