From f1642106ced3d5222ad7c2f04a417087fee02efc Mon Sep 17 00:00:00 2001 From: "linuxrc@163.com" Date: Thu, 21 Nov 2019 17:05:35 +0800 Subject: 适配最新的tango cache client. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin.zip | Bin 41012668 -> 43325369 bytes src/Makefile | 4 ++-- src/include/cache_evbase_client.h | 4 +++- src/include/tango_cache_client.h | 17 ++++++++++++++--- src/libs/libcjson.a | Bin 42168 -> 42168 bytes src/libs/libcrypto.a | Bin 5788480 -> 5788480 bytes src/libs/libcurl.a | Bin 827674 -> 834506 bytes src/libs/libevent.a | Bin 649304 -> 649304 bytes src/libs/libhiredis_vip.a | Bin 398638 -> 974702 bytes src/libs/libssl.a | Bin 1019068 -> 1019068 bytes src/libs/libtango_cache_client.a | Bin 860162 -> 777716 bytes src/libs/libxml2.a | Bin 2727532 -> 2736692 bytes src/objectscanner_kafka.cpp | 2 +- 13 files changed, 20 insertions(+), 7 deletions(-) diff --git a/bin.zip b/bin.zip index c6456b7..e882910 100644 Binary files a/bin.zip and b/bin.zip differ diff --git a/src/Makefile b/src/Makefile index 5ef1901..966fe20 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,7 +6,7 @@ CFLAGS= -g $(INC_PATH) #CFLAGS=-Wall -g $(INC_PATH) LDFLAGS = LIBS = ./libs/libtango_cache_client.a ./libs/libcjson.a ./libs/libcrypto.a ./libs/libcurl.a ./libs/libevent.a ./libs/libhiredis_vip.a ./libs/libssl.a ./libs/libxml2.a -LIBS += -lMESA_handle_logger -lMESA_htable -lMESA_prof_load -lMESA_field_stat2 -lpthread -lwiredcfg -lWiredLB -lrdkafka +LIBS += -lMESA_handle_logger -lMESA_htable -lMESA_prof_load -lMESA_field_stat2 -lpthread -lwiredcfg -lWiredLB -lrdkafka -lz LIBS += -laid2name -lAVLSDK OBJS = objectscanner_analyze.o objectscanner_kafka.o objectscanner_main.o @@ -18,7 +18,7 @@ ALL:$(TARGET_EXE) $(TARGET_EXE):$(OBJS) $(CCC) $(LDFLAGS) $^ -o $@ $(LIBS) - cp $@ ../bin/ +# cp $@ ../bin/ .c.o: $(CCC) $(CFLAGS) -c $< diff --git a/src/include/cache_evbase_client.h b/src/include/cache_evbase_client.h index feab191..991015a 100644 --- a/src/include/cache_evbase_client.h +++ b/src/include/cache_evbase_client.h @@ -18,7 +18,8 @@ struct cache_evbase_instance struct cache_evbase_ctx { - size_t object_size; //tango_ctxԱ޷عֱӻȡĻڶдһ + size_t object_size; //tango_ctxԱ޷عֱӻȡĻڶдһ + struct evbuffer *evbuf; struct tango_cache_ctx *ctx; struct tango_losf_meta *losf_meta; //LOSFһϴʱûctx struct cache_evbase_instance *instance_asyn; @@ -38,6 +39,7 @@ struct tango_cache_parameter *cache_evbase_parameter_new(const char* profile_pat /*ʵ̰߳ȫڲһ߳*/ struct cache_evbase_instance *cache_evbase_instance_new(struct tango_cache_parameter *param, void *runtimelog); +struct event_base *cache_evbase_get_event_base(struct cache_evbase_instance *instance); /******************************************* GETӿ ****************************************/ //ɹ0ʧܷ-1futureصִ߳Уͬ diff --git a/src/include/tango_cache_client.h b/src/include/tango_cache_client.h index 07e43f2..1a3493a 100644 --- a/src/include/tango_cache_client.h +++ b/src/include/tango_cache_client.h @@ -26,6 +26,7 @@ enum CACHE_ERR_CODE CACHE_ERR_EVBUFFER = -112, CACHE_UPDATE_CANCELED = -113, CACHE_ERR_INSTANCE_ID = -114, + CACHE_ERR_BAD_REQUEST = -115, }; struct cache_statistics @@ -43,6 +44,8 @@ struct cache_statistics long long put_err_redis; //UPLOAD redisʧܵĴ long long put_cancel; //UPLOAD Cancel long long put_losf_num; //LOSFϲĸ + long long put_multipart; //˷ֶϴĶ + long long put_duplicate; //LOSFظ long long del_recv_num; //DELETEĴ long long del_succ_num; //DELETEɹĴ long long del_error_num; //DELETEʧܵĴ @@ -89,18 +92,26 @@ enum OBJECT_LOCATION OBJECT_IN_REDIS }; +//Range֧3: bytes=x-y; bytes=x-; bytes=-y +struct tango_cache_get_range +{ + int64_t start_offset; // -1ʾ + int64_t end_offset; // -1ʾ +}; + struct tango_cache_meta_get { const char* url; //:URLǽṹ־:ļ·CACHE_OBJECT_KEY_HASH_SWITCH=0ʱ󳤶256ֽڣ=1ʱ struct request_freshness get; + struct tango_cache_get_range *range; //ͷRange }; //promise_successĽresult struct tango_cache_result { const char *data_frag; //typeΪRESULT_TYPE_HEADERÿͷһ(HTTP1.1ʽ) - size_t size; - size_t tlength; //ܳȣصʱЧ + size_t size; //Ƭεij + size_t tlength;//response bodyƵܳ(RangeͷʱĴС)صʱЧ enum CACHE_RESULT_TYPE type; enum OBJECT_LOCATION location; }; @@ -129,7 +140,7 @@ enum PUT_MEMORY_COPY_WAY enum EVBUFFER_COPY_WAY { EVBUFFER_MOVE=0,//evbuffer_add_buffer - EVBUFFER_COPY, //evbuffer_add_buffer_reference + EVBUFFER_COPY, //evbuffer_add_buffer_referenceƼ }; enum CACHE_HTTP_HDR_TYPE diff --git a/src/libs/libcjson.a b/src/libs/libcjson.a index 9a96805..12dfb2e 100644 Binary files a/src/libs/libcjson.a and b/src/libs/libcjson.a differ diff --git a/src/libs/libcrypto.a b/src/libs/libcrypto.a index fddaa22..9c6df21 100644 Binary files a/src/libs/libcrypto.a and b/src/libs/libcrypto.a differ diff --git a/src/libs/libcurl.a b/src/libs/libcurl.a index 1d15f69..cfff503 100644 Binary files a/src/libs/libcurl.a and b/src/libs/libcurl.a differ diff --git a/src/libs/libevent.a b/src/libs/libevent.a index 1d87211..7bc8127 100644 Binary files a/src/libs/libevent.a and b/src/libs/libevent.a differ diff --git a/src/libs/libhiredis_vip.a b/src/libs/libhiredis_vip.a index ce86d90..6ce82e5 100644 Binary files a/src/libs/libhiredis_vip.a and b/src/libs/libhiredis_vip.a differ diff --git a/src/libs/libssl.a b/src/libs/libssl.a index a90a427..5d6c238 100644 Binary files a/src/libs/libssl.a and b/src/libs/libssl.a differ diff --git a/src/libs/libtango_cache_client.a b/src/libs/libtango_cache_client.a index 6454c11..6c118cc 100644 Binary files a/src/libs/libtango_cache_client.a and b/src/libs/libtango_cache_client.a differ diff --git a/src/libs/libxml2.a b/src/libs/libxml2.a index 915036d..c52156b 100644 Binary files a/src/libs/libxml2.a and b/src/libs/libxml2.a differ diff --git a/src/objectscanner_kafka.cpp b/src/objectscanner_kafka.cpp index 6b52447..da53d67 100644 --- a/src/objectscanner_kafka.cpp +++ b/src/objectscanner_kafka.cpp @@ -107,7 +107,7 @@ int32_t rdkafka_consumer_init(void) /*Topic configuration*/ topic_conf = rd_kafka_topic_conf_new(); rd_kafka_topic_conf_set(topic_conf, "consume.callback.max.messages", confbuf, errString, 512); - rd_kafka_topic_conf_set(topic_conf, "auto.commit.enable", "true", errString, 512); + rd_kafka_topic_conf_set(topic_conf, "enable.auto.commit", "true", errString, 512); rd_kafka_topic_conf_set(topic_conf, "auto.offset.reset", "earliest", errString, 512); //RD_KAFKA_OFFSET_STOREDʼûoffesetʱ if(rd_kafka_topic_conf_set(topic_conf, "offset.store.method", "broker", errString, 512) != RD_KAFKA_CONF_OK) { -- cgit v1.2.3