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"
|
|
|
|
|
|
|
2018-12-14 15:07:09 +08:00
|
|
|
|
/* API<50><49>ʹ<EFBFBD><CAB9>˵<EFBFBD><CBB5><EFBFBD>ο<EFBFBD>tango_cache_client.h */
|
|
|
|
|
|
|
2018-09-18 11:14:11 +08:00
|
|
|
|
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
|
|
|
|
|
|
{
|
2018-12-14 15:07:09 +08:00
|
|
|
|
size_t object_size; //tango_ctx<74><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD>ع<EFBFBD><D8B9><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӻ<EFBFBD>ȡ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>ڶ<EFBFBD>дһ<D0B4><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2018-09-18 11:14:11 +08:00
|
|
|
|
struct tango_cache_ctx *ctx;
|
|
|
|
|
|
struct cache_evbase_instance *instance_asyn;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2018-12-14 15:07:09 +08:00
|
|
|
|
/*<2A><><EFBFBD><EFBFBD>API<50>̰߳<DFB3>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<CDAC><D2BB>cache_evbase_ctx<74><78><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF>̷߳<DFB3><CCB7>ʡ<EFBFBD>*/
|
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-11-14 15:06:02 +08:00
|
|
|
|
//ÿ<><C3BF>minio<69><6F>Ⱥ<EFBFBD><C8BA>bucket<65><74><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>parameter<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>instance<63>ɹ<EFBFBD><C9B9><EFBFBD>һ<EFBFBD><D2BB>parameter<65><72>
|
2018-11-07 15:05:55 +08:00
|
|
|
|
struct tango_cache_parameter *cache_evbase_parameter_new(const char* profile_path, const char* section, void *runtimelog);
|
|
|
|
|
|
|
2018-11-14 15:06:02 +08:00
|
|
|
|
/*<2A><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>̰߳<DFB3>ȫ<EFBFBD><C8AB><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>߳<EFBFBD>*/
|
2018-11-07 15:05:55 +08:00
|
|
|
|
struct cache_evbase_instance *cache_evbase_instance_new(struct tango_cache_parameter *param, void *runtimelog);
|
2018-09-18 11:14:11 +08:00
|
|
|
|
|
2018-12-15 13:50:48 +08:00
|
|
|
|
/******************************************* GET<45>ӿ<EFBFBD> ****************************************/
|
|
|
|
|
|
//<2F>ɹ<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-12-14 15:07:09 +08:00
|
|
|
|
int cache_evbase_fetch_object(struct cache_evbase_instance *instance, struct future* f, struct tango_cache_meta_get *meta, enum OBJECT_LOCATION where_to_get);
|
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-12-15 13:50:48 +08:00
|
|
|
|
/****************************************** DELETE<54>ӿ<EFBFBD> **************************************/
|
|
|
|
|
|
int cache_evbase_delete_object(struct cache_evbase_instance *instance, struct future* f, const char *objkey, const char *minio_addr=NULL, const char *bucket=NULL);
|
2018-09-27 15:04:56 +08:00
|
|
|
|
|
2018-12-15 13:50:48 +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-12-15 13:50:48 +08:00
|
|
|
|
/****************************************** <20><>ʽ<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);
|
2018-12-14 15:07:09 +08:00
|
|
|
|
int cache_evbase_update_end(struct cache_evbase_ctx *ctx_asyn, char *path/*OUT*/, size_t pathsize);
|
2018-11-23 20:55:28 +08:00
|
|
|
|
void cache_evbase_update_cancel(struct cache_evbase_ctx *ctx_asyn);
|
2018-09-23 15:35:13 +08:00
|
|
|
|
|
2018-09-18 11:14:11 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|