上传时输出对象的路径

This commit is contained in:
zhangchengwei
2018-09-28 15:16:28 +08:00
parent 3ad673b610
commit ad93b4ed6f
9 changed files with 37 additions and 33 deletions

View File

@@ -63,9 +63,9 @@ struct tango_cache_result *tango_cache_read_result(void *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)
@@ -262,6 +262,7 @@ struct tango_cache_ctx *tango_cache_update_prepare(struct tango_cache_instance *
{
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>ʱ
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,
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;
@@ -328,16 +329,16 @@ int tango_cache_upload_once_data(struct tango_cache_instance *instance, struct f
{
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);
}
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;
@@ -346,9 +347,9 @@ int tango_cache_upload_once_evbuf(struct tango_cache_instance *instance, struct
{
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);
@@ -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);
}
sprintf(ctx->hostaddr, "%s", instance->minio_hostlist);
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);
}
sprintf(ctx->hostaddr, "%s", instance->minio_hostlist);
return ctx;
}