summaryrefslogtreecommitdiff
path: root/src/include/object_store_client.h
blob: e6fdfdac0253ad8d265867927ae1a3b3ef4873c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef __OBJECT_STORE_CLIENT_H__
#define __OBJECT_STORE_CLIENT_H__

#include <event2/event.h>  
#include <event.h>

#include "cache_evbase_client.h"

struct object_store_instance
{
	struct cache_evbase_instance **instances;
	u_int32_t instance_num;
};

/*����API�̰߳�ȫ��API��ʹ��˵���ο�tango_cache_client.h*/

enum CACHE_ERR_CODE object_store_get_last_error(const struct cache_evbase_ctx *ctx_asyn);
long long object_store_maximum_session(const struct object_store_instance *instance);
void object_store_get_statistics(const struct object_store_instance *instance, struct cache_statistics *out);

void object_store_global_init(void);

/*����ʵ�����̰߳�ȫ���ڲ�������һ���߳�*/
struct object_store_instance *object_store_instance_new(const char* profile_path, const char* section, int thread_num, void *runtimelog);


//GET�ӿڣ��ɹ�����0��ʧ�ܷ���-1��future�ص���������������߳���ִ�У���ͬ
int object_store_fetch_object(struct object_store_instance *instance, struct future* f, struct tango_cache_meta_get *meta, enum OBJECT_LOCATION where_to_get);
int object_store_head_object(struct object_store_instance *instance, struct future* f, struct tango_cache_meta_get *meta);
struct tango_cache_result *object_store_read_result(void *promise_result);

//DELETE�ӿ�
int object_store_delete_object(struct object_store_instance *instance, struct future* f, const char *objkey, const char *minio_addr=NULL, const char *bucket=NULL);

//һ�����ϴ��ӿ�
int object_store_upload_once_data(struct object_store_instance *instance, struct future* f, 
                                               enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size, 
                                               struct tango_cache_meta_put *meta, 
                                               char *path/*OUT*/, size_t pathsize);
int object_store_upload_once_evbuf(struct object_store_instance *instance, struct future* f, 
                                                struct evbuffer *evbuf, 
                                                struct tango_cache_meta_put *meta, 
                                                char *path/*OUT*/, size_t pathsize);

//��ʽ�ϴ��ӿ�
struct cache_evbase_ctx *object_store_update_start(struct object_store_instance *instance, struct future* f, struct tango_cache_meta_put *meta);
int object_store_update_frag_data(struct cache_evbase_ctx *ctx_asyn, enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size);
int object_store_update_frag_evbuf(struct cache_evbase_ctx *ctx_asyn, struct evbuffer *evbuf);
int object_store_update_end(struct cache_evbase_ctx *ctx_asyn, char *path/*OUT*/, size_t pathsize);
void object_store_update_cancel(struct cache_evbase_ctx *ctx_asyn);

#endif