00001 #ifndef LUX_DIST_PROTOCOL_H
00002 #define LUX_DIST_PROTOCOL_H
00003
00004 #include "lux/lux.h"
00005
00006 #define PACKET_BODY_MAX_BITS 28
00007
00008 namespace Lux {
00009 namespace Dist {
00010
00011
00012
00013 typedef struct {
00014 uint32_t length: PACKET_BODY_MAX_BITS;
00015 uint32_t comp_length: PACKET_BODY_MAX_BITS;
00016 uint32_t command: 8;
00017 } request_header_t;
00018
00019
00020 typedef struct {
00021 uint32_t length: PACKET_BODY_MAX_BITS;
00022 uint32_t comp_length: PACKET_BODY_MAX_BITS;
00023 uint32_t status: 8;
00024 } response_header_t;
00025
00026 #pragma pack(2)
00027 typedef struct {
00028 uint8_t sort_attr;
00029 uint8_t sort_order;
00030 char attr_name[16];
00031 uint16_t num;
00032 uint16_t page;
00033 } search_options_t;
00034
00035 typedef struct {
00036 uint32_t total_num;
00037 uint16_t attr_size;
00038 uint16_t num_results;
00039 } cluster_idx_result_header_t;
00040 #pragma pack()
00041
00042 typedef struct {
00043 uint32_t total_num;
00044 uint16_t base;
00045 uint16_t num;
00046 } proxy_doc_result_header_t;
00047
00048 typedef enum {
00049 COM_QUIT,
00050 COM_FIND,
00051 COM_GET_DOCS,
00052 COM_DISPATCH,
00053 COM_UPDATE
00054 } command_t;
00055
00056 typedef enum {
00057 STATUS_OK,
00058 STATUS_ERR,
00059 STATUS_IDX_RS,
00060 STATUS_DOC_RS,
00061 STATUS_RS
00062 } resp_status_t;
00063
00064 typedef enum {
00065 CLUSTER_ERROR,
00066 RUNTIME_ERROR,
00067 ATTR_INDEX_NOT_FOUND
00068 } err_code_t;
00069
00070 }
00071 }
00072
00073 #endif