update数据增加evbuffer接口
This commit is contained in:
64
cache/tango_cache_client_in.h
vendored
64
cache/tango_cache_client_in.h
vendored
@@ -9,6 +9,10 @@
|
||||
|
||||
#include "tango_cache_client.h"
|
||||
|
||||
#define RESPONSE_HDR_EXPIRES 1
|
||||
#define RESPONSE_HDR_LAST_MOD 2
|
||||
#define RESPONSE_HDR_ALL 3
|
||||
|
||||
enum CACHE_REQUEST_METHOD
|
||||
{
|
||||
CACHE_REQUEST_GET=0,
|
||||
@@ -26,7 +30,6 @@ enum PUT_OBJECT_STATE
|
||||
{
|
||||
PUT_STATE_START=0,
|
||||
PUT_STATE_WAIT_START,
|
||||
PUT_STATE_START_DONE,
|
||||
PUT_STATE_PART,
|
||||
PUT_STATE_END,
|
||||
PUT_STATE_CANCEL,
|
||||
@@ -39,14 +42,6 @@ struct easy_string
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct cache_buffer
|
||||
{
|
||||
char *buf;
|
||||
size_t len;
|
||||
size_t off;
|
||||
TAILQ_ENTRY(cache_buffer) node;
|
||||
};
|
||||
|
||||
struct tango_cache_instance
|
||||
{
|
||||
char minio_hostlist[4096];
|
||||
@@ -66,64 +61,61 @@ struct tango_cache_instance
|
||||
u_int32_t hash_object_key;
|
||||
};
|
||||
|
||||
struct buffer_cache_list;
|
||||
struct multipart_etag_list
|
||||
{
|
||||
char *etag;
|
||||
u_int32_t part_number;
|
||||
TAILQ_ENTRY(multipart_etag_list) node;
|
||||
};
|
||||
|
||||
struct tango_cache_ctx
|
||||
{
|
||||
CURL *curl;
|
||||
struct curl_slist *headers;
|
||||
struct curl_slist *headers_puts;
|
||||
|
||||
struct future* future;
|
||||
char error[CURL_ERROR_SIZE];
|
||||
char file_key[72];
|
||||
char hostport[24]; //<2F><>ͬctxʹ<78><CAB9><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>IP<49><50><EFBFBD><EFBFBD>֤pipeline˳<65><CBB3><EFBFBD><EFBFBD>
|
||||
|
||||
u_int32_t host_index;
|
||||
u_int32_t part_runing_num;
|
||||
u_int32_t part_index;
|
||||
bool fail_state;
|
||||
|
||||
enum CACHE_REQUEST_METHOD method;
|
||||
enum CACHE_ERR_CODE error_code;
|
||||
|
||||
struct evbuffer *evbuffer;
|
||||
union{
|
||||
enum PUT_OBJECT_STATE put_state;
|
||||
enum GET_OBJECT_STATE get_state;
|
||||
};
|
||||
enum PUT_MEMORY_COPY_WAY way; //PUT ONCEʱ<45>ڴ濽<DAB4><E6BFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool fail_state;
|
||||
u_int32_t part_index;
|
||||
u_int32_t need_hdrs; //<2F><>RESPONSE_HDR_
|
||||
bool close_state; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ùر<C3B9>
|
||||
bool expire_comes;
|
||||
long res_code;
|
||||
time_t relative_age;//Getʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
||||
time_t max_age;//Get
|
||||
time_t min_fresh;//Get
|
||||
time_t expires;
|
||||
time_t last_modify;
|
||||
|
||||
size_t upload_length;
|
||||
size_t upload_offset;
|
||||
char *uploadID;
|
||||
char *combine_xml;
|
||||
struct easy_string response;
|
||||
TAILQ_HEAD(__cache_list_head, buffer_cache_list) cache_head;
|
||||
struct buffer_cache_list *list_cur; //ʱ<>̷<EFBFBD><CCB7><EFBFBD><EFBFBD>ռ䣬ֻ<E4A3AC><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ͷţ<CDB7><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>
|
||||
TAILQ_HEAD(__etag_list_head, multipart_etag_list) cache_head;
|
||||
|
||||
struct tango_cache_instance *instance;
|
||||
};
|
||||
|
||||
struct buffer_cache_list
|
||||
{
|
||||
TAILQ_HEAD(__buffer_cache_node, cache_buffer) cache_list;
|
||||
struct cache_buffer *cache_cur;
|
||||
CURL *curl;
|
||||
char *etag;
|
||||
u_int32_t part_number;
|
||||
u_int32_t length;
|
||||
struct tango_cache_ctx *ctx;
|
||||
TAILQ_ENTRY(buffer_cache_list) node;
|
||||
};
|
||||
|
||||
struct curl_socket_data
|
||||
{
|
||||
struct event sock_event;
|
||||
};
|
||||
|
||||
void response_buffer_destroy(struct easy_string *estr);
|
||||
void buffer_cache_destroy(struct cache_buffer *cache, struct tango_cache_instance *instance);
|
||||
void buffer_cache_list_destroy(struct buffer_cache_list *list, struct tango_cache_ctx *ctx);
|
||||
void easy_string_savedata(struct easy_string *estr, const char *data, size_t len);
|
||||
void easy_string_destroy(struct easy_string *estr);
|
||||
|
||||
void tango_cache_ctx_destroy(struct tango_cache_ctx *ctx);
|
||||
|
||||
struct tango_cache_ctx *tango_cache_update_prepare(struct tango_cache_instance *instance, struct future* future, struct tango_cache_meta *meta);
|
||||
struct tango_cache_ctx *tango_cache_fetch_prepare(struct tango_cache_instance *instance, struct future* future, struct tango_cache_meta *meta);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user