add types: SFListLimitInfo and SFProtoLimitInfo

pull/1/head
YuQing 2021-06-29 22:42:02 +08:00
parent a42f9c6376
commit 414f0f1efe
2 changed files with 26 additions and 2 deletions

View File

@ -127,6 +127,11 @@ typedef struct sf_common_proto_header {
char padding[3]; char padding[3];
} SFCommonProtoHeader; } SFCommonProtoHeader;
typedef struct sf_proto_limit_info {
char offset[4];
char count[4];
} SFProtoLimitInfo;
typedef struct sf_proto_get_group_servers_req { typedef struct sf_proto_get_group_servers_req {
char group_id[4]; char group_id[4];
char padding[4]; char padding[4];
@ -476,8 +481,8 @@ int sf_send_and_recv_vary_response(ConnectionInfo *conn,
const int network_timeout, const unsigned char expect_cmd, const int network_timeout, const unsigned char expect_cmd,
SFProtoRecvBuffer *buffer, const int min_body_len); SFProtoRecvBuffer *buffer, const int min_body_len);
static inline void sf_proto_extract_header(SFCommonProtoHeader *header_proto, static inline void sf_proto_extract_header(const SFCommonProtoHeader
SFHeaderInfo *header_info) *header_proto, SFHeaderInfo *header_info)
{ {
header_info->cmd = header_proto->cmd; header_info->cmd = header_proto->cmd;
header_info->body_len = buff2int(header_proto->body_len); header_info->body_len = buff2int(header_proto->body_len);
@ -488,6 +493,20 @@ static inline void sf_proto_extract_header(SFCommonProtoHeader *header_proto,
} }
} }
static inline void sf_proto_pack_limit(const SFListLimitInfo
*limit_info, SFProtoLimitInfo *limit_proto)
{
int2buff(limit_info->offset, limit_proto->offset);
int2buff(limit_info->count, limit_proto->count);
}
static inline void sf_proto_extract_limit(const SFProtoLimitInfo
*limit_proto, SFListLimitInfo *limit_info)
{
limit_info->offset = buff2int(limit_proto->offset);
limit_info->count = buff2int(limit_proto->count);
}
static inline int sf_active_test(ConnectionInfo *conn, static inline int sf_active_test(ConnectionInfo *conn,
SFResponseInfo *response, const int network_timeout) SFResponseInfo *response, const int network_timeout)
{ {

View File

@ -216,6 +216,11 @@ typedef struct sf_memory_watermark {
int64_t high; int64_t high;
} SFMemoryWatermark; } SFMemoryWatermark;
typedef struct sf_list_limit_info {
int offset;
int count;
} SFListLimitInfo;
typedef enum sf_server_group_index_type { typedef enum sf_server_group_index_type {
sf_server_group_index_type_cluster = 1, sf_server_group_index_type_cluster = 1,
sf_server_group_index_type_service sf_server_group_index_type_service