diff --git a/CMakeLists.txt b/CMakeLists.txt index 46393ae..6390d8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR) -project(tnt-kafka C) +project(kafka C) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) @@ -22,4 +22,4 @@ find_package(RdKafka) include_directories(${TARANTOOL_INCLUDE_DIRS}) -add_subdirectory(tnt-kafka) +add_subdirectory(kafka) diff --git a/README.md b/README.md index 84383cb..7a76589 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -tnt-kafka -========= +Tarantool kafka +=============== Full featured high performance kafka library for Tarantool based on [librdkafka](https://github.com/edenhill/librdkafka). Can produce more then 150k messages per second and consume more then 140k messages per second. @@ -8,7 +8,7 @@ Can produce more then 150k messages per second and consume more then 140k messag * Kafka producer and consumer implementations. * Fiber friendly. * Mostly errorless functions and methods. Error handling in Tarantool ecosystem is quite a mess, -some libraries throws lua native `error` while others throws `box.error` instead. `tnt-kafka` returns +some libraries throws lua native `error` while others throws `box.error` instead. `kafka` returns non critical errors as strings which allows you to decide how to handle it. # Requirements @@ -22,7 +22,7 @@ non critical errors as strings which allows you to decide how to handle it. # Installation ```bash - tarantoolctl rocks install https://raw.githubusercontent.com/tarantool/tnt-kafka/master/rockspecs/tnt-kafka-scm-1.rockspec + tarantoolctl rocks install https://raw.githubusercontent.com/tarantool/tnt-kafka/master/rockspecs/kafka-scm-1.rockspec ``` # Examples @@ -34,7 +34,7 @@ non critical errors as strings which allows you to decide how to handle it. local fiber = require('fiber') local os = require('os') local log = require('log') - local tnt_kafka = require('tnt-kafka') + local tnt_kafka = require('kafka') local error_callback = function(err) log.error("got error: %s", err) @@ -110,7 +110,7 @@ non critical errors as strings which allows you to decide how to handle it. local fiber = require('fiber') local os = require('os') local log = require('log') - local tnt_kafka = require('tnt-kafka') + local tnt_kafka = require('kafka') local error_callback = function(err) log.error("got error: %s", err) @@ -197,7 +197,7 @@ non critical errors as strings which allows you to decide how to handle it. ```lua local os = require('os') local log = require('log') - local tnt_kafka = require('tnt-kafka') + local tnt_kafka = require('kafka') local error_callback = function(err) log.error("got error: %s", err) @@ -244,7 +244,7 @@ non critical errors as strings which allows you to decide how to handle it. local fiber = require('fiber') local os = require('os') local log = require('log') - local tnt_kafka = require('tnt-kafka') + local tnt_kafka = require('kafka') local error_callback = function(err) log.error("got error: %s", err) @@ -298,7 +298,6 @@ because `rd_kafka_destroy` sometimes hangs forever. # TODO * Ordered storage for offsets to prevent commits unprocessed messages -* Add poll call for librdkafka logs and errors * Fix known issues * More examples * Better documentation diff --git a/benchmarks/async_producer.lua b/benchmarks/async_producer.lua index 33241d9..e0128ec 100644 --- a/benchmarks/async_producer.lua +++ b/benchmarks/async_producer.lua @@ -3,7 +3,7 @@ local box = require('box') local os = require('os') local log = require('log') local clock = require('clock') -local tnt_kafka = require('tnt-kafka') +local tnt_kafka = require('kafka') box.cfg{} diff --git a/benchmarks/auto_offset_store_consumer.lua b/benchmarks/auto_offset_store_consumer.lua index 93f6c26..828b1f4 100644 --- a/benchmarks/auto_offset_store_consumer.lua +++ b/benchmarks/auto_offset_store_consumer.lua @@ -3,7 +3,7 @@ local log = require('log') local box = require('box') local os = require('os') local clock = require('clock') -local tnt_kafka = require('tnt-kafka') +local tnt_kafka = require('kafka') box.cfg{ memtx_memory = 524288000, -- 500 MB diff --git a/benchmarks/manual_offset_store_consumer.lua b/benchmarks/manual_offset_store_consumer.lua index 01cf7d9..1da434d 100644 --- a/benchmarks/manual_offset_store_consumer.lua +++ b/benchmarks/manual_offset_store_consumer.lua @@ -3,7 +3,7 @@ local box = require('box') local os = require('os') local log = require('log') local clock = require('clock') -local tnt_kafka = require('tnt-kafka') +local tnt_kafka = require('kafka') box.cfg{ memtx_memory = 524288000, diff --git a/benchmarks/sync_producer.lua b/benchmarks/sync_producer.lua index c8cc800..351c4e6 100644 --- a/benchmarks/sync_producer.lua +++ b/benchmarks/sync_producer.lua @@ -3,7 +3,7 @@ local box = require('box') local log = require('log') local os = require('os') local clock = require('clock') -local tnt_kafka = require('tnt-kafka') +local tnt_kafka = require('kafka') box.cfg{ memtx_memory = 524288000, -- 500 MB diff --git a/tnt-kafka/CMakeLists.txt b/kafka/CMakeLists.txt similarity index 75% rename from tnt-kafka/CMakeLists.txt rename to kafka/CMakeLists.txt index fcb6a70..effa4df 100644 --- a/tnt-kafka/CMakeLists.txt +++ b/kafka/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${CMAKE_SOURCE_DIR}/tnt-kafka) +include_directories(${CMAKE_SOURCE_DIR}/kafka) add_library(tntkafka SHARED tnt_kafka.c callbacks.c consumer.c consumer_msg.c producer.c queue.c common.c) @@ -10,5 +10,5 @@ endif(APPLE) target_link_libraries(tntkafka ${RDKAFKA_LIBRARY} pthread) set_target_properties(tntkafka PROPERTIES PREFIX "" OUTPUT_NAME "tntkafka") -install(TARGETS tntkafka LIBRARY DESTINATION ${TARANTOOL_INSTALL_LIBDIR}/tnt-kafka) -install(FILES init.lua DESTINATION ${TARANTOOL_INSTALL_LUADIR}/tnt-kafka) +install(TARGETS tntkafka LIBRARY DESTINATION ${TARANTOOL_INSTALL_LIBDIR}/kafka) +install(FILES init.lua DESTINATION ${TARANTOOL_INSTALL_LUADIR}/kafka) diff --git a/tnt-kafka/callbacks.c b/kafka/callbacks.c similarity index 100% rename from tnt-kafka/callbacks.c rename to kafka/callbacks.c diff --git a/tnt-kafka/callbacks.h b/kafka/callbacks.h similarity index 100% rename from tnt-kafka/callbacks.h rename to kafka/callbacks.h diff --git a/tnt-kafka/common.c b/kafka/common.c similarity index 100% rename from tnt-kafka/common.c rename to kafka/common.c diff --git a/tnt-kafka/common.h b/kafka/common.h similarity index 100% rename from tnt-kafka/common.h rename to kafka/common.h diff --git a/tnt-kafka/consumer.c b/kafka/consumer.c similarity index 100% rename from tnt-kafka/consumer.c rename to kafka/consumer.c diff --git a/tnt-kafka/consumer.h b/kafka/consumer.h similarity index 100% rename from tnt-kafka/consumer.h rename to kafka/consumer.h diff --git a/tnt-kafka/consumer_msg.c b/kafka/consumer_msg.c similarity index 100% rename from tnt-kafka/consumer_msg.c rename to kafka/consumer_msg.c diff --git a/tnt-kafka/consumer_msg.h b/kafka/consumer_msg.h similarity index 100% rename from tnt-kafka/consumer_msg.h rename to kafka/consumer_msg.h diff --git a/tnt-kafka/init.lua b/kafka/init.lua similarity index 99% rename from tnt-kafka/init.lua rename to kafka/init.lua index 14ad201..e402f1d 100644 --- a/tnt-kafka/init.lua +++ b/kafka/init.lua @@ -1,6 +1,6 @@ local log = require("log") local fiber = require('fiber') -local tnt_kafka = require("tnt-kafka.tntkafka") +local tnt_kafka = require("kafka.tntkafka") local Consumer = {} diff --git a/tnt-kafka/producer.c b/kafka/producer.c similarity index 100% rename from tnt-kafka/producer.c rename to kafka/producer.c diff --git a/tnt-kafka/producer.h b/kafka/producer.h similarity index 100% rename from tnt-kafka/producer.h rename to kafka/producer.h diff --git a/tnt-kafka/queue.c b/kafka/queue.c similarity index 100% rename from tnt-kafka/queue.c rename to kafka/queue.c diff --git a/tnt-kafka/queue.h b/kafka/queue.h similarity index 100% rename from tnt-kafka/queue.h rename to kafka/queue.h diff --git a/tnt-kafka/tnt_kafka.c b/kafka/tnt_kafka.c similarity index 100% rename from tnt-kafka/tnt_kafka.c rename to kafka/tnt_kafka.c diff --git a/tnt-kafka/tnt_kafka.h b/kafka/tnt_kafka.h similarity index 100% rename from tnt-kafka/tnt_kafka.h rename to kafka/tnt_kafka.h diff --git a/rockspecs/tnt-kafka-0.4.0-1.rockspec b/rockspecs/kafka-0.4.0-1.rockspec similarity index 96% rename from rockspecs/tnt-kafka-0.4.0-1.rockspec rename to rockspecs/kafka-0.4.0-1.rockspec index c0f2af3..97ecea0 100644 --- a/rockspecs/tnt-kafka-0.4.0-1.rockspec +++ b/rockspecs/kafka-0.4.0-1.rockspec @@ -1,4 +1,4 @@ -package = "tnt-kafka" +package = "kafka" version = "0.4.0-1" source = { url = "git://github.com/tarantool/tnt-kafka.git", diff --git a/rockspecs/tnt-kafka-0.4.1-1.rockspec b/rockspecs/kafka-0.4.1-1.rockspec similarity index 96% rename from rockspecs/tnt-kafka-0.4.1-1.rockspec rename to rockspecs/kafka-0.4.1-1.rockspec index 97cd488..8437350 100644 --- a/rockspecs/tnt-kafka-0.4.1-1.rockspec +++ b/rockspecs/kafka-0.4.1-1.rockspec @@ -1,4 +1,4 @@ -package = "tnt-kafka" +package = "kafka" version = "0.4.1-1" source = { url = "git://github.com/tarantool/tnt-kafka.git", diff --git a/rockspecs/tnt-kafka-dev-1.rockspec b/rockspecs/kafka-dev-1.rockspec similarity index 96% rename from rockspecs/tnt-kafka-dev-1.rockspec rename to rockspecs/kafka-dev-1.rockspec index 75b529f..cd24761 100644 --- a/rockspecs/tnt-kafka-dev-1.rockspec +++ b/rockspecs/kafka-dev-1.rockspec @@ -1,4 +1,4 @@ -package = "tnt-kafka" +package = "kafka" version = "dev-1" source = { url = "git://github.com/tarantool/tnt-kafka.git", diff --git a/rockspecs/tnt-kafka-scm-1.rockspec b/rockspecs/kafka-scm-1.rockspec similarity index 96% rename from rockspecs/tnt-kafka-scm-1.rockspec rename to rockspecs/kafka-scm-1.rockspec index 668bae3..51a2e4d 100644 --- a/rockspecs/tnt-kafka-scm-1.rockspec +++ b/rockspecs/kafka-scm-1.rockspec @@ -1,4 +1,4 @@ -package = "tnt-kafka" +package = "kafka" version = "scm-1" source = { url = "git://github.com/tarantool/tnt-kafka.git", diff --git a/rockspecs/tnt-kafka-0.3.4-1.rockspec b/rockspecs/tnt-kafka-0.3.4-1.rockspec deleted file mode 100644 index ff8a2e1..0000000 --- a/rockspecs/tnt-kafka-0.3.4-1.rockspec +++ /dev/null @@ -1,22 +0,0 @@ -package = "tnt-kafka" -version = "0.3.4-1" -source = { - url = "git://github.com/tarantool/tnt-kafka.git", - tag = "v0.3.4", -} -description = { - summary = "Kafka library for Tarantool", - homepage = "https://github.com/tarantool/tnt-kafka", - license = "Apache", -} -dependencies = { - "lua >= 5.1" -- actually tarantool > 1.6 -} -build = { - type = "builtin", - modules = { - ["tnt-kafka.consumer"] = "tnt-kafka/consumer.lua", - ["tnt-kafka.librdkafka"] = "tnt-kafka/librdkafka.lua", - ["tnt-kafka.producer"] = "tnt-kafka/producer.lua", - } -} diff --git a/tests/consumer.lua b/tests/consumer.lua index 2bb33ca..c6ec7e6 100644 --- a/tests/consumer.lua +++ b/tests/consumer.lua @@ -2,7 +2,7 @@ local box = require("box") local log = require("log") local os = require("os") local fiber = require('fiber') -local tnt_kafka = require('tnt-kafka') +local tnt_kafka = require('kafka') local consumer = nil local errors = {} diff --git a/tests/producer.lua b/tests/producer.lua index 4f4f22e..6f04459 100644 --- a/tests/producer.lua +++ b/tests/producer.lua @@ -2,7 +2,7 @@ local os = require('os') local box = require('box') local log = require('log') local fiber = require('fiber') -local tnt_kafka = require('tnt-kafka') +local tnt_kafka = require('kafka') local TOPIC_NAME = "test_producer"