上传时输出对象的路径

This commit is contained in:
zhangchengwei
2018-09-28 15:16:28 +08:00
committed by zhengchao
parent ce3e46b6cf
commit b145b2c3bb
9 changed files with 37 additions and 33 deletions

View File

@@ -57,9 +57,9 @@ struct tango_cache_result *cache_evbase_read_result(void *promise_result)
return tango_cache_read_result(promise_result); return tango_cache_read_result(promise_result);
} }
const char *cache_evbase_get_object_key(struct cache_evbase_ctx *ctx_asyn) void cache_evbase_get_object_path(const struct cache_evbase_ctx *ctx_asyn, char *path, size_t pathsize)
{ {
return tango_cache_get_object_key(ctx_asyn->ctx); tango_cache_get_object_path(ctx_asyn->ctx, path, pathsize);
} }
static int create_notification_pipe(evutil_socket_t sv[2]) static int create_notification_pipe(evutil_socket_t sv[2])
@@ -344,7 +344,7 @@ struct cache_evbase_ctx *cache_evbase_update_start(struct cache_evbase_instance
} }
int cache_evbase_upload_once_data(struct cache_evbase_instance *instance, struct future* future, int cache_evbase_upload_once_data(struct cache_evbase_instance *instance, struct future* future,
enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size, struct tango_cache_meta *meta, char *objectkey, size_t keysize) enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size, struct tango_cache_meta *meta, char *path, size_t pathsize)
{ {
struct cache_evbase_ctx *ctx_asyn; struct cache_evbase_ctx *ctx_asyn;
struct tango_cache_ctx *ctx; struct tango_cache_ctx *ctx;
@@ -355,9 +355,9 @@ int cache_evbase_upload_once_data(struct cache_evbase_instance *instance, struct
{ {
return -1; return -1;
} }
if(objectkey != NULL) if(path != NULL)
{ {
snprintf(objectkey, keysize, "%s", ctx->object_key); snprintf(path, pathsize, "http://%s/%s/%s", ctx->hostaddr, instance->instance->bucketname, ctx->object_key);
} }
ctx_asyn = (struct cache_evbase_ctx *)calloc(1, sizeof(struct cache_evbase_ctx)); ctx_asyn = (struct cache_evbase_ctx *)calloc(1, sizeof(struct cache_evbase_ctx));
@@ -390,7 +390,7 @@ int cache_evbase_upload_once_data(struct cache_evbase_instance *instance, struct
} }
int cache_evbase_upload_once_evbuf(struct cache_evbase_instance *instance, struct future* future, int cache_evbase_upload_once_evbuf(struct cache_evbase_instance *instance, struct future* future,
struct evbuffer *evbuf, struct tango_cache_meta *meta, char *objectkey, size_t keysize) struct evbuffer *evbuf, struct tango_cache_meta *meta, char *path, size_t pathsize)
{ {
struct cache_evbase_ctx *ctx_asyn; struct cache_evbase_ctx *ctx_asyn;
struct tango_cache_ctx *ctx; struct tango_cache_ctx *ctx;
@@ -401,9 +401,9 @@ int cache_evbase_upload_once_evbuf(struct cache_evbase_instance *instance, struc
{ {
return -1; return -1;
} }
if(objectkey != NULL) if(path != NULL)
{ {
snprintf(objectkey, keysize, "%s", ctx->object_key); snprintf(path, pathsize, "http://%s/%s/%s", ctx->hostaddr, instance->instance->bucketname, ctx->object_key);
} }
ctx_asyn = (struct cache_evbase_ctx *)calloc(1, sizeof(struct cache_evbase_ctx)); ctx_asyn = (struct cache_evbase_ctx *)calloc(1, sizeof(struct cache_evbase_ctx));

View File

@@ -41,11 +41,11 @@ int cache_evbase_delete_object(struct cache_evbase_instance *instance, struct fu
int cache_evbase_upload_once_data(struct cache_evbase_instance *instance, struct future* future, int cache_evbase_upload_once_data(struct cache_evbase_instance *instance, struct future* future,
enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size, enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size,
struct tango_cache_meta *meta, struct tango_cache_meta *meta,
char *objectkey, size_t keysize); char *path, size_t pathsize);
int cache_evbase_upload_once_evbuf(struct cache_evbase_instance *instance, struct future* future, int cache_evbase_upload_once_evbuf(struct cache_evbase_instance *instance, struct future* future,
struct evbuffer *evbuf, struct evbuffer *evbuf,
struct tango_cache_meta *meta, struct tango_cache_meta *meta,
char *objectkey, size_t keysize); char *path, size_t pathsize);
//<2F><>ʽ<EFBFBD>ϴ<EFBFBD><CFB4>ӿ<EFBFBD> //<2F><>ʽ<EFBFBD>ϴ<EFBFBD><CFB4>ӿ<EFBFBD>
struct cache_evbase_ctx *cache_evbase_update_start(struct cache_evbase_instance *instance, struct future* future, struct tango_cache_meta *meta); struct cache_evbase_ctx *cache_evbase_update_start(struct cache_evbase_instance *instance, struct future* future, struct tango_cache_meta *meta);
@@ -53,7 +53,7 @@ int cache_evbase_update_frag_data(struct cache_evbase_ctx *ctx_asyn, enum PUT_ME
int cache_evbase_update_frag_evbuf(struct cache_evbase_ctx *ctx_asyn, struct evbuffer *evbuf); 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); void cache_evbase_update_end(struct cache_evbase_ctx *ctx_asyn);
const char *cache_evbase_get_object_key(struct cache_evbase_ctx *ctx_asyn); void cache_evbase_get_object_path(const struct cache_evbase_ctx *ctx, char *path, size_t pathsize);
#endif #endif

View File

@@ -113,16 +113,16 @@ int tango_cache_delete_object(struct tango_cache_instance *instance, struct futu
*/ */
/*<2A><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ϴ<EFBFBD>API*/ /*<2A><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ϴ<EFBFBD>API*/
//<2F><>objectkey<EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>KEY<EFBFBD><EFBFBD><EFBFBD><EFBFBD>CACHE_OBJECT_KEY_HASH_SWITCH=1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ϣʱ<CFA3><CAB1><EFBFBD>ã<EFBFBD> //<2F><>path<EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ洢·<EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD>ֵ: 0-<2D>ɹ<EFBFBD><C9B9><EFBFBD><0ʧ<30>ܣ<EFBFBD><DCA3><EFBFBD>ͬ //<2F><><EFBFBD><EFBFBD>ֵ: 0-<2D>ɹ<EFBFBD><C9B9><EFBFBD><0ʧ<30>ܣ<EFBFBD><DCA3><EFBFBD>ͬ
int tango_cache_upload_once_data(struct tango_cache_instance *instance, struct future* future, int tango_cache_upload_once_data(struct tango_cache_instance *instance, struct future* future,
enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size, enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size,
struct tango_cache_meta *meta, struct tango_cache_meta *meta,
char *objectkey, size_t keysize); char *path, size_t pathsize);
int tango_cache_upload_once_evbuf(struct tango_cache_instance *instance, struct future* future, int tango_cache_upload_once_evbuf(struct tango_cache_instance *instance, struct future* future,
enum EVBUFFER_COPY_WAY way, struct evbuffer *evbuf, enum EVBUFFER_COPY_WAY way, struct evbuffer *evbuf,
struct tango_cache_meta *meta, struct tango_cache_meta *meta,
char *objectkey, size_t keysize); char *path, size_t pathsize);
/*<2A><>ʽ<EFBFBD>ϴ<EFBFBD>API*/ /*<2A><>ʽ<EFBFBD>ϴ<EFBFBD>API*/
//<2F><><EFBFBD><EFBFBD>ֵ: <20><>ΪNULL<4C><4C><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>tango_cache_ctx_error<6F><EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>CACHE_OUTOF_MEMORY(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<29><> //<2F><><EFBFBD><EFBFBD>ֵ: <20><>ΪNULL<4C><4C><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>tango_cache_ctx_error<6F><EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>CACHE_OUTOF_MEMORY(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<29><>
struct tango_cache_ctx *tango_cache_update_start(struct tango_cache_instance *instance, struct future* future, struct tango_cache_meta *meta); struct tango_cache_ctx *tango_cache_update_start(struct tango_cache_instance *instance, struct future* future, struct tango_cache_meta *meta);
@@ -132,7 +132,7 @@ int tango_cache_update_frag_evbuf(struct tango_cache_ctx *ctx, enum EVBUFFER_COP
void tango_cache_update_end(struct tango_cache_ctx *ctx); void tango_cache_update_end(struct tango_cache_ctx *ctx);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>keyֵ<79><D6B5><EFBFBD><EFBFBD>CACHE_OBJECT_KEY_HASH_SWITCH=1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>URL/<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ϣʱ<CFA3><CAB1><EFBFBD><EFBFBD> //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>keyֵ<79><D6B5><EFBFBD><EFBFBD>CACHE_OBJECT_KEY_HASH_SWITCH=1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>URL/<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ϣʱ<CFA3><CAB1><EFBFBD><EFBFBD>
const char *tango_cache_get_object_key(struct tango_cache_ctx *ctx); void tango_cache_get_object_path(const struct tango_cache_ctx *ctx, char *path, size_t pathsize);
#endif #endif

BIN
cache/pangu_tango_cache.a vendored Normal file

Binary file not shown.

View File

@@ -63,9 +63,9 @@ struct tango_cache_result *tango_cache_read_result(void *promise_result)
return (struct tango_cache_result *)promise_result; return (struct tango_cache_result *)promise_result;
} }
const char *tango_cache_get_object_key(struct tango_cache_ctx *ctx) void tango_cache_get_object_path(const struct tango_cache_ctx *ctx, char *path, size_t pathsize)
{ {
return ctx->object_key; snprintf(path, pathsize, "http://%s/%s/%s", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key);
} }
static inline void update_statistics(enum CACHE_REQUEST_METHOD method, bool fail_state, enum CACHE_ERR_CODE error_code, struct cache_statistics *statistic) static inline void update_statistics(enum CACHE_REQUEST_METHOD method, bool fail_state, enum CACHE_ERR_CODE error_code, struct cache_statistics *statistic)
@@ -262,6 +262,7 @@ struct tango_cache_ctx *tango_cache_update_prepare(struct tango_cache_instance *
{ {
snprintf(ctx->object_key, 256, "%s", meta->url); snprintf(ctx->object_key, 256, "%s", meta->url);
} }
sprintf(ctx->hostaddr, "%s", instance->minio_hostlist);
//Expires<65>ֶΣ<D6B6><CEA3><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʱ //Expires<65>ֶΣ<D6B6><CEA3><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʱ
now = time(NULL); now = time(NULL);
@@ -319,7 +320,7 @@ struct tango_cache_ctx *tango_cache_update_start(struct tango_cache_instance *in
} }
int tango_cache_upload_once_data(struct tango_cache_instance *instance, struct future* future, int tango_cache_upload_once_data(struct tango_cache_instance *instance, struct future* future,
enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size, struct tango_cache_meta *meta, char *objectkey, size_t keysize) enum PUT_MEMORY_COPY_WAY way, const char *data, size_t size, struct tango_cache_meta *meta, char *path, size_t pathsize)
{ {
struct tango_cache_ctx *ctx; struct tango_cache_ctx *ctx;
@@ -328,16 +329,16 @@ int tango_cache_upload_once_data(struct tango_cache_instance *instance, struct f
{ {
return -1; return -1;
} }
if(objectkey != NULL) if(path != NULL)
{ {
snprintf(objectkey, keysize, "%s", ctx->object_key); snprintf(path, pathsize, "http://%s/%s/%s", ctx->hostaddr, instance->bucketname, ctx->object_key);
} }
return tango_cache_upload_once_start_data(ctx, way, data, size); return tango_cache_upload_once_start_data(ctx, way, data, size);
} }
int tango_cache_upload_once_evbuf(struct tango_cache_instance *instance, struct future* future, int tango_cache_upload_once_evbuf(struct tango_cache_instance *instance, struct future* future,
enum EVBUFFER_COPY_WAY way, struct evbuffer *evbuf, struct tango_cache_meta *meta, char *objectkey, size_t keysize) enum EVBUFFER_COPY_WAY way, struct evbuffer *evbuf, struct tango_cache_meta *meta, char *path, size_t pathsize)
{ {
struct tango_cache_ctx *ctx; struct tango_cache_ctx *ctx;
@@ -346,9 +347,9 @@ int tango_cache_upload_once_evbuf(struct tango_cache_instance *instance, struct
{ {
return -1; return -1;
} }
if(objectkey != NULL) if(path != NULL)
{ {
snprintf(objectkey, keysize, "%s", ctx->object_key); snprintf(path, pathsize, "http://%s/%s/%s", ctx->hostaddr, instance->bucketname, ctx->object_key);
} }
return tango_cache_upload_once_start_evbuf(ctx, way, evbuf); return tango_cache_upload_once_start_evbuf(ctx, way, evbuf);
@@ -377,6 +378,7 @@ struct tango_cache_ctx *tango_cache_fetch_prepare(struct tango_cache_instance *i
{ {
snprintf(ctx->object_key, 256, "%s", meta->url); snprintf(ctx->object_key, 256, "%s", meta->url);
} }
sprintf(ctx->hostaddr, "%s", instance->minio_hostlist);
return ctx; return ctx;
} }
@@ -405,6 +407,7 @@ struct tango_cache_ctx *tango_cache_delete_prepare(struct tango_cache_instance *
{ {
snprintf(ctx->object_key, 256, "%s", objkey); snprintf(ctx->object_key, 256, "%s", objkey);
} }
sprintf(ctx->hostaddr, "%s", instance->minio_hostlist);
return ctx; return ctx;
} }

View File

@@ -98,6 +98,7 @@ struct tango_cache_ctx
struct future* future; struct future* future;
char error[CURL_ERROR_SIZE]; char error[CURL_ERROR_SIZE];
char object_key[256]; char object_key[256];
char hostaddr[24];
enum CACHE_REQUEST_METHOD method; enum CACHE_REQUEST_METHOD method;
enum CACHE_ERR_CODE error_code; enum CACHE_ERR_CODE error_code;

View File

@@ -110,11 +110,11 @@ static int http_put_bodypart_request_evbuf(struct tango_cache_ctx *ctx, bool ful
ctx->put.upload_offset = 0; ctx->put.upload_offset = 0;
if(full) if(full)
{ {
snprintf(minio_url, 256, "http://%s/%s/%s", ctx->instance->minio_hostlist, ctx->instance->bucketname, ctx->object_key); snprintf(minio_url, 256, "http://%s/%s/%s", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key);
} }
else else
{ {
snprintf(minio_url, 256, "http://%s/%s/%s?partNumber=%d&uploadId=%s", ctx->instance->minio_hostlist, ctx->instance->bucketname, ctx->object_key, ++ctx->put.part_index, ctx->put.uploadID); snprintf(minio_url, 256, "http://%s/%s/%s?partNumber=%d&uploadId=%s", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key, ++ctx->put.part_index, ctx->put.uploadID);
curl_easy_setopt(ctx->curl, CURLOPT_HEADERFUNCTION, curl_put_multipart_header_cb); curl_easy_setopt(ctx->curl, CURLOPT_HEADERFUNCTION, curl_put_multipart_header_cb);
curl_easy_setopt(ctx->curl, CURLOPT_HEADERDATA, ctx); curl_easy_setopt(ctx->curl, CURLOPT_HEADERDATA, ctx);
} }
@@ -179,7 +179,7 @@ int curl_get_minio_uploadID(struct tango_cache_ctx *ctx)
return -1; return -1;
} }
snprintf(minio_url, 256, "http://%s/%s/%s?uploads", ctx->instance->minio_hostlist, ctx->instance->bucketname, ctx->object_key); snprintf(minio_url, 256, "http://%s/%s/%s?uploads", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key);
curl_easy_setopt(ctx->curl, CURLOPT_POST, 1L); curl_easy_setopt(ctx->curl, CURLOPT_POST, 1L);
curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url); curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url);
curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache"); curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache");
@@ -209,7 +209,7 @@ int cache_delete_minio_object(struct tango_cache_ctx *ctx)
return 0; return 0;
} }
snprintf(minio_url, 256, "http://%s/%s/%s", ctx->instance->minio_hostlist, ctx->instance->bucketname, ctx->object_key); snprintf(minio_url, 256, "http://%s/%s/%s", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key);
curl_easy_setopt(ctx->curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_easy_setopt(ctx->curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url); curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url);
curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache"); curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache");
@@ -237,7 +237,7 @@ bool cache_cancel_upload_minio(struct tango_cache_ctx *ctx)
return false; return false;
} }
snprintf(minio_url, 256, "http://%s/%s/%s?uploadId=%s", ctx->instance->minio_hostlist, ctx->instance->bucketname, ctx->object_key, ctx->put.uploadID); snprintf(minio_url, 256, "http://%s/%s/%s?uploadId=%s", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key, ctx->put.uploadID);
curl_easy_setopt(ctx->curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_easy_setopt(ctx->curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url); curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url);
curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache"); curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache");
@@ -267,7 +267,7 @@ bool cache_kick_combine_minio(struct tango_cache_ctx *ctx)
} }
construct_complete_xml(ctx, &ctx->put.combine_xml, &len); construct_complete_xml(ctx, &ctx->put.combine_xml, &len);
snprintf(minio_url, 256, "http://%s/%s/%s?uploadId=%s", ctx->instance->minio_hostlist, ctx->instance->bucketname, ctx->object_key, ctx->put.uploadID); snprintf(minio_url, 256, "http://%s/%s/%s?uploadId=%s", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key, ctx->put.uploadID);
curl_easy_setopt(ctx->curl, CURLOPT_POST, 1L); curl_easy_setopt(ctx->curl, CURLOPT_POST, 1L);
curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url); curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url);
curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache"); curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache");
@@ -516,7 +516,7 @@ int tango_cache_upload_once_start_data(struct tango_cache_ctx *ctx, enum PUT_MEM
} }
ctx->put.state = PUT_STATE_END; ctx->put.state = PUT_STATE_END;
snprintf(minio_url, 256, "http://%s/%s/%s", ctx->instance->minio_hostlist, ctx->instance->bucketname, ctx->object_key); snprintf(minio_url, 256, "http://%s/%s/%s", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key);
curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url); curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url);
curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache"); curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache");
curl_easy_setopt(ctx->curl, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(ctx->curl, CURLOPT_NOSIGNAL, 1L);
@@ -797,7 +797,7 @@ int tango_cache_fetch_start(struct tango_cache_ctx *ctx)
return -1; return -1;
} }
snprintf(minio_url, 256, "http://%s/%s/%s", ctx->instance->minio_hostlist, ctx->instance->bucketname, ctx->object_key); snprintf(minio_url, 256, "http://%s/%s/%s", ctx->hostaddr, ctx->instance->bucketname, ctx->object_key);
curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url); curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url);
curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache"); curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "aws-sdk-cpp/1.5.24 Linux/3.10.0-327.el7.x86_64 x86_64 pangu_cache");
curl_easy_setopt(ctx->curl, CURLOPT_NOSIGNAL,1L); curl_easy_setopt(ctx->curl, CURLOPT_NOSIGNAL,1L);

View File

@@ -245,7 +245,7 @@ int main(int argc, char **argv)
promise_set_ctx(future_to_promise(pdata->future), NULL, NULL); promise_set_ctx(future_to_promise(pdata->future), NULL, NULL);
ctx = cache_evbase_update_start(instance_asyn, pdata->future, &meta); ctx = cache_evbase_update_start(instance_asyn, pdata->future, &meta);
sprintf(pdata->filename, "%s", cache_evbase_get_object_key(ctx)); cache_evbase_get_object_path(ctx, pdata->filename, 256);
char buffer[1024]; char buffer[1024];
FILE *fp = fopen(filename_in, "r"); FILE *fp = fopen(filename_in, "r");

View File

@@ -213,7 +213,7 @@ static void dummy_accept_callback(evutil_socket_t fd, short events, void *arg)
promise_set_ctx(future_to_promise(pdata->future), NULL, NULL); promise_set_ctx(future_to_promise(pdata->future), NULL, NULL);
ctx = tango_cache_update_start(tango_instance, pdata->future, &meta); ctx = tango_cache_update_start(tango_instance, pdata->future, &meta);
sprintf(pdata->filename, "%s", tango_cache_get_object_key(ctx)); tango_cache_get_object_path(ctx, pdata->filename, 256);
FILE *fp = fopen(s, "r"); FILE *fp = fopen(s, "r");
while(!feof(fp)) while(!feof(fp))