TSG-5746 使用hos存储非结构化文件
修复缓存代码编译问题 缓存功能适配hos
This commit is contained in:
22
cache/test/tango_cache_test.cpp
vendored
22
cache/test/tango_cache_test.cpp
vendored
@@ -238,7 +238,7 @@ static void dummy_accept_callback(evutil_socket_t fd, short events, void *arg)
|
||||
sprintf(filename, "file_index_%u.bin", index++);
|
||||
pdata = (struct future_pdata *)malloc(sizeof(struct future_pdata));
|
||||
pdata->fp = fopen(filename, "w");
|
||||
pdata->future = future_create(get_future_success, get_future_failed, pdata);
|
||||
pdata->future = future_create("_get", get_future_success, get_future_failed, (void *)pdata);
|
||||
|
||||
if(tango_cache_fetch_object(tango_instance, pdata->future, &getmeta, OBJECT_IN_UNKNOWN) < 0)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ static void dummy_accept_callback(evutil_socket_t fd, short events, void *arg)
|
||||
else if(!strcasecmp(p, "HEAD"))
|
||||
{
|
||||
pdata = (struct future_pdata *)malloc(sizeof(struct future_pdata));
|
||||
pdata->future = future_create(head_future_success, head_future_failed, pdata);
|
||||
pdata->future = future_create("_head", head_future_success, head_future_failed, (void *)pdata);
|
||||
|
||||
if(tango_cache_head_object(tango_instance, pdata->future, &getmeta) < 0)
|
||||
{
|
||||
@@ -260,8 +260,8 @@ static void dummy_accept_callback(evutil_socket_t fd, short events, void *arg)
|
||||
size_t filelen;
|
||||
p = get_file_content(s, &filelen);
|
||||
pdata = (struct future_pdata *)malloc(sizeof(struct future_pdata));
|
||||
pdata->future = future_create(put_future_success, put_future_failed, pdata);
|
||||
|
||||
pdata->future = future_create("_putnoce", put_future_success, put_future_failed, (void *)pdata);
|
||||
|
||||
if(tango_cache_upload_once_data(tango_instance, pdata->future, PUT_MEM_FREE, p, filelen, &putmeta, pdata->filename, 256))
|
||||
{
|
||||
put_future_failed(FUTURE_ERROR_CANCEL, "", pdata);
|
||||
@@ -271,7 +271,7 @@ static void dummy_accept_callback(evutil_socket_t fd, short events, void *arg)
|
||||
{
|
||||
size_t readlen;
|
||||
pdata = (struct future_pdata *)malloc(sizeof(struct future_pdata));
|
||||
pdata->future = future_create(put_future_success, put_future_failed, pdata);
|
||||
pdata->future = future_create("_putonceev", put_future_success, put_future_failed, pdata);
|
||||
struct evbuffer *evbuf = evbuffer_new();
|
||||
char buffer[1024];
|
||||
|
||||
@@ -294,14 +294,14 @@ static void dummy_accept_callback(evutil_socket_t fd, short events, void *arg)
|
||||
else if(!strcasecmp(p, "DEL"))
|
||||
{
|
||||
pdata = (struct future_pdata *)malloc(sizeof(struct future_pdata));
|
||||
pdata->future = future_create(del_future_success, del_future_failed, pdata);
|
||||
pdata->future = future_create("_del", del_future_success, del_future_failed, pdata);
|
||||
sprintf(pdata->filename, "%s", s);
|
||||
tango_cache_delete_object(tango_instance, pdata->future, s);
|
||||
}
|
||||
else if(!strcasecmp(p, "DELMUL")) //TODO
|
||||
{
|
||||
pdata = (struct future_pdata *)malloc(sizeof(struct future_pdata));
|
||||
pdata->future = future_create(del_future_success, del_future_failed, pdata);
|
||||
pdata->future = future_create("_delmul", del_future_success, del_future_failed, pdata);
|
||||
sprintf(pdata->filename, "%s", s);
|
||||
|
||||
for(pstart = strtok_r(s, ";", &save_ptr); pstart != NULL; pstart = strtok_r(NULL, ";", &save_ptr))
|
||||
@@ -313,8 +313,8 @@ static void dummy_accept_callback(evutil_socket_t fd, short events, void *arg)
|
||||
else
|
||||
{
|
||||
pdata = (struct future_pdata *)malloc(sizeof(struct future_pdata));
|
||||
pdata->future = future_create(put_future_success, put_future_failed, pdata);
|
||||
|
||||
pdata->future = future_create("_default", put_future_success, put_future_failed, pdata);
|
||||
|
||||
ctx = tango_cache_update_start(tango_instance, pdata->future, &putmeta);
|
||||
if(ctx==NULL)
|
||||
{
|
||||
@@ -411,7 +411,9 @@ int main(int crgc, char **arg)
|
||||
struct timeval tv;
|
||||
void *runtime_log;
|
||||
struct tango_cache_parameter *parameter;
|
||||
|
||||
|
||||
future_promise_library_init(NULL);
|
||||
|
||||
runtime_log = MESA_create_runtime_log_handle("./runtime.log", 10);
|
||||
if(NULL==runtime_log)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user