# GENERAL MESSAGES
# These are sent and received by all tightly coupled processes regardless of their type.

# Tightly coupled subprocesses must all greet the core so it knows they are operational and not stuck for example.
MSG_TYPE_GREETING = b"Iam"
# Tightly coupled subprocesses must all send periodic keepalive messages to the core so it knows they are still
# operational and not stuck for example.
MSG_TYPE_KEEPALIVE = b"KPA"
# Configuration update and reset requests to the core. These will be followed up by MSG_TYPE_UPDATED_CONFIG
# broad-casted to all tightly coupled subprocesses.
MSG_TYPE_REQUEST_CONFIG_UPDATE = b"RCU"
MSG_TYPE_REQUEST_CONFIG_RESET = b"RCR"
# This is sent by the core to the children. The payload is the updated config.
MSG_TYPE_UPDATED_CONFIG = b"CNF"
# This is sent by the core to the children before the reset config broadcast. Used for optimizing some procedures.
MSG_TYPE_RESETTING_CONFIG = b"RCF"
# State update request to the core. This will be followed up by MSG_TYPE_UPDATED_CONFIG broad-casted to all
# tightly coupled subprocesses.
MSG_TYPE_REQUEST_STATE_UPDATE = b"RSU"
# Graceful shutdown request sent by the core to the children or by a children to the core for complete shutdown of
# the instance. After a timout the core uses signals to force termination of children.
MSG_TYPE_SHUTDOWN = b"SHD"

# Debug requests
MSG_TYPE_REQUEST_INDEXER_LAST_WORK = b"DBG-IDX-LST-WRK"

# TYPED MESSAGES
# These are to facilitate control of specialized processes in the nano instance.

# Order the gateway to perform a login.
MSG_TYPE_GATEWAY_LOGIN = b"GLN"
# Order the gateway to perform a logout.
MSG_TYPE_GATEWAY_LOGOUT = b"GLT"
# Order the gateway to perform a password change on the current account.
MSG_TYPE_GATEWAY_CHANGE_PASSWORD = b"CPW"

# Order the indexer to perform a sync on the supplied paths.
MSG_TYPE_INDEXER_SYNC = b"IXS"

# Notify the control about the average requests received.
MSG_TYPE_CONTROL_REQ_STATS = b"CRS"
# Notify the control about the indexer's work.
MSG_TYPE_CONTROL_INDEXER_WORK = b"CIW"
# Notify the control about some service error.
MSG_TYPE_CONTROL_SERVICE_ERROR = b"CSE"
