2017-03-07 00:32:15 -08:00
|
|
|
#ifndef ERROR_TABLE_H
|
|
|
|
#define ERROR_TABLE_H
|
|
|
|
|
|
|
|
#include "db.h"
|
|
|
|
#include "table.h"
|
|
|
|
|
2018-03-19 20:24:35 -07:00
|
|
|
/// Data that is needed to push an error.
|
2017-03-07 00:32:15 -08:00
|
|
|
typedef struct {
|
2018-03-19 20:24:35 -07:00
|
|
|
/// The ID of the driver to push the error to.
|
2017-03-07 00:32:15 -08:00
|
|
|
DBClientID driver_id;
|
2018-03-19 20:24:35 -07:00
|
|
|
/// An index into the error_types array indicating the type of the error.
|
|
|
|
int error_type;
|
|
|
|
/// The key to use for the error message in Redis.
|
|
|
|
UniqueID error_key;
|
|
|
|
/// The length of the error message.
|
|
|
|
int64_t size;
|
|
|
|
/// The error message.
|
|
|
|
uint8_t error_message[0];
|
2017-03-07 00:32:15 -08:00
|
|
|
} ErrorInfo;
|
|
|
|
|
2018-03-19 20:24:35 -07:00
|
|
|
/// An error_index may be used as an index into error_types.
|
2017-03-07 00:32:15 -08:00
|
|
|
typedef enum {
|
2018-03-19 20:24:35 -07:00
|
|
|
/// An object was added with a different hash from the existing one.
|
2017-03-07 00:32:15 -08:00
|
|
|
OBJECT_HASH_MISMATCH_ERROR_INDEX = 0,
|
2018-03-19 20:24:35 -07:00
|
|
|
/// An object that was created through a ray.put is lost.
|
2017-03-21 00:16:48 -07:00
|
|
|
PUT_RECONSTRUCTION_ERROR_INDEX,
|
2018-03-19 20:24:35 -07:00
|
|
|
/// A worker died or was killed while executing a task.
|
2017-04-06 00:02:39 -07:00
|
|
|
WORKER_DIED_ERROR_INDEX,
|
2018-03-19 20:24:35 -07:00
|
|
|
/// An actor hasn't been created for a while.
|
|
|
|
ACTOR_NOT_CREATED_ERROR_INDEX,
|
|
|
|
/// The total number of error types.
|
2017-03-07 00:32:15 -08:00
|
|
|
MAX_ERROR_INDEX
|
|
|
|
} error_index;
|
|
|
|
|
2017-10-12 21:00:23 -07:00
|
|
|
extern const char *error_types[];
|
2017-03-07 00:32:15 -08:00
|
|
|
|
2018-03-19 20:24:35 -07:00
|
|
|
/// Push an error to the given Python driver.
|
|
|
|
///
|
|
|
|
/// \param db_handle Database handle.
|
|
|
|
/// \param driver_id The ID of the Python driver to push the error to.
|
|
|
|
/// \param error_type An index specifying the type of the error. This should
|
|
|
|
/// be a value from the error_index enum.
|
|
|
|
/// \param error_message The error message to print.
|
|
|
|
/// \return Void.
|
2017-03-07 00:32:15 -08:00
|
|
|
void push_error(DBHandle *db_handle,
|
|
|
|
DBClientID driver_id,
|
2018-03-19 20:24:35 -07:00
|
|
|
int error_type,
|
|
|
|
const std::string &error_message);
|
2017-03-07 00:32:15 -08:00
|
|
|
|
|
|
|
#endif
|