messagetype module

module messagetype

Module containing message type definitions.

Exported constant settings:
  • DATA containing the possible settings for a DATA message

  • COMMAND containing the possible settings for a COMMAND message

  • LOG containing the possible settings for a LOG message

  • MESSAGE_TYPE containing the possible settings for a all message types

type MessageTypeSetting

This type represents a setting for a message type.

Parameters:
  • id – The unique identifier for the message type setting.

  • name – The name of the message type setting.

  • required_fields – A list of field names that are required for a message of this type.

  • optional_fields – A list of field names that are optional for a message of this type.

function check_fields(cls::MessageTypeSetting, msg_content::Dict)

Checks if the given message content contains all of the required fields for this message type.

Parameters:
  • cls – A MessageTypeSetting.

  • msg_content – A dictionary containing the fields and values for the message.

Returns:

True if the message content contains all of the required fields, False otherwise.

Return type:

bool

abstract MessageMainType

Abstract type to define a set of MessageTypeSettings.

function by_id(cls::MessageMainType, id::String)

Returns the message type setting with the given id from the given class, or None if no such setting exists.

Parameters:
  • cls – A MessageMainType.

  • id – The unique identifier of the message type setting to return.

  • cls – The class to search for the message type setting.

Returns:

The message type setting with the given id, or None if no such setting exists.

Return type:

MessageTypeSetting or None

type data_struct<: MessageMainType

The type to define the possible settings for a DATA message.

Parameters:
  • FORWARD – MessageTypeSetting for forward messages.

  • GRADIENT – MessageTypeSetting for gradient messages.

  • REWARD – MessageTypeSetting for reward messages.

  • TEXT – MessageTypeSetting for text messages.

  • CUSTOM – MessageTypeSetting for custom messages.

type command_struct<: MessageMainType

The type to define the possible settings for a COMMAND message.

Parameters:
  • REGISTER – MessageTypeSetting for regsiter messages.

  • DISCONNECT – MessageTypeSetting for disconnect messages.

  • JOINROOM – MessageTypeSetting for join room messages.

  • LEAVEROOM – MessageTypeSetting for leave room messages.

  • ENABLELOGGING – MessageTypeSetting for messages to enable logging.

  • DISABLELOGGING – MessageTypeSetting for messages to disable logging.

  • SAVEMODELWEIGHTS – MessageTypeSetting for messages to save model weights.

  • LOADMODELWEIGHTS – MessageTypeSetting for messages to load model weights.

  • SAVESETTINGS – MessageTypeSetting for save settings messages.

  • LOADSETTINGS – MessageTypeSetting for load settings messages.

  • CUSTOM – MessageTypeSetting for custom messages.

type log_struct<: MessageMainType

The type to define the possible settings for a LOG message.

Parameters:
  • MODELWEIGHTS – MessageTypeSetting for log mdoel weights messages.

  • SETTINGS – MessageTypeSetting for log settings messages.

  • MESSAGE – MessageTypeSetting for messages to log messages.

  • KPI – MessageTypeSetting for messages to log KPIs.

  • RUN – MessageTypeSetting for messages to log runs.

  • CUSTOM – MessageTypeSetting for custom messages.

type messagetype_struct

The type to define the possible settings for a all message types.

function by_id(cls::messagetype_struct, id::String)

Returns the message type setting with the given id, or None if no such setting exists.

Parameters:
  • cls – A messagetype_struct.

  • id – The unique identifier of the message type setting to return.

Returns:

The message type setting with the given id, or None if no such setting exists.

Return type:

MessageTypeSetting or None