feat remove fiber
This commit is contained in:
parent
fd8fdfc5f5
commit
966948c66b
@ -92,7 +92,7 @@ add_subdirectory("third_party/gflags")
|
|||||||
set(GFLAGS_USE_TARGET_NAMESPACE ON)
|
set(GFLAGS_USE_TARGET_NAMESPACE ON)
|
||||||
set(gflags_DIR "${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags")
|
set(gflags_DIR "${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags")
|
||||||
add_subdirectory("third_party/glog")
|
add_subdirectory("third_party/glog")
|
||||||
add_subdirectory("third_party/context")
|
# add_subdirectory("third_party/context")
|
||||||
|
|
||||||
set(CURL_DISABLE_TESTS ON)
|
set(CURL_DISABLE_TESTS ON)
|
||||||
set(CURL_CA_PATH
|
set(CURL_CA_PATH
|
||||||
@ -189,7 +189,7 @@ set(TILE_SRCS
|
|||||||
"tile/base/thread/scoped_lock.cc"
|
"tile/base/thread/scoped_lock.cc"
|
||||||
"tile/base/thread/spinlock.cc"
|
"tile/base/thread/spinlock.cc"
|
||||||
"tile/base/memory_barrier.cc"
|
"tile/base/memory_barrier.cc"
|
||||||
"tile/fiber/detail/fiber.cc"
|
# "tile/fiber/detail/fiber.cc"
|
||||||
"tile/io/detail/eintr_safe.cc"
|
"tile/io/detail/eintr_safe.cc"
|
||||||
"tile/io/native/acceptor.cc"
|
"tile/io/native/acceptor.cc"
|
||||||
"tile/io/descriptor.cc"
|
"tile/io/descriptor.cc"
|
||||||
@ -238,7 +238,8 @@ target_include_directories(
|
|||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
tile
|
tile
|
||||||
PUBLIC # -Wl,--start-group
|
PUBLIC # -Wl,--start-group
|
||||||
nova_context zlib gflags::gflags glog::glog
|
# nova_context
|
||||||
|
zlib gflags::gflags glog::glog
|
||||||
jsoncpp_static
|
jsoncpp_static
|
||||||
# -Wl,--end-group
|
# -Wl,--end-group
|
||||||
libcurl fmt)
|
libcurl fmt)
|
||||||
@ -291,7 +292,7 @@ if(TILE_BUILD_TESTS)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
tile_add_test(base_exposed_var_test "tile/base/exposed_var_test.cc")
|
tile_add_test(base_exposed_var_test "tile/base/exposed_var_test.cc")
|
||||||
tile_add_test(fiber_detail_scheduler_test "tile/fiber/detail/scheduler_test.cc")
|
# tile_add_test(fiber_detail_scheduler_test "tile/fiber/detail/scheduler_test.cc")
|
||||||
tile_add_test(base_internal_meta_test "tile/base/internal/meta_test.cc")
|
tile_add_test(base_internal_meta_test "tile/base/internal/meta_test.cc")
|
||||||
# tile_add_test(net_internal_http_engine_test
|
# tile_add_test(net_internal_http_engine_test
|
||||||
# "tile/net/internal/http_engine_test.cc")
|
# "tile/net/internal/http_engine_test.cc")
|
||||||
@ -380,7 +381,7 @@ if(TILE_BUILD_BENCHMARKS)
|
|||||||
target_sources(tile_bm_all PRIVATE ${benchmark_file})
|
target_sources(tile_bm_all PRIVATE ${benchmark_file})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
tile_add_bm(fiber_detail_fiber_benchmark "tile/fiber/detail/fiber_benchmark.cc")
|
# tile_add_bm(fiber_detail_fiber_benchmark "tile/fiber/detail/fiber_benchmark.cc")
|
||||||
tile_add_bm(base_casting_benchmark "tile/base/casting_benchmark.cc")
|
tile_add_bm(base_casting_benchmark "tile/base/casting_benchmark.cc")
|
||||||
tile_add_bm(base_thread_mutex_benchmark "tile/base/thread/mutex_benchmark.cc")
|
tile_add_bm(base_thread_mutex_benchmark "tile/base/thread/mutex_benchmark.cc")
|
||||||
tile_add_bm(base_encoding_benchmark "tile/base/encoding_benchmark.cc")
|
tile_add_bm(base_encoding_benchmark "tile/base/encoding_benchmark.cc")
|
||||||
|
@ -374,7 +374,7 @@ void HttpEngine::Join() {
|
|||||||
HttpEngine::HttpEngine() {
|
HttpEngine::HttpEngine() {
|
||||||
auto ret = curl_global_init(CURL_GLOBAL_DEFAULT);
|
auto ret = curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||||
TILE_CHECK(!ret, "Curl Init failed {}", ret);
|
TILE_CHECK(!ret, "Curl Init failed {}", ret);
|
||||||
for (auto i = 0; i < 1; ++i) {
|
for (auto i = 0; i < 5; ++i) {
|
||||||
curl_client_groups.push_back(make_unique<CurlClientGroup>(
|
curl_client_groups.push_back(make_unique<CurlClientGroup>(
|
||||||
FLAGS_tile_http_engine_workers_per_scheduling_group, i));
|
FLAGS_tile_http_engine_workers_per_scheduling_group, i));
|
||||||
}
|
}
|
||||||
|
65
tile/util/config.h
Normal file
65
tile/util/config.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#ifndef TILE_UTIL_CONFIG_H
|
||||||
|
#define TILE_UTIL_CONFIG_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "tile/base/ref_ptr.h"
|
||||||
|
#include "tile/base/slice.h"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace tile {
|
||||||
|
namespace util {
|
||||||
|
class Config : public RefCounted<Config> {
|
||||||
|
public:
|
||||||
|
using Keys = std::vector<std::string>;
|
||||||
|
using Ptr = RefPtr<Config>;
|
||||||
|
|
||||||
|
bool Has(const Slice &key) const;
|
||||||
|
|
||||||
|
#define TILE_DECLARE_CONFIG_GETTER(type, name) \
|
||||||
|
type Get##name(const Slice &key) const; \
|
||||||
|
type Get##name(const Slice &key, type default_value) const;
|
||||||
|
|
||||||
|
#define TILE_DECLARE_CONFIG_SETTER(type, name) \
|
||||||
|
virtual void Set##name(const Slice &key, type value);
|
||||||
|
|
||||||
|
std::string GetRawString(const Slice &key, const Slice &default_value) const;
|
||||||
|
|
||||||
|
// getters
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(std::string, String)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(int, Int)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(unsigned int, UInt)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(int16_t, Int16)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(int32_t, Int32)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(int64_t, Int64)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(uint16_t, UInt16)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(uint32_t, UInt32)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(uint64_t, UInt64)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(double, Double)
|
||||||
|
TILE_DECLARE_CONFIG_GETTER(bool, Bool)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// setters
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(const std::string &, String)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(int, Int)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(unsigned int, UInt)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(int16_t, Int16)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(int32_t, Int32)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(int64_t, Int64)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(uint16_t, UInt16)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(uint32_t, UInt32)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(uint64_t, UInt64)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(double, Double)
|
||||||
|
TILE_DECLARE_CONFIG_SETTER(bool, Bool)
|
||||||
|
|
||||||
|
#undef TILE_DECLARE_CONFIG_GETTER
|
||||||
|
#undef TILE_DECLARE_CONFIG_SETTER
|
||||||
|
|
||||||
|
void Remove(const Slice &key);
|
||||||
|
|
||||||
|
Keys keys(const Slice &key_root = "") const;
|
||||||
|
};
|
||||||
|
} // namespace util
|
||||||
|
} // namespace tile
|
||||||
|
|
||||||
|
#endif // TILE_UTIL_CONFIG_H
|
25
tile/util/layerd_config.h
Normal file
25
tile/util/layerd_config.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef TILE_UTIL_LAYERD_CONFIG_H
|
||||||
|
#define TILE_UTIL_LAYERD_CONFIG_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "tile/util/config.h"
|
||||||
|
|
||||||
|
namespace tile {
|
||||||
|
namespace util {
|
||||||
|
class LayerdConfig : public Config {
|
||||||
|
public:
|
||||||
|
protected:
|
||||||
|
struct ConfigItem {
|
||||||
|
Config::Ptr cfg;
|
||||||
|
// 1 < 2 < 3 < 4 ...
|
||||||
|
int priority;
|
||||||
|
// can remove or set new?
|
||||||
|
bool writeable;
|
||||||
|
std::string label;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} // namespace util
|
||||||
|
} // namespace tile
|
||||||
|
|
||||||
|
#endif // TILE_UTIL_LAYERD_CONFIG_H
|
Loading…
Reference in New Issue
Block a user