2018-09-18 11:14:11 +08:00
|
|
|
|
#ifndef __CACHE_ASYN_CLIENT_H__
|
|
|
|
|
|
#define __CACHE_ASYN_CLIENT_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include <event2/event.h>
|
|
|
|
|
|
#include <event.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "tango_cache_client.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct cache_evbase_instance
|
|
|
|
|
|
{
|
|
|
|
|
|
struct tango_cache_instance *instance;
|
|
|
|
|
|
evutil_socket_t notify_readfd;
|
|
|
|
|
|
evutil_socket_t notify_sendfd;
|
|
|
|
|
|
struct event_base* evbase;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct cache_evbase_ctx
|
|
|
|
|
|
{
|
|
|
|
|
|
struct tango_cache_ctx *ctx;
|
|
|
|
|
|
struct cache_evbase_instance *instance_asyn;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2018-09-29 17:10:19 +08:00
|
|
|
|
/*<2A><><EFBFBD><EFBFBD>API<50>̰߳<DFB3>ȫ<EFBFBD><C8AB>API<50><49>ʹ<EFBFBD><CAB9>˵<EFBFBD><CBB5><EFBFBD>ο<EFBFBD>tango_cache_client.h*/
|
2018-09-23 15:35:13 +08:00
|
|
|
|
|
2018-09-18 11:14:11 +08:00
|
|
|
|
enum CACHE_ERR_CODE cache_evbase_get_last_error(const struct cache_evbase_ctx *ctx_asyn);
|
|
|
|
|
|
enum CACHE_ERR_CODE cache_evbase_ctx_error(const struct cache_evbase_instance *instance);
|
|
|
|
|
|
void cache_evbase_get_statistics(const struct cache_evbase_instance *instance, struct cache_statistics *out);
|
|
|
|
|
|
|
2018-09-30 19:20:06 +08:00
|
|
|
|
void cache_evbase_global_init(void);
|
|
|
|
|
|
|
2018-09-27 15:04:56 +08:00
|
|
|
|
/*<2A><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>ÿ<EFBFBD>߳<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>*/
|
2018-09-18 11:14:11 +08:00
|
|
|
|
struct cache_evbase_instance *cache_evbase_instance_new(const char* profile_path, const char* section, void *runtimelog);
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-09-27 15:04:56 +08:00
|
|
|
|
//GET<45>ӿڣ<D3BF><DAA3>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>-1<><31>future<72>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>ִ<EFBFBD>У<EFBFBD><D0A3><EFBFBD>ͬ
|
2018-10-15 16:38:22 +08:00
|
|
|
|
int cache_evbase_fetch_object(struct cache_evbase_instance *instance, struct future* f, struct tango_cache_meta_get *meta);
|
2018-10-23 20:26:06 +08:00
|
|
|
|
int cache_evbase_head_object(struct cache_evbase_instance *instance, struct future* f, struct tango_cache_meta_get *meta);
|
2018-09-23 15:35:13 +08:00
|
|
|
|
struct tango_cache_result *cache_evbase_read_result(void *promise_result);
|
|
|
|
|
|
|
2018-09-27 15:04:56 +08:00
|
|
|
|
//DELETE<54>ӿ<EFBFBD>
|
2018-10-15 16:38:22 +08:00
|
|
|
|
int cache_evbase_delete_object(struct cache_evbase_instance *instance, struct future* f, const char *objkey);
|
2018-09-27 15:04:56 +08:00
|
|
|
|
|
2018-09-23 15:35:13 +08:00
|
|
|
|
//һ<><D2BB><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4>ӿ<EFBFBD>
|
2018-10-15 16:38:22 +08:00
|
|
|
|
int cache_evbase_upload_once_data(struct cache_evbase_instance *instance, struct future* f,
|
2018-09-21 15:03:21 +08:00
|
|
|
|
enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size,
|
2018-10-15 16:38:22 +08:00
|
|
|
|
struct tango_cache_meta_put *meta,
|
2018-09-29 17:10:19 +08:00
|
|
|
|
char *path/*OUT*/, size_t pathsize);
|
2018-10-15 16:38:22 +08:00
|
|
|
|
int cache_evbase_upload_once_evbuf(struct cache_evbase_instance *instance, struct future* f,
|
2018-09-21 15:03:21 +08:00
|
|
|
|
struct evbuffer *evbuf,
|
2018-10-15 16:38:22 +08:00
|
|
|
|
struct tango_cache_meta_put *meta,
|
2018-09-29 17:10:19 +08:00
|
|
|
|
char *path/*OUT*/, size_t pathsize);
|
2018-09-18 11:14:11 +08:00
|
|
|
|
|
2018-09-23 15:35:13 +08:00
|
|
|
|
//<2F><>ʽ<EFBFBD>ϴ<EFBFBD><CFB4>ӿ<EFBFBD>
|
2018-10-15 16:38:22 +08:00
|
|
|
|
struct cache_evbase_ctx *cache_evbase_update_start(struct cache_evbase_instance *instance, struct future* f, struct tango_cache_meta_put *meta);
|
2018-09-23 15:35:13 +08:00
|
|
|
|
int cache_evbase_update_frag_data(struct cache_evbase_ctx *ctx_asyn, enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size);
|
|
|
|
|
|
int cache_evbase_update_frag_evbuf(struct cache_evbase_ctx *ctx_asyn, struct evbuffer *evbuf);
|
|
|
|
|
|
void cache_evbase_update_end(struct cache_evbase_ctx *ctx_asyn);
|
|
|
|
|
|
|
2018-09-29 17:10:19 +08:00
|
|
|
|
void cache_evbase_get_object_path(const struct cache_evbase_ctx *ctx, char *path/*OUT*/, size_t pathsize);
|
2018-09-18 11:14:11 +08:00
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|