├── .idea ├── .gitignore ├── TSCached.iml ├── deployment.xml ├── misc.xml ├── modules.xml ├── statistic.xml └── vcs.xml ├── CMakeLists.txt ├── README.md ├── client.cpp ├── client ├── QueryResult.h ├── TSCachedClient.cpp ├── TSCachedClient.h └── WriteRequest.h ├── config.yaml ├── manager ├── ClearTaskManager.cpp ├── ClearTaskManager.h ├── Config.cpp ├── Config.h ├── Timer.cpp ├── Timer.h ├── TimerManager.cpp └── TimerManager.h ├── protobuf ├── data.proto ├── point.grpc.pb.cc ├── point.grpc.pb.h ├── point.pb.cc ├── point.pb.h └── point.proto ├── server.cpp ├── server ├── TSCachedServer.cpp ├── TSCachedServer.h ├── TSCachedServiceImpl.cpp ├── TSCachedServiceImpl.h └── banner.txt ├── storage ├── BlockData.cpp ├── BlockData.h ├── TimeSeries.cpp ├── TimeSeries.h ├── TimeSeriesMap.cpp └── TimeSeriesMap.h └── utils ├── PointUtils.cpp └── PointUtils.h /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /.idea/TSCached.iml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.idea/deployment.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/statistic.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(TSCached) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | 6 | include_directories(".") 7 | 8 | #假设已经安装好grpc了 9 | find_package(Threads REQUIRED) 10 | 11 | find_package( 12 | Boost 1.58.0 REQUIRED 13 | COMPONENTS 14 | filesystem 15 | system 16 | ) 17 | 18 | find_package(Folly REQUIRED) 19 | 20 | 21 | set(protobuf_MODULE_COMPATIBLE TRUE) 22 | find_package(Protobuf CONFIG REQUIRED) 23 | message(STATUS "Using protobuf ${Protobuf_VERSION}") 24 | 25 | set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) 26 | set(_REFLECTION gRPC::grpc++_reflection) 27 | 28 | 29 | # Find gRPC installation 30 | # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. 31 | find_package(gRPC CONFIG REQUIRED) 32 | message(STATUS "Using gRPC ${gRPC_VERSION}") 33 | 34 | set(_GRPC_GRPCPP gRPC::grpc++) 35 | 36 | SET(CMAKE_CXX_FLAGS -pthread) 37 | 38 | set(SOURCE_FILES storage/BlockData.h storage/BlockData.cpp storage/TimeSeries.h 39 | storage/TimeSeries.cpp storage/TimeSeriesMap.h storage/TimeSeriesMap.cpp protobuf/point.pb.h 40 | protobuf/point.pb.cc protobuf/point.grpc.pb.h protobuf/point.grpc.pb.cc server/TSCachedServiceImpl.h server/TSCachedServiceImpl.cpp 41 | utils/PointUtils.h utils/PointUtils.cpp manager/ClearTaskManager.h manager/ClearTaskManager.cpp 42 | manager/Config.cpp manager/Config.h manager/Timer.cpp manager/Timer.h manager/TimerManager.cpp manager/TimerManager.h 43 | server/TSCachedServer.cpp server/TSCachedServer.h client/TSCachedClient.cpp client/TSCachedClient.h client/QueryResult.h client/WriteRequest.h) 44 | 45 | file(GLOB files *.cpp) 46 | foreach(file ${files}) 47 | string(REGEX REPLACE ".+/(.+)\\..*" "\\1" exe ${file}) 48 | add_executable (${exe} ${file} ${SOURCE_FILES}) 49 | target_link_libraries(${exe} 50 | ${_REFLECTION} 51 | ${_GRPC_GRPCPP} 52 | ${_PROTOBUF_LIBPROTOBUF} 53 | ${FOLLY_LIBRARIES} 54 | Boost::filesystem 55 | libyaml-cpp.so) 56 | message (\ \ \ \ --\ src/${exe}.cpp\ will\ be\ compiled\ to\ bin/${exe}) 57 | endforeach() 58 | 59 | 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TSCached 2 | 一款内存时序数据库 3 | 4 | ## 压缩算法 5 | ![](https://lucas-blog.oss-cn-beijing.aliyuncs.com/blog-image/20210822111917.png) 6 | 7 | ## 内存结构 8 | ![](https://lucas-blog.oss-cn-beijing.aliyuncs.com/blog-image/20210822112012.png) -------------------------------------------------------------------------------- /client.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/21. 3 | // 4 | 5 | #include "client/TSCachedClient.h" 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | 11 | int main(){ 12 | string addr("127.0.0.1:50000"); 13 | TSCached::TSCachedClient tsCachedClient(addr); 14 | 15 | string dataBase = "test"; 16 | string tableName = "jzg"; 17 | google::protobuf::Map tags; 18 | tags["location"] = "shanghai"; 19 | tags["direction"] = "South"; 20 | WriteRequest writeRequest; 21 | Point point; 22 | std::cout<<"开始初始化.................\n"; 23 | //初始化 24 | point.set_database(dataBase); 25 | point.set_tablename(tableName); 26 | (*point.mutable_tags()) = tags; 27 | //插入100条数据 28 | for (int i = 0; i < 100; ++i) { 29 | Metrics metrics; 30 | metrics.set_timestamp(time(nullptr)+i); 31 | auto fields = metrics.mutable_fields(); 32 | (*fields)["temp"] = i+1; 33 | (*fields)["speed"] = i*i; 34 | point.mutable_metrics()->Add(std::move(metrics)); 35 | } 36 | writeRequest.mutable_points()->Add(std::move(point)); 37 | std::cout<<"开始写入数据...............\n"; 38 | WriteResponse writeResponse = 39 | tsCachedClient.WritePoints(writeRequest); 40 | if (writeResponse.statuscode() == TSCached::StatusCode::ERROR){ 41 | cout< 10 | #include 11 | 12 | namespace TSCached{ 13 | 14 | 15 | class QueryResult { 16 | public: 17 | //状态码 18 | enum Status{ 19 | OK, 20 | ERROR 21 | }; 22 | //构造函数 23 | QueryResult(Status status,std::string message,QueryResponse* queryResponse = nullptr): 24 | status_(status), 25 | message_(message), 26 | queryResponse_(queryResponse) 27 | {}; 28 | //析构函数 29 | ~QueryResult(){ 30 | delete queryResponse_; 31 | } 32 | //状态码 33 | Status status_; 34 | //查询信息 35 | std::string message_; 36 | //查询的数据集合 37 | QueryResponse* queryResponse_; 38 | }; 39 | 40 | 41 | } 42 | 43 | 44 | 45 | 46 | #endif //TSCACHED_QUERYRESULT_H 47 | -------------------------------------------------------------------------------- /client/TSCachedClient.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/21. 3 | // 4 | 5 | #include "TSCachedClient.h" 6 | 7 | using grpc::Status; 8 | 9 | namespace TSCached{ 10 | 11 | 12 | TSCached::TSCachedClient::TSCachedClient(std::string &serverAddress): 13 | serverAddress_(serverAddress), 14 | stub_(TSCachedService::NewStub( 15 | grpc::CreateChannel( 16 | serverAddress_, 17 | grpc::InsecureChannelCredentials()) 18 | )) 19 | { 20 | 21 | } 22 | 23 | QueryResponse TSCachedClient::QueryPoints(const QueryRequest &queryRequest) { 24 | assert(stub_); 25 | if (!queryRequest.IsInitialized()){ 26 | std::cout<<"QueryRequest has not initialized!\n"; 27 | return QueryResponse(); 28 | } 29 | QueryResponse queryResponse; 30 | //开始查询 31 | Status status = stub_->QueryPoints(new ClientContext(), 32 | queryRequest,&queryResponse); 33 | if (!status.ok()){ 34 | std::cout<<"Query Error ! Error Code : "<WritePoints(new ClientContext(), 48 | writeRequest,&writeResponse); 49 | if (!status.ok()){ 50 | std::cout<<"Write Error ! Error Code : "< 11 | 12 | #include 13 | 14 | using grpc::Channel; 15 | using grpc::ClientContext; 16 | using grpc::Status; 17 | using TSCached::TSCachedService; 18 | using TSCached::QueryResponse; 19 | using TSCached::QueryRequest; 20 | using TSCached::WriteResponse; 21 | using TSCached::WriteRequest; 22 | using TSCached::Metrics; 23 | using TSCached::Point; 24 | 25 | namespace TSCached{ 26 | 27 | 28 | class TSCachedClient { 29 | public: 30 | explicit TSCachedClient(std::string&); 31 | QueryResponse QueryPoints(const QueryRequest&); 32 | WriteResponse WritePoints(const WriteRequest&); 33 | private: 34 | std::string serverAddress_; 35 | std::unique_ptr stub_; 36 | }; 37 | 38 | 39 | } 40 | 41 | 42 | 43 | 44 | #endif //TSCACHED_TSCACHEDCLIENT_H 45 | -------------------------------------------------------------------------------- /client/WriteRequest.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/21. 3 | // 4 | 5 | #ifndef TSCACHED_WRITEREQUEST_H 6 | #define TSCACHED_WRITEREQUEST_H 7 | 8 | #endif //TSCACHED_WRITEREQUEST_H 9 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | #以下数据请根据实际内存容量以及数据量合理配置,必须为正数。 2 | 3 | #服务器监听的IP地址 4 | serverAddress: 127.0.0.1:50000 #默认地址 5 | 6 | #logo地址 7 | bannerPath: ./server/banner.txt 8 | 9 | #一个数据块接收数据的时间长度,超过这个时间将会关闭,并产生新的数据块,单位s 10 | changeDataBlockTime: 60 11 | 12 | #清理已删除时间序列的时间周期,单位s 13 | purgeTimeSeriesTime: 60 14 | 15 | #一个数据块的保留时间,单位s 16 | reserveDataBlockTime: 43200 #12*60*60 12小时 17 | 18 | #为避免回收时间序列太耗时太耗内存,限制一次最多回收的个数 19 | maxPurgeTimeSeriesNum: 100 20 | 21 | #最大内存使用限制,单位Byte 22 | maxMemoryUsage: 3221225472 #3*1024*1024*1024 3GB 23 | 24 | -------------------------------------------------------------------------------- /manager/ClearTaskManager.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/19. 3 | // 4 | 5 | #include "ClearTaskManager.h" 6 | 7 | namespace TSCached{ 8 | 9 | 10 | ClearTaskManager::ClearTaskManager( 11 | std::shared_ptr& timerManager): 12 | stop_(false),timerManager_(timerManager), 13 | expiredBlockClearThread_(&ClearTaskManager::ClearExpiredBlock, this), 14 | purgeThread_(&ClearTaskManager::Purge, this) 15 | { 16 | } 17 | 18 | ClearTaskManager::~ClearTaskManager() { 19 | stop_ = true; 20 | if (expiredBlockClearThread_.joinable()){ 21 | expiredBlockClearThread_.join(); 22 | } 23 | if (purgeThread_.joinable()){ 24 | purgeThread_.join(); 25 | } 26 | } 27 | 28 | void ClearTaskManager::Purge() { 29 | assert(timerManager_); 30 | while (!stop_){ 31 | if (timerManager_->Empty()){ 32 | continue; 33 | } 34 | if (timerManager_->GetRecentTimeOut()<=0){ 35 | timerManager_->RunAllTasks(); 36 | } 37 | std::this_thread::sleep_for(std::chrono::seconds(timerManager_->GetRecentTimeOut())); 38 | timerManager_->RunAllTasks(); 39 | } 40 | } 41 | void ClearTaskManager::ClearExpiredBlock() { 42 | assert(timerManager_); 43 | while (!stop_){ 44 | if (timerManager_->ExpiredEmpty()){ 45 | continue; 46 | } 47 | if (timerManager_->GetClearTaskRecentTimeOut()<=0){ 48 | timerManager_->RunAllClearTasks(); 49 | } 50 | std::this_thread::sleep_for(std::chrono::seconds(timerManager_->GetClearTaskRecentTimeOut())); 51 | timerManager_->RunAllClearTasks(); 52 | } 53 | } 54 | 55 | 56 | } -------------------------------------------------------------------------------- /manager/ClearTaskManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/19. 3 | // 4 | 5 | #ifndef TSCACHED_CLEARTASKMANAGER_H 6 | #define TSCACHED_CLEARTASKMANAGER_H 7 | 8 | #include "Config.h" 9 | #include "TimerManager.h" 10 | #include "storage/TimeSeriesMap.h" 11 | #include 12 | #include 13 | 14 | namespace TSCached{ 15 | 16 | class ClearTaskManager { 17 | public: 18 | explicit ClearTaskManager(std::shared_ptr&) ; 19 | ~ClearTaskManager(); 20 | void Purge(); 21 | void ClearExpiredBlock(); 22 | private: 23 | std::shared_ptr timerManager_; 24 | bool stop_; 25 | std::thread expiredBlockClearThread_; 26 | std::thread purgeThread_; 27 | }; 28 | 29 | } //TSCached 30 | 31 | 32 | 33 | 34 | #endif //TSCACHED_CLEARTASKMANAGER_H 35 | -------------------------------------------------------------------------------- /manager/Config.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/19. 3 | // 4 | 5 | #include "Config.h" 6 | -------------------------------------------------------------------------------- /manager/Config.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/19. 3 | // 4 | 5 | #ifndef TSCACHED_CONFIG_H 6 | #define TSCACHED_CONFIG_H 7 | 8 | #include 9 | #include 10 | 11 | namespace TSCached{ 12 | 13 | class Config { 14 | public: 15 | //服务器监听IP端口 16 | std::string serverAddress ; 17 | //logo文件路径 18 | std::string bannerPath; 19 | //一个数据块接收数据的时间长度,超过这个时间将会关闭,并产生新的数据块 20 | uint64_t changeDataBlockTime ; 21 | //清理已删除时间序列的时间周期 22 | uint64_t purgeTimeSeriesTime ; 23 | //一个数据块的保留时间 24 | uint64_t reserveDataBlockTime ; 25 | //为避免回收时间序列太耗时太耗内存,限制一次最多回收的个数 26 | uint64_t maxPurgeTimeSeriesNum ; 27 | //最大内存使用限制,以字节为单位 28 | uint64_t maxMemoryUsage ; 29 | }; 30 | 31 | } 32 | 33 | 34 | 35 | 36 | #endif //TSCACHED_CONFIG_H 37 | -------------------------------------------------------------------------------- /manager/Timer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/19. 3 | // 4 | 5 | #include "Timer.h" 6 | 7 | #include 8 | 9 | namespace TSCached{ 10 | 11 | Timer::Timer(uint64_t expire, Callback callback) 12 | :expire_(expire),callback_(callback) 13 | { 14 | } 15 | 16 | uint64_t Timer::GetExpireTime() const { 17 | return expire_; 18 | } 19 | 20 | void Timer::RunTask() { 21 | callback_(); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /manager/Timer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/19. 3 | // 4 | 5 | #ifndef TSCACHED_TIMER_H 6 | #define TSCACHED_TIMER_H 7 | #include 8 | 9 | 10 | namespace TSCached{ 11 | 12 | 13 | class Timer { 14 | public: 15 | typedef std::function Callback; 16 | 17 | Timer(uint64_t expire,Callback callback); 18 | 19 | //定时器函数调用接口 20 | void RunTask() ; 21 | [[nodiscard]] uint64_t GetExpireTime() const ; 22 | private: 23 | //回调函数 24 | Callback callback_; 25 | //超时时间 26 | uint64_t expire_; 27 | }; 28 | 29 | 30 | } 31 | 32 | 33 | 34 | 35 | #endif //TSCACHED_TIMER_H 36 | -------------------------------------------------------------------------------- /manager/TimerManager.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/19. 3 | // 4 | 5 | #include "TimerManager.h" 6 | 7 | namespace TSCached{ 8 | 9 | 10 | 11 | std::shared_ptr TimerManager::AddTimer(uint64_t timeout, const Timer::Callback& callback) { 12 | // RWLGuard guard(rwSpinLock_); 13 | std::shared_ptr timer = std::make_shared(timeout,callback); 14 | priorityQueue_.push(timer); 15 | return timer; 16 | } 17 | 18 | std::shared_ptr TimerManager::AddClearTimer(uint64_t timeout, const Timer::Callback &callback) { 19 | // RWLGuard guard(rwSpinLock_); 20 | std::shared_ptr timer = std::make_shared(timeout,callback); 21 | expiredBlockQueue_.push(timer); 22 | return timer; 23 | } 24 | 25 | int64_t TimerManager::GetClearTaskRecentTimeOut() const { 26 | // RWLSGuard guard(rwSpinLock_); 27 | time_t now = time(nullptr); 28 | return now - expiredBlockQueue_.top()->GetExpireTime(); 29 | } 30 | 31 | int64_t TimerManager::GetRecentTimeOut() const { 32 | // RWLSGuard guard(rwSpinLock_); 33 | time_t now = time(nullptr); 34 | return now - priorityQueue_.top()->GetExpireTime(); 35 | } 36 | 37 | 38 | void TimerManager::RunAllClearTasks() { 39 | // RWLSGuard guard(rwSpinLock_); 40 | time_t now = time(nullptr); 41 | while (!expiredBlockQueue_.empty() && expiredBlockQueue_.top()->GetExpireTime()<=now){ 42 | expiredBlockQueue_.top()->RunTask(); 43 | expiredBlockQueue_.pop(); 44 | } 45 | } 46 | void TimerManager::RunAllTasks() { 47 | // RWLSGuard guard(rwSpinLock_); 48 | time_t now = time(nullptr); 49 | while (!priorityQueue_.empty() && priorityQueue_.top()->GetExpireTime()<=now){ 50 | priorityQueue_.top()->RunTask(); 51 | priorityQueue_.pop(); 52 | } 53 | } 54 | 55 | bool TimerManager::ExpiredEmpty() const { 56 | // RWLSGuard guard(rwSpinLock_); 57 | return expiredBlockQueue_.empty(); 58 | } 59 | 60 | bool TimerManager::Empty() const { 61 | // RWLSGuard guard(rwSpinLock_); 62 | return priorityQueue_.empty(); 63 | } 64 | 65 | 66 | } 67 | 68 | 69 | -------------------------------------------------------------------------------- /manager/TimerManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/19. 3 | // 4 | 5 | #ifndef TSCACHED_TIMERMANAGER_H 6 | #define TSCACHED_TIMERMANAGER_H 7 | 8 | #include "Timer.h" 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | namespace TSCached{ 18 | 19 | class TimerManager { 20 | public: 21 | typedef std::lock_guard RWLGuard; 22 | typedef std::shared_lock RWLSGuard; 23 | 24 | TimerManager() = default; 25 | std::shared_ptr AddTimer(uint64_t timeout,const Timer::Callback& callback); 26 | std::shared_ptr AddClearTimer(uint64_t timeout,const Timer::Callback& callback); 27 | [[nodiscard]] int64_t GetRecentTimeOut() const ; 28 | [[nodiscard]] int64_t GetClearTaskRecentTimeOut() const ; 29 | //void DelTimer(std::shared_ptr timer); 30 | void RunAllTasks(); 31 | void RunAllClearTasks(); 32 | [[nodiscard]] bool Empty() const ; 33 | bool ExpiredEmpty() const ; 34 | 35 | private: 36 | struct cmp{ 37 | bool operator()(std::shared_ptr& lhs,std::shared_ptr& rhs){ 38 | return lhs->GetExpireTime() > rhs->GetExpireTime(); 39 | } 40 | }; 41 | 42 | mutable std::mutex mutex1_; 43 | mutable std::mutex mutex2_; 44 | // std::condition_variable_any 45 | // folly::MicroSpinLock microSpinLock_; 46 | // typedef folly::MSLGuard MSLGuard; 47 | //清理过期TS,新block结束周期的定时事件 48 | std::priority_queue, 49 | std::vector>, 50 | cmp> priorityQueue_; 51 | //清理过期block的定时事件 52 | std::priority_queue, 53 | std::vector>, 54 | cmp> expiredBlockQueue_; 55 | 56 | }; 57 | 58 | 59 | } 60 | 61 | 62 | 63 | #endif //TSCACHED_TIMERMANAGER_H 64 | -------------------------------------------------------------------------------- /protobuf/data.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package TSCached; 4 | 5 | //数据行 6 | message Field { 7 | map field = 1; 8 | map dataType = 2; 9 | } 10 | //带时间戳的单点数据 11 | message FieldWithTime{ 12 | int64 timeStamp = 1; 13 | map field = 2; 14 | map dataType = 3; 15 | } 16 | //单个点 17 | message Point{ 18 | string dataName = 1; 19 | string tableName = 2; 20 | map tags = 3; 21 | int64 timeStamp = 4; 22 | Field field = 5; 23 | } 24 | //多个点 25 | message Points{ 26 | string dataName = 1; 27 | string tableName = 2; 28 | map tags = 3; 29 | repeated FieldWithTime points = 4; 30 | } 31 | 32 | message QueryRequest{ 33 | string dataName = 1; 34 | string tableName = 2; 35 | map tags = 3; 36 | int64 startTime = 4; 37 | int64 endTime = 5; 38 | } 39 | message QueryResponse{ 40 | string msg = 1; //消息 41 | int32 code = 2; //返回状态码;0.成功;1.失败 42 | string dataName = 3; 43 | string tableName = 4; 44 | map tags = 5; 45 | repeated FieldWithTime points = 6; 46 | 47 | } 48 | 49 | message WriteResponse { 50 | string msg = 1; 51 | int32 code = 2; //0.成功;1.失败 52 | } 53 | 54 | service TSCachedService { 55 | rpc Query(QueryRequest) returns (QueryResponse) {} 56 | rpc Write(Point) returns (WriteResponse) {} 57 | rpc WriteBatch(Points) returns (WriteResponse) {} 58 | } -------------------------------------------------------------------------------- /protobuf/point.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: point.proto 4 | 5 | #include "point.pb.h" 6 | #include "point.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | namespace TSCached { 23 | 24 | static const char* TSCachedService_method_names[] = { 25 | "/TSCached.TSCachedService/QueryPoints", 26 | "/TSCached.TSCachedService/WritePoints", 27 | }; 28 | 29 | std::unique_ptr< TSCachedService::Stub> TSCachedService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { 30 | (void)options; 31 | std::unique_ptr< TSCachedService::Stub> stub(new TSCachedService::Stub(channel)); 32 | return stub; 33 | } 34 | 35 | TSCachedService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) 36 | : channel_(channel), rpcmethod_QueryPoints_(TSCachedService_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) 37 | , rpcmethod_WritePoints_(TSCachedService_method_names[1], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) 38 | {} 39 | 40 | ::grpc::Status TSCachedService::Stub::QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::TSCached::QueryResponse* response) { 41 | return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_QueryPoints_, context, request, response); 42 | } 43 | 44 | void TSCachedService::Stub::experimental_async::QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response, std::function f) { 45 | ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_QueryPoints_, context, request, response, std::move(f)); 46 | } 47 | 48 | void TSCachedService::Stub::experimental_async::QueryPoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::QueryResponse* response, std::function f) { 49 | ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_QueryPoints_, context, request, response, std::move(f)); 50 | } 51 | 52 | void TSCachedService::Stub::experimental_async::QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) { 53 | ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_QueryPoints_, context, request, response, reactor); 54 | } 55 | 56 | void TSCachedService::Stub::experimental_async::QueryPoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::QueryResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) { 57 | ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_QueryPoints_, context, request, response, reactor); 58 | } 59 | 60 | ::grpc::ClientAsyncResponseReader< ::TSCached::QueryResponse>* TSCachedService::Stub::AsyncQueryPointsRaw(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) { 61 | return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::TSCached::QueryResponse>::Create(channel_.get(), cq, rpcmethod_QueryPoints_, context, request, true); 62 | } 63 | 64 | ::grpc::ClientAsyncResponseReader< ::TSCached::QueryResponse>* TSCachedService::Stub::PrepareAsyncQueryPointsRaw(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) { 65 | return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::TSCached::QueryResponse>::Create(channel_.get(), cq, rpcmethod_QueryPoints_, context, request, false); 66 | } 67 | 68 | ::grpc::Status TSCachedService::Stub::WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::TSCached::WriteResponse* response) { 69 | return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_WritePoints_, context, request, response); 70 | } 71 | 72 | void TSCachedService::Stub::experimental_async::WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response, std::function f) { 73 | ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_WritePoints_, context, request, response, std::move(f)); 74 | } 75 | 76 | void TSCachedService::Stub::experimental_async::WritePoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::WriteResponse* response, std::function f) { 77 | ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_WritePoints_, context, request, response, std::move(f)); 78 | } 79 | 80 | void TSCachedService::Stub::experimental_async::WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) { 81 | ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_WritePoints_, context, request, response, reactor); 82 | } 83 | 84 | void TSCachedService::Stub::experimental_async::WritePoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::WriteResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) { 85 | ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_WritePoints_, context, request, response, reactor); 86 | } 87 | 88 | ::grpc::ClientAsyncResponseReader< ::TSCached::WriteResponse>* TSCachedService::Stub::AsyncWritePointsRaw(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) { 89 | return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::TSCached::WriteResponse>::Create(channel_.get(), cq, rpcmethod_WritePoints_, context, request, true); 90 | } 91 | 92 | ::grpc::ClientAsyncResponseReader< ::TSCached::WriteResponse>* TSCachedService::Stub::PrepareAsyncWritePointsRaw(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) { 93 | return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::TSCached::WriteResponse>::Create(channel_.get(), cq, rpcmethod_WritePoints_, context, request, false); 94 | } 95 | 96 | TSCachedService::Service::Service() { 97 | AddMethod(new ::grpc::internal::RpcServiceMethod( 98 | TSCachedService_method_names[0], 99 | ::grpc::internal::RpcMethod::NORMAL_RPC, 100 | new ::grpc::internal::RpcMethodHandler< TSCachedService::Service, ::TSCached::QueryRequest, ::TSCached::QueryResponse>( 101 | std::mem_fn(&TSCachedService::Service::QueryPoints), this))); 102 | AddMethod(new ::grpc::internal::RpcServiceMethod( 103 | TSCachedService_method_names[1], 104 | ::grpc::internal::RpcMethod::NORMAL_RPC, 105 | new ::grpc::internal::RpcMethodHandler< TSCachedService::Service, ::TSCached::WriteRequest, ::TSCached::WriteResponse>( 106 | std::mem_fn(&TSCachedService::Service::WritePoints), this))); 107 | } 108 | 109 | TSCachedService::Service::~Service() { 110 | } 111 | 112 | ::grpc::Status TSCachedService::Service::QueryPoints(::grpc::ServerContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response) { 113 | (void) context; 114 | (void) request; 115 | (void) response; 116 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 117 | } 118 | 119 | ::grpc::Status TSCachedService::Service::WritePoints(::grpc::ServerContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response) { 120 | (void) context; 121 | (void) request; 122 | (void) response; 123 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 124 | } 125 | 126 | 127 | } // namespace TSCached 128 | 129 | -------------------------------------------------------------------------------- /protobuf/point.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: point.proto 4 | #ifndef GRPC_point_2eproto__INCLUDED 5 | #define GRPC_point_2eproto__INCLUDED 6 | 7 | #include "point.pb.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace TSCached { 30 | 31 | class TSCachedService final { 32 | public: 33 | static constexpr char const* service_full_name() { 34 | return "TSCached.TSCachedService"; 35 | } 36 | class StubInterface { 37 | public: 38 | virtual ~StubInterface() {} 39 | virtual ::grpc::Status QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::TSCached::QueryResponse* response) = 0; 40 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::QueryResponse>> AsyncQueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) { 41 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::QueryResponse>>(AsyncQueryPointsRaw(context, request, cq)); 42 | } 43 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::QueryResponse>> PrepareAsyncQueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) { 44 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::QueryResponse>>(PrepareAsyncQueryPointsRaw(context, request, cq)); 45 | } 46 | virtual ::grpc::Status WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::TSCached::WriteResponse* response) = 0; 47 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::WriteResponse>> AsyncWritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) { 48 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::WriteResponse>>(AsyncWritePointsRaw(context, request, cq)); 49 | } 50 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::WriteResponse>> PrepareAsyncWritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) { 51 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::WriteResponse>>(PrepareAsyncWritePointsRaw(context, request, cq)); 52 | } 53 | class experimental_async_interface { 54 | public: 55 | virtual ~experimental_async_interface() {} 56 | virtual void QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response, std::function) = 0; 57 | virtual void QueryPoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::QueryResponse* response, std::function) = 0; 58 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 59 | virtual void QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; 60 | #else 61 | virtual void QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; 62 | #endif 63 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 64 | virtual void QueryPoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::QueryResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; 65 | #else 66 | virtual void QueryPoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::QueryResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; 67 | #endif 68 | virtual void WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response, std::function) = 0; 69 | virtual void WritePoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::WriteResponse* response, std::function) = 0; 70 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 71 | virtual void WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; 72 | #else 73 | virtual void WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; 74 | #endif 75 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 76 | virtual void WritePoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::WriteResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; 77 | #else 78 | virtual void WritePoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::WriteResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; 79 | #endif 80 | }; 81 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 82 | typedef class experimental_async_interface async_interface; 83 | #endif 84 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 85 | async_interface* async() { return experimental_async(); } 86 | #endif 87 | virtual class experimental_async_interface* experimental_async() { return nullptr; } 88 | private: 89 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::QueryResponse>* AsyncQueryPointsRaw(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) = 0; 90 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::QueryResponse>* PrepareAsyncQueryPointsRaw(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) = 0; 91 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::WriteResponse>* AsyncWritePointsRaw(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) = 0; 92 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::TSCached::WriteResponse>* PrepareAsyncWritePointsRaw(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) = 0; 93 | }; 94 | class Stub final : public StubInterface { 95 | public: 96 | Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); 97 | ::grpc::Status QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::TSCached::QueryResponse* response) override; 98 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::TSCached::QueryResponse>> AsyncQueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) { 99 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::TSCached::QueryResponse>>(AsyncQueryPointsRaw(context, request, cq)); 100 | } 101 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::TSCached::QueryResponse>> PrepareAsyncQueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) { 102 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::TSCached::QueryResponse>>(PrepareAsyncQueryPointsRaw(context, request, cq)); 103 | } 104 | ::grpc::Status WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::TSCached::WriteResponse* response) override; 105 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::TSCached::WriteResponse>> AsyncWritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) { 106 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::TSCached::WriteResponse>>(AsyncWritePointsRaw(context, request, cq)); 107 | } 108 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::TSCached::WriteResponse>> PrepareAsyncWritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) { 109 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::TSCached::WriteResponse>>(PrepareAsyncWritePointsRaw(context, request, cq)); 110 | } 111 | class experimental_async final : 112 | public StubInterface::experimental_async_interface { 113 | public: 114 | void QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response, std::function) override; 115 | void QueryPoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::QueryResponse* response, std::function) override; 116 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 117 | void QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response, ::grpc::ClientUnaryReactor* reactor) override; 118 | #else 119 | void QueryPoints(::grpc::ClientContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; 120 | #endif 121 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 122 | void QueryPoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::QueryResponse* response, ::grpc::ClientUnaryReactor* reactor) override; 123 | #else 124 | void QueryPoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::QueryResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; 125 | #endif 126 | void WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response, std::function) override; 127 | void WritePoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::WriteResponse* response, std::function) override; 128 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 129 | void WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response, ::grpc::ClientUnaryReactor* reactor) override; 130 | #else 131 | void WritePoints(::grpc::ClientContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; 132 | #endif 133 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 134 | void WritePoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::WriteResponse* response, ::grpc::ClientUnaryReactor* reactor) override; 135 | #else 136 | void WritePoints(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::TSCached::WriteResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; 137 | #endif 138 | private: 139 | friend class Stub; 140 | explicit experimental_async(Stub* stub): stub_(stub) { } 141 | Stub* stub() { return stub_; } 142 | Stub* stub_; 143 | }; 144 | class experimental_async_interface* experimental_async() override { return &async_stub_; } 145 | 146 | private: 147 | std::shared_ptr< ::grpc::ChannelInterface> channel_; 148 | class experimental_async async_stub_{this}; 149 | ::grpc::ClientAsyncResponseReader< ::TSCached::QueryResponse>* AsyncQueryPointsRaw(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) override; 150 | ::grpc::ClientAsyncResponseReader< ::TSCached::QueryResponse>* PrepareAsyncQueryPointsRaw(::grpc::ClientContext* context, const ::TSCached::QueryRequest& request, ::grpc::CompletionQueue* cq) override; 151 | ::grpc::ClientAsyncResponseReader< ::TSCached::WriteResponse>* AsyncWritePointsRaw(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) override; 152 | ::grpc::ClientAsyncResponseReader< ::TSCached::WriteResponse>* PrepareAsyncWritePointsRaw(::grpc::ClientContext* context, const ::TSCached::WriteRequest& request, ::grpc::CompletionQueue* cq) override; 153 | const ::grpc::internal::RpcMethod rpcmethod_QueryPoints_; 154 | const ::grpc::internal::RpcMethod rpcmethod_WritePoints_; 155 | }; 156 | static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); 157 | 158 | class Service : public ::grpc::Service { 159 | public: 160 | Service(); 161 | virtual ~Service(); 162 | virtual ::grpc::Status QueryPoints(::grpc::ServerContext* context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response); 163 | virtual ::grpc::Status WritePoints(::grpc::ServerContext* context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response); 164 | }; 165 | template 166 | class WithAsyncMethod_QueryPoints : public BaseClass { 167 | private: 168 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 169 | public: 170 | WithAsyncMethod_QueryPoints() { 171 | ::grpc::Service::MarkMethodAsync(0); 172 | } 173 | ~WithAsyncMethod_QueryPoints() override { 174 | BaseClassMustBeDerivedFromService(this); 175 | } 176 | // disable synchronous version of this method 177 | ::grpc::Status QueryPoints(::grpc::ServerContext* /*context*/, const ::TSCached::QueryRequest* /*request*/, ::TSCached::QueryResponse* /*response*/) override { 178 | abort(); 179 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 180 | } 181 | void RequestQueryPoints(::grpc::ServerContext* context, ::TSCached::QueryRequest* request, ::grpc::ServerAsyncResponseWriter< ::TSCached::QueryResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 182 | ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); 183 | } 184 | }; 185 | template 186 | class WithAsyncMethod_WritePoints : public BaseClass { 187 | private: 188 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 189 | public: 190 | WithAsyncMethod_WritePoints() { 191 | ::grpc::Service::MarkMethodAsync(1); 192 | } 193 | ~WithAsyncMethod_WritePoints() override { 194 | BaseClassMustBeDerivedFromService(this); 195 | } 196 | // disable synchronous version of this method 197 | ::grpc::Status WritePoints(::grpc::ServerContext* /*context*/, const ::TSCached::WriteRequest* /*request*/, ::TSCached::WriteResponse* /*response*/) override { 198 | abort(); 199 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 200 | } 201 | void RequestWritePoints(::grpc::ServerContext* context, ::TSCached::WriteRequest* request, ::grpc::ServerAsyncResponseWriter< ::TSCached::WriteResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 202 | ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); 203 | } 204 | }; 205 | typedef WithAsyncMethod_QueryPoints > AsyncService; 206 | template 207 | class ExperimentalWithCallbackMethod_QueryPoints : public BaseClass { 208 | private: 209 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 210 | public: 211 | ExperimentalWithCallbackMethod_QueryPoints() { 212 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 213 | ::grpc::Service:: 214 | #else 215 | ::grpc::Service::experimental(). 216 | #endif 217 | MarkMethodCallback(0, 218 | new ::grpc_impl::internal::CallbackUnaryHandler< ::TSCached::QueryRequest, ::TSCached::QueryResponse>( 219 | [this]( 220 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 221 | ::grpc::CallbackServerContext* 222 | #else 223 | ::grpc::experimental::CallbackServerContext* 224 | #endif 225 | context, const ::TSCached::QueryRequest* request, ::TSCached::QueryResponse* response) { return this->QueryPoints(context, request, response); }));} 226 | void SetMessageAllocatorFor_QueryPoints( 227 | ::grpc::experimental::MessageAllocator< ::TSCached::QueryRequest, ::TSCached::QueryResponse>* allocator) { 228 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 229 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0); 230 | #else 231 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(0); 232 | #endif 233 | static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::TSCached::QueryRequest, ::TSCached::QueryResponse>*>(handler) 234 | ->SetMessageAllocator(allocator); 235 | } 236 | ~ExperimentalWithCallbackMethod_QueryPoints() override { 237 | BaseClassMustBeDerivedFromService(this); 238 | } 239 | // disable synchronous version of this method 240 | ::grpc::Status QueryPoints(::grpc::ServerContext* /*context*/, const ::TSCached::QueryRequest* /*request*/, ::TSCached::QueryResponse* /*response*/) override { 241 | abort(); 242 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 243 | } 244 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 245 | virtual ::grpc::ServerUnaryReactor* QueryPoints( 246 | ::grpc::CallbackServerContext* /*context*/, const ::TSCached::QueryRequest* /*request*/, ::TSCached::QueryResponse* /*response*/) 247 | #else 248 | virtual ::grpc::experimental::ServerUnaryReactor* QueryPoints( 249 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::TSCached::QueryRequest* /*request*/, ::TSCached::QueryResponse* /*response*/) 250 | #endif 251 | { return nullptr; } 252 | }; 253 | template 254 | class ExperimentalWithCallbackMethod_WritePoints : public BaseClass { 255 | private: 256 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 257 | public: 258 | ExperimentalWithCallbackMethod_WritePoints() { 259 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 260 | ::grpc::Service:: 261 | #else 262 | ::grpc::Service::experimental(). 263 | #endif 264 | MarkMethodCallback(1, 265 | new ::grpc_impl::internal::CallbackUnaryHandler< ::TSCached::WriteRequest, ::TSCached::WriteResponse>( 266 | [this]( 267 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 268 | ::grpc::CallbackServerContext* 269 | #else 270 | ::grpc::experimental::CallbackServerContext* 271 | #endif 272 | context, const ::TSCached::WriteRequest* request, ::TSCached::WriteResponse* response) { return this->WritePoints(context, request, response); }));} 273 | void SetMessageAllocatorFor_WritePoints( 274 | ::grpc::experimental::MessageAllocator< ::TSCached::WriteRequest, ::TSCached::WriteResponse>* allocator) { 275 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 276 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(1); 277 | #else 278 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(1); 279 | #endif 280 | static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::TSCached::WriteRequest, ::TSCached::WriteResponse>*>(handler) 281 | ->SetMessageAllocator(allocator); 282 | } 283 | ~ExperimentalWithCallbackMethod_WritePoints() override { 284 | BaseClassMustBeDerivedFromService(this); 285 | } 286 | // disable synchronous version of this method 287 | ::grpc::Status WritePoints(::grpc::ServerContext* /*context*/, const ::TSCached::WriteRequest* /*request*/, ::TSCached::WriteResponse* /*response*/) override { 288 | abort(); 289 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 290 | } 291 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 292 | virtual ::grpc::ServerUnaryReactor* WritePoints( 293 | ::grpc::CallbackServerContext* /*context*/, const ::TSCached::WriteRequest* /*request*/, ::TSCached::WriteResponse* /*response*/) 294 | #else 295 | virtual ::grpc::experimental::ServerUnaryReactor* WritePoints( 296 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::TSCached::WriteRequest* /*request*/, ::TSCached::WriteResponse* /*response*/) 297 | #endif 298 | { return nullptr; } 299 | }; 300 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 301 | typedef ExperimentalWithCallbackMethod_QueryPoints > CallbackService; 302 | #endif 303 | 304 | typedef ExperimentalWithCallbackMethod_QueryPoints > ExperimentalCallbackService; 305 | template 306 | class WithGenericMethod_QueryPoints : public BaseClass { 307 | private: 308 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 309 | public: 310 | WithGenericMethod_QueryPoints() { 311 | ::grpc::Service::MarkMethodGeneric(0); 312 | } 313 | ~WithGenericMethod_QueryPoints() override { 314 | BaseClassMustBeDerivedFromService(this); 315 | } 316 | // disable synchronous version of this method 317 | ::grpc::Status QueryPoints(::grpc::ServerContext* /*context*/, const ::TSCached::QueryRequest* /*request*/, ::TSCached::QueryResponse* /*response*/) override { 318 | abort(); 319 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 320 | } 321 | }; 322 | template 323 | class WithGenericMethod_WritePoints : public BaseClass { 324 | private: 325 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 326 | public: 327 | WithGenericMethod_WritePoints() { 328 | ::grpc::Service::MarkMethodGeneric(1); 329 | } 330 | ~WithGenericMethod_WritePoints() override { 331 | BaseClassMustBeDerivedFromService(this); 332 | } 333 | // disable synchronous version of this method 334 | ::grpc::Status WritePoints(::grpc::ServerContext* /*context*/, const ::TSCached::WriteRequest* /*request*/, ::TSCached::WriteResponse* /*response*/) override { 335 | abort(); 336 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 337 | } 338 | }; 339 | template 340 | class WithRawMethod_QueryPoints : public BaseClass { 341 | private: 342 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 343 | public: 344 | WithRawMethod_QueryPoints() { 345 | ::grpc::Service::MarkMethodRaw(0); 346 | } 347 | ~WithRawMethod_QueryPoints() override { 348 | BaseClassMustBeDerivedFromService(this); 349 | } 350 | // disable synchronous version of this method 351 | ::grpc::Status QueryPoints(::grpc::ServerContext* /*context*/, const ::TSCached::QueryRequest* /*request*/, ::TSCached::QueryResponse* /*response*/) override { 352 | abort(); 353 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 354 | } 355 | void RequestQueryPoints(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 356 | ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); 357 | } 358 | }; 359 | template 360 | class WithRawMethod_WritePoints : public BaseClass { 361 | private: 362 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 363 | public: 364 | WithRawMethod_WritePoints() { 365 | ::grpc::Service::MarkMethodRaw(1); 366 | } 367 | ~WithRawMethod_WritePoints() override { 368 | BaseClassMustBeDerivedFromService(this); 369 | } 370 | // disable synchronous version of this method 371 | ::grpc::Status WritePoints(::grpc::ServerContext* /*context*/, const ::TSCached::WriteRequest* /*request*/, ::TSCached::WriteResponse* /*response*/) override { 372 | abort(); 373 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 374 | } 375 | void RequestWritePoints(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 376 | ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); 377 | } 378 | }; 379 | template 380 | class ExperimentalWithRawCallbackMethod_QueryPoints : public BaseClass { 381 | private: 382 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 383 | public: 384 | ExperimentalWithRawCallbackMethod_QueryPoints() { 385 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 386 | ::grpc::Service:: 387 | #else 388 | ::grpc::Service::experimental(). 389 | #endif 390 | MarkMethodRawCallback(0, 391 | new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( 392 | [this]( 393 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 394 | ::grpc::CallbackServerContext* 395 | #else 396 | ::grpc::experimental::CallbackServerContext* 397 | #endif 398 | context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->QueryPoints(context, request, response); })); 399 | } 400 | ~ExperimentalWithRawCallbackMethod_QueryPoints() override { 401 | BaseClassMustBeDerivedFromService(this); 402 | } 403 | // disable synchronous version of this method 404 | ::grpc::Status QueryPoints(::grpc::ServerContext* /*context*/, const ::TSCached::QueryRequest* /*request*/, ::TSCached::QueryResponse* /*response*/) override { 405 | abort(); 406 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 407 | } 408 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 409 | virtual ::grpc::ServerUnaryReactor* QueryPoints( 410 | ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 411 | #else 412 | virtual ::grpc::experimental::ServerUnaryReactor* QueryPoints( 413 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 414 | #endif 415 | { return nullptr; } 416 | }; 417 | template 418 | class ExperimentalWithRawCallbackMethod_WritePoints : public BaseClass { 419 | private: 420 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 421 | public: 422 | ExperimentalWithRawCallbackMethod_WritePoints() { 423 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 424 | ::grpc::Service:: 425 | #else 426 | ::grpc::Service::experimental(). 427 | #endif 428 | MarkMethodRawCallback(1, 429 | new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( 430 | [this]( 431 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 432 | ::grpc::CallbackServerContext* 433 | #else 434 | ::grpc::experimental::CallbackServerContext* 435 | #endif 436 | context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->WritePoints(context, request, response); })); 437 | } 438 | ~ExperimentalWithRawCallbackMethod_WritePoints() override { 439 | BaseClassMustBeDerivedFromService(this); 440 | } 441 | // disable synchronous version of this method 442 | ::grpc::Status WritePoints(::grpc::ServerContext* /*context*/, const ::TSCached::WriteRequest* /*request*/, ::TSCached::WriteResponse* /*response*/) override { 443 | abort(); 444 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 445 | } 446 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 447 | virtual ::grpc::ServerUnaryReactor* WritePoints( 448 | ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 449 | #else 450 | virtual ::grpc::experimental::ServerUnaryReactor* WritePoints( 451 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 452 | #endif 453 | { return nullptr; } 454 | }; 455 | template 456 | class WithStreamedUnaryMethod_QueryPoints : public BaseClass { 457 | private: 458 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 459 | public: 460 | WithStreamedUnaryMethod_QueryPoints() { 461 | ::grpc::Service::MarkMethodStreamed(0, 462 | new ::grpc::internal::StreamedUnaryHandler< ::TSCached::QueryRequest, ::TSCached::QueryResponse>(std::bind(&WithStreamedUnaryMethod_QueryPoints::StreamedQueryPoints, this, std::placeholders::_1, std::placeholders::_2))); 463 | } 464 | ~WithStreamedUnaryMethod_QueryPoints() override { 465 | BaseClassMustBeDerivedFromService(this); 466 | } 467 | // disable regular version of this method 468 | ::grpc::Status QueryPoints(::grpc::ServerContext* /*context*/, const ::TSCached::QueryRequest* /*request*/, ::TSCached::QueryResponse* /*response*/) override { 469 | abort(); 470 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 471 | } 472 | // replace default version of method with streamed unary 473 | virtual ::grpc::Status StreamedQueryPoints(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::TSCached::QueryRequest,::TSCached::QueryResponse>* server_unary_streamer) = 0; 474 | }; 475 | template 476 | class WithStreamedUnaryMethod_WritePoints : public BaseClass { 477 | private: 478 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 479 | public: 480 | WithStreamedUnaryMethod_WritePoints() { 481 | ::grpc::Service::MarkMethodStreamed(1, 482 | new ::grpc::internal::StreamedUnaryHandler< ::TSCached::WriteRequest, ::TSCached::WriteResponse>(std::bind(&WithStreamedUnaryMethod_WritePoints::StreamedWritePoints, this, std::placeholders::_1, std::placeholders::_2))); 483 | } 484 | ~WithStreamedUnaryMethod_WritePoints() override { 485 | BaseClassMustBeDerivedFromService(this); 486 | } 487 | // disable regular version of this method 488 | ::grpc::Status WritePoints(::grpc::ServerContext* /*context*/, const ::TSCached::WriteRequest* /*request*/, ::TSCached::WriteResponse* /*response*/) override { 489 | abort(); 490 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 491 | } 492 | // replace default version of method with streamed unary 493 | virtual ::grpc::Status StreamedWritePoints(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::TSCached::WriteRequest,::TSCached::WriteResponse>* server_unary_streamer) = 0; 494 | }; 495 | typedef WithStreamedUnaryMethod_QueryPoints > StreamedUnaryService; 496 | typedef Service SplitStreamedService; 497 | typedef WithStreamedUnaryMethod_QueryPoints > StreamedService; 498 | }; 499 | 500 | } // namespace TSCached 501 | 502 | 503 | #endif // GRPC_point_2eproto__INCLUDED 504 | -------------------------------------------------------------------------------- /protobuf/point.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: point.proto 3 | 4 | #ifndef GOOGLE_PROTOBUF_INCLUDED_point_2eproto 5 | #define GOOGLE_PROTOBUF_INCLUDED_point_2eproto 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #if PROTOBUF_VERSION < 3011000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 3011002 < PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include // IWYU pragma: export 33 | #include // IWYU pragma: export 34 | #include // IWYU pragma: export 35 | #include 36 | #include 37 | #include 38 | #include 39 | // @@protoc_insertion_point(includes) 40 | #include 41 | #define PROTOBUF_INTERNAL_EXPORT_point_2eproto 42 | PROTOBUF_NAMESPACE_OPEN 43 | namespace internal { 44 | class AnyMetadata; 45 | } // namespace internal 46 | PROTOBUF_NAMESPACE_CLOSE 47 | 48 | // Internal implementation detail -- do not use these members. 49 | struct TableStruct_point_2eproto { 50 | static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] 51 | PROTOBUF_SECTION_VARIABLE(protodesc_cold); 52 | static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] 53 | PROTOBUF_SECTION_VARIABLE(protodesc_cold); 54 | static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[10] 55 | PROTOBUF_SECTION_VARIABLE(protodesc_cold); 56 | static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; 57 | static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; 58 | static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; 59 | }; 60 | extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_point_2eproto; 61 | namespace TSCached { 62 | class Metrics; 63 | class MetricsDefaultTypeInternal; 64 | extern MetricsDefaultTypeInternal _Metrics_default_instance_; 65 | class Metrics_FieldsEntry_DoNotUse; 66 | class Metrics_FieldsEntry_DoNotUseDefaultTypeInternal; 67 | extern Metrics_FieldsEntry_DoNotUseDefaultTypeInternal _Metrics_FieldsEntry_DoNotUse_default_instance_; 68 | class Point; 69 | class PointDefaultTypeInternal; 70 | extern PointDefaultTypeInternal _Point_default_instance_; 71 | class Point_TagsEntry_DoNotUse; 72 | class Point_TagsEntry_DoNotUseDefaultTypeInternal; 73 | extern Point_TagsEntry_DoNotUseDefaultTypeInternal _Point_TagsEntry_DoNotUse_default_instance_; 74 | class QueryRequest; 75 | class QueryRequestDefaultTypeInternal; 76 | extern QueryRequestDefaultTypeInternal _QueryRequest_default_instance_; 77 | class QueryRequest_TagsEntry_DoNotUse; 78 | class QueryRequest_TagsEntry_DoNotUseDefaultTypeInternal; 79 | extern QueryRequest_TagsEntry_DoNotUseDefaultTypeInternal _QueryRequest_TagsEntry_DoNotUse_default_instance_; 80 | class QueryResponse; 81 | class QueryResponseDefaultTypeInternal; 82 | extern QueryResponseDefaultTypeInternal _QueryResponse_default_instance_; 83 | class QueryResponse_TagsEntry_DoNotUse; 84 | class QueryResponse_TagsEntry_DoNotUseDefaultTypeInternal; 85 | extern QueryResponse_TagsEntry_DoNotUseDefaultTypeInternal _QueryResponse_TagsEntry_DoNotUse_default_instance_; 86 | class WriteRequest; 87 | class WriteRequestDefaultTypeInternal; 88 | extern WriteRequestDefaultTypeInternal _WriteRequest_default_instance_; 89 | class WriteResponse; 90 | class WriteResponseDefaultTypeInternal; 91 | extern WriteResponseDefaultTypeInternal _WriteResponse_default_instance_; 92 | } // namespace TSCached 93 | PROTOBUF_NAMESPACE_OPEN 94 | template<> ::TSCached::Metrics* Arena::CreateMaybeMessage<::TSCached::Metrics>(Arena*); 95 | template<> ::TSCached::Metrics_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage<::TSCached::Metrics_FieldsEntry_DoNotUse>(Arena*); 96 | template<> ::TSCached::Point* Arena::CreateMaybeMessage<::TSCached::Point>(Arena*); 97 | template<> ::TSCached::Point_TagsEntry_DoNotUse* Arena::CreateMaybeMessage<::TSCached::Point_TagsEntry_DoNotUse>(Arena*); 98 | template<> ::TSCached::QueryRequest* Arena::CreateMaybeMessage<::TSCached::QueryRequest>(Arena*); 99 | template<> ::TSCached::QueryRequest_TagsEntry_DoNotUse* Arena::CreateMaybeMessage<::TSCached::QueryRequest_TagsEntry_DoNotUse>(Arena*); 100 | template<> ::TSCached::QueryResponse* Arena::CreateMaybeMessage<::TSCached::QueryResponse>(Arena*); 101 | template<> ::TSCached::QueryResponse_TagsEntry_DoNotUse* Arena::CreateMaybeMessage<::TSCached::QueryResponse_TagsEntry_DoNotUse>(Arena*); 102 | template<> ::TSCached::WriteRequest* Arena::CreateMaybeMessage<::TSCached::WriteRequest>(Arena*); 103 | template<> ::TSCached::WriteResponse* Arena::CreateMaybeMessage<::TSCached::WriteResponse>(Arena*); 104 | PROTOBUF_NAMESPACE_CLOSE 105 | namespace TSCached { 106 | 107 | enum StatusCode : int { 108 | OK = 0, 109 | ERROR = 1, 110 | StatusCode_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), 111 | StatusCode_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() 112 | }; 113 | bool StatusCode_IsValid(int value); 114 | constexpr StatusCode StatusCode_MIN = OK; 115 | constexpr StatusCode StatusCode_MAX = ERROR; 116 | constexpr int StatusCode_ARRAYSIZE = StatusCode_MAX + 1; 117 | 118 | const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* StatusCode_descriptor(); 119 | template 120 | inline const std::string& StatusCode_Name(T enum_t_value) { 121 | static_assert(::std::is_same::value || 122 | ::std::is_integral::value, 123 | "Incorrect type passed to function StatusCode_Name."); 124 | return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( 125 | StatusCode_descriptor(), enum_t_value); 126 | } 127 | inline bool StatusCode_Parse( 128 | const std::string& name, StatusCode* value) { 129 | return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( 130 | StatusCode_descriptor(), name, value); 131 | } 132 | // =================================================================== 133 | 134 | class Metrics_FieldsEntry_DoNotUse : public ::PROTOBUF_NAMESPACE_ID::internal::MapEntry { 139 | public: 140 | typedef ::PROTOBUF_NAMESPACE_ID::internal::MapEntry SuperType; 145 | Metrics_FieldsEntry_DoNotUse(); 146 | Metrics_FieldsEntry_DoNotUse(::PROTOBUF_NAMESPACE_ID::Arena* arena); 147 | void MergeFrom(const Metrics_FieldsEntry_DoNotUse& other); 148 | static const Metrics_FieldsEntry_DoNotUse* internal_default_instance() { return reinterpret_cast(&_Metrics_FieldsEntry_DoNotUse_default_instance_); } 149 | static bool ValidateKey(std::string* s) { 150 | return ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(s->data(), static_cast(s->size()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, "TSCached.Metrics.FieldsEntry.key"); 151 | } 152 | static bool ValidateValue(void*) { return true; } 153 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& other) final; 154 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 155 | private: 156 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 157 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 158 | return ::descriptor_table_point_2eproto.file_level_metadata[0]; 159 | } 160 | 161 | public: 162 | }; 163 | 164 | // ------------------------------------------------------------------- 165 | 166 | class Metrics : 167 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:TSCached.Metrics) */ { 168 | public: 169 | Metrics(); 170 | virtual ~Metrics(); 171 | 172 | Metrics(const Metrics& from); 173 | Metrics(Metrics&& from) noexcept 174 | : Metrics() { 175 | *this = ::std::move(from); 176 | } 177 | 178 | inline Metrics& operator=(const Metrics& from) { 179 | CopyFrom(from); 180 | return *this; 181 | } 182 | inline Metrics& operator=(Metrics&& from) noexcept { 183 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 184 | if (this != &from) InternalSwap(&from); 185 | } else { 186 | CopyFrom(from); 187 | } 188 | return *this; 189 | } 190 | 191 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 192 | return GetDescriptor(); 193 | } 194 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 195 | return GetMetadataStatic().descriptor; 196 | } 197 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 198 | return GetMetadataStatic().reflection; 199 | } 200 | static const Metrics& default_instance(); 201 | 202 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 203 | static inline const Metrics* internal_default_instance() { 204 | return reinterpret_cast( 205 | &_Metrics_default_instance_); 206 | } 207 | static constexpr int kIndexInFileMessages = 208 | 1; 209 | 210 | friend void swap(Metrics& a, Metrics& b) { 211 | a.Swap(&b); 212 | } 213 | inline void Swap(Metrics* other) { 214 | if (other == this) return; 215 | InternalSwap(other); 216 | } 217 | 218 | // implements Message ---------------------------------------------- 219 | 220 | inline Metrics* New() const final { 221 | return CreateMaybeMessage(nullptr); 222 | } 223 | 224 | Metrics* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 225 | return CreateMaybeMessage(arena); 226 | } 227 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 228 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 229 | void CopyFrom(const Metrics& from); 230 | void MergeFrom(const Metrics& from); 231 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 232 | bool IsInitialized() const final; 233 | 234 | size_t ByteSizeLong() const final; 235 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 236 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 237 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 238 | int GetCachedSize() const final { return _cached_size_.Get(); } 239 | 240 | private: 241 | inline void SharedCtor(); 242 | inline void SharedDtor(); 243 | void SetCachedSize(int size) const final; 244 | void InternalSwap(Metrics* other); 245 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 246 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 247 | return "TSCached.Metrics"; 248 | } 249 | private: 250 | inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { 251 | return nullptr; 252 | } 253 | inline void* MaybeArenaPtr() const { 254 | return nullptr; 255 | } 256 | public: 257 | 258 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 259 | private: 260 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 261 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 262 | return ::descriptor_table_point_2eproto.file_level_metadata[kIndexInFileMessages]; 263 | } 264 | 265 | public: 266 | 267 | // nested types ---------------------------------------------------- 268 | 269 | 270 | // accessors ------------------------------------------------------- 271 | 272 | enum : int { 273 | kFieldsFieldNumber = 2, 274 | kTimeStampFieldNumber = 1, 275 | }; 276 | // map fields = 2; 277 | int fields_size() const; 278 | private: 279 | int _internal_fields_size() const; 280 | public: 281 | void clear_fields(); 282 | private: 283 | const ::PROTOBUF_NAMESPACE_ID::Map< std::string, double >& 284 | _internal_fields() const; 285 | ::PROTOBUF_NAMESPACE_ID::Map< std::string, double >* 286 | _internal_mutable_fields(); 287 | public: 288 | const ::PROTOBUF_NAMESPACE_ID::Map< std::string, double >& 289 | fields() const; 290 | ::PROTOBUF_NAMESPACE_ID::Map< std::string, double >* 291 | mutable_fields(); 292 | 293 | // int64 timeStamp = 1; 294 | void clear_timestamp(); 295 | ::PROTOBUF_NAMESPACE_ID::int64 timestamp() const; 296 | void set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value); 297 | private: 298 | ::PROTOBUF_NAMESPACE_ID::int64 _internal_timestamp() const; 299 | void _internal_set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value); 300 | public: 301 | 302 | // @@protoc_insertion_point(class_scope:TSCached.Metrics) 303 | private: 304 | class _Internal; 305 | 306 | ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; 307 | ::PROTOBUF_NAMESPACE_ID::internal::MapField< 308 | Metrics_FieldsEntry_DoNotUse, 309 | std::string, double, 310 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, 311 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_DOUBLE, 312 | 0 > fields_; 313 | ::PROTOBUF_NAMESPACE_ID::int64 timestamp_; 314 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 315 | friend struct ::TableStruct_point_2eproto; 316 | }; 317 | // ------------------------------------------------------------------- 318 | 319 | class Point_TagsEntry_DoNotUse : public ::PROTOBUF_NAMESPACE_ID::internal::MapEntry { 324 | public: 325 | typedef ::PROTOBUF_NAMESPACE_ID::internal::MapEntry SuperType; 330 | Point_TagsEntry_DoNotUse(); 331 | Point_TagsEntry_DoNotUse(::PROTOBUF_NAMESPACE_ID::Arena* arena); 332 | void MergeFrom(const Point_TagsEntry_DoNotUse& other); 333 | static const Point_TagsEntry_DoNotUse* internal_default_instance() { return reinterpret_cast(&_Point_TagsEntry_DoNotUse_default_instance_); } 334 | static bool ValidateKey(std::string* s) { 335 | return ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(s->data(), static_cast(s->size()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, "TSCached.Point.TagsEntry.key"); 336 | } 337 | static bool ValidateValue(std::string* s) { 338 | return ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(s->data(), static_cast(s->size()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, "TSCached.Point.TagsEntry.value"); 339 | } 340 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& other) final; 341 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 342 | private: 343 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 344 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 345 | return ::descriptor_table_point_2eproto.file_level_metadata[2]; 346 | } 347 | 348 | public: 349 | }; 350 | 351 | // ------------------------------------------------------------------- 352 | 353 | class Point : 354 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:TSCached.Point) */ { 355 | public: 356 | Point(); 357 | virtual ~Point(); 358 | 359 | Point(const Point& from); 360 | Point(Point&& from) noexcept 361 | : Point() { 362 | *this = ::std::move(from); 363 | } 364 | 365 | inline Point& operator=(const Point& from) { 366 | CopyFrom(from); 367 | return *this; 368 | } 369 | inline Point& operator=(Point&& from) noexcept { 370 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 371 | if (this != &from) InternalSwap(&from); 372 | } else { 373 | CopyFrom(from); 374 | } 375 | return *this; 376 | } 377 | 378 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 379 | return GetDescriptor(); 380 | } 381 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 382 | return GetMetadataStatic().descriptor; 383 | } 384 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 385 | return GetMetadataStatic().reflection; 386 | } 387 | static const Point& default_instance(); 388 | 389 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 390 | static inline const Point* internal_default_instance() { 391 | return reinterpret_cast( 392 | &_Point_default_instance_); 393 | } 394 | static constexpr int kIndexInFileMessages = 395 | 3; 396 | 397 | friend void swap(Point& a, Point& b) { 398 | a.Swap(&b); 399 | } 400 | inline void Swap(Point* other) { 401 | if (other == this) return; 402 | InternalSwap(other); 403 | } 404 | 405 | // implements Message ---------------------------------------------- 406 | 407 | inline Point* New() const final { 408 | return CreateMaybeMessage(nullptr); 409 | } 410 | 411 | Point* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 412 | return CreateMaybeMessage(arena); 413 | } 414 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 415 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 416 | void CopyFrom(const Point& from); 417 | void MergeFrom(const Point& from); 418 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 419 | bool IsInitialized() const final; 420 | 421 | size_t ByteSizeLong() const final; 422 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 423 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 424 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 425 | int GetCachedSize() const final { return _cached_size_.Get(); } 426 | 427 | private: 428 | inline void SharedCtor(); 429 | inline void SharedDtor(); 430 | void SetCachedSize(int size) const final; 431 | void InternalSwap(Point* other); 432 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 433 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 434 | return "TSCached.Point"; 435 | } 436 | private: 437 | inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { 438 | return nullptr; 439 | } 440 | inline void* MaybeArenaPtr() const { 441 | return nullptr; 442 | } 443 | public: 444 | 445 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 446 | private: 447 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 448 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 449 | return ::descriptor_table_point_2eproto.file_level_metadata[kIndexInFileMessages]; 450 | } 451 | 452 | public: 453 | 454 | // nested types ---------------------------------------------------- 455 | 456 | 457 | // accessors ------------------------------------------------------- 458 | 459 | enum : int { 460 | kTagsFieldNumber = 3, 461 | kMetricsFieldNumber = 4, 462 | kDataBaseFieldNumber = 1, 463 | kTableNameFieldNumber = 2, 464 | }; 465 | // map tags = 3; 466 | int tags_size() const; 467 | private: 468 | int _internal_tags_size() const; 469 | public: 470 | void clear_tags(); 471 | private: 472 | const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 473 | _internal_tags() const; 474 | ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 475 | _internal_mutable_tags(); 476 | public: 477 | const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 478 | tags() const; 479 | ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 480 | mutable_tags(); 481 | 482 | // repeated .TSCached.Metrics metrics = 4; 483 | int metrics_size() const; 484 | private: 485 | int _internal_metrics_size() const; 486 | public: 487 | void clear_metrics(); 488 | ::TSCached::Metrics* mutable_metrics(int index); 489 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics >* 490 | mutable_metrics(); 491 | private: 492 | const ::TSCached::Metrics& _internal_metrics(int index) const; 493 | ::TSCached::Metrics* _internal_add_metrics(); 494 | public: 495 | const ::TSCached::Metrics& metrics(int index) const; 496 | ::TSCached::Metrics* add_metrics(); 497 | const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics >& 498 | metrics() const; 499 | 500 | // string dataBase = 1; 501 | void clear_database(); 502 | const std::string& database() const; 503 | void set_database(const std::string& value); 504 | void set_database(std::string&& value); 505 | void set_database(const char* value); 506 | void set_database(const char* value, size_t size); 507 | std::string* mutable_database(); 508 | std::string* release_database(); 509 | void set_allocated_database(std::string* database); 510 | private: 511 | const std::string& _internal_database() const; 512 | void _internal_set_database(const std::string& value); 513 | std::string* _internal_mutable_database(); 514 | public: 515 | 516 | // string tableName = 2; 517 | void clear_tablename(); 518 | const std::string& tablename() const; 519 | void set_tablename(const std::string& value); 520 | void set_tablename(std::string&& value); 521 | void set_tablename(const char* value); 522 | void set_tablename(const char* value, size_t size); 523 | std::string* mutable_tablename(); 524 | std::string* release_tablename(); 525 | void set_allocated_tablename(std::string* tablename); 526 | private: 527 | const std::string& _internal_tablename() const; 528 | void _internal_set_tablename(const std::string& value); 529 | std::string* _internal_mutable_tablename(); 530 | public: 531 | 532 | // @@protoc_insertion_point(class_scope:TSCached.Point) 533 | private: 534 | class _Internal; 535 | 536 | ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; 537 | ::PROTOBUF_NAMESPACE_ID::internal::MapField< 538 | Point_TagsEntry_DoNotUse, 539 | std::string, std::string, 540 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, 541 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, 542 | 0 > tags_; 543 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics > metrics_; 544 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr database_; 545 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr tablename_; 546 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 547 | friend struct ::TableStruct_point_2eproto; 548 | }; 549 | // ------------------------------------------------------------------- 550 | 551 | class QueryRequest_TagsEntry_DoNotUse : public ::PROTOBUF_NAMESPACE_ID::internal::MapEntry { 556 | public: 557 | typedef ::PROTOBUF_NAMESPACE_ID::internal::MapEntry SuperType; 562 | QueryRequest_TagsEntry_DoNotUse(); 563 | QueryRequest_TagsEntry_DoNotUse(::PROTOBUF_NAMESPACE_ID::Arena* arena); 564 | void MergeFrom(const QueryRequest_TagsEntry_DoNotUse& other); 565 | static const QueryRequest_TagsEntry_DoNotUse* internal_default_instance() { return reinterpret_cast(&_QueryRequest_TagsEntry_DoNotUse_default_instance_); } 566 | static bool ValidateKey(std::string* s) { 567 | return ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(s->data(), static_cast(s->size()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, "TSCached.QueryRequest.TagsEntry.key"); 568 | } 569 | static bool ValidateValue(std::string* s) { 570 | return ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(s->data(), static_cast(s->size()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, "TSCached.QueryRequest.TagsEntry.value"); 571 | } 572 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& other) final; 573 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 574 | private: 575 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 576 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 577 | return ::descriptor_table_point_2eproto.file_level_metadata[4]; 578 | } 579 | 580 | public: 581 | }; 582 | 583 | // ------------------------------------------------------------------- 584 | 585 | class QueryRequest : 586 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:TSCached.QueryRequest) */ { 587 | public: 588 | QueryRequest(); 589 | virtual ~QueryRequest(); 590 | 591 | QueryRequest(const QueryRequest& from); 592 | QueryRequest(QueryRequest&& from) noexcept 593 | : QueryRequest() { 594 | *this = ::std::move(from); 595 | } 596 | 597 | inline QueryRequest& operator=(const QueryRequest& from) { 598 | CopyFrom(from); 599 | return *this; 600 | } 601 | inline QueryRequest& operator=(QueryRequest&& from) noexcept { 602 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 603 | if (this != &from) InternalSwap(&from); 604 | } else { 605 | CopyFrom(from); 606 | } 607 | return *this; 608 | } 609 | 610 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 611 | return GetDescriptor(); 612 | } 613 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 614 | return GetMetadataStatic().descriptor; 615 | } 616 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 617 | return GetMetadataStatic().reflection; 618 | } 619 | static const QueryRequest& default_instance(); 620 | 621 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 622 | static inline const QueryRequest* internal_default_instance() { 623 | return reinterpret_cast( 624 | &_QueryRequest_default_instance_); 625 | } 626 | static constexpr int kIndexInFileMessages = 627 | 5; 628 | 629 | friend void swap(QueryRequest& a, QueryRequest& b) { 630 | a.Swap(&b); 631 | } 632 | inline void Swap(QueryRequest* other) { 633 | if (other == this) return; 634 | InternalSwap(other); 635 | } 636 | 637 | // implements Message ---------------------------------------------- 638 | 639 | inline QueryRequest* New() const final { 640 | return CreateMaybeMessage(nullptr); 641 | } 642 | 643 | QueryRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 644 | return CreateMaybeMessage(arena); 645 | } 646 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 647 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 648 | void CopyFrom(const QueryRequest& from); 649 | void MergeFrom(const QueryRequest& from); 650 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 651 | bool IsInitialized() const final; 652 | 653 | size_t ByteSizeLong() const final; 654 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 655 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 656 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 657 | int GetCachedSize() const final { return _cached_size_.Get(); } 658 | 659 | private: 660 | inline void SharedCtor(); 661 | inline void SharedDtor(); 662 | void SetCachedSize(int size) const final; 663 | void InternalSwap(QueryRequest* other); 664 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 665 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 666 | return "TSCached.QueryRequest"; 667 | } 668 | private: 669 | inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { 670 | return nullptr; 671 | } 672 | inline void* MaybeArenaPtr() const { 673 | return nullptr; 674 | } 675 | public: 676 | 677 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 678 | private: 679 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 680 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 681 | return ::descriptor_table_point_2eproto.file_level_metadata[kIndexInFileMessages]; 682 | } 683 | 684 | public: 685 | 686 | // nested types ---------------------------------------------------- 687 | 688 | 689 | // accessors ------------------------------------------------------- 690 | 691 | enum : int { 692 | kTagsFieldNumber = 3, 693 | kDataBaseFieldNumber = 1, 694 | kTableNameFieldNumber = 2, 695 | kStartTimeFieldNumber = 4, 696 | kEndTimeFieldNumber = 5, 697 | }; 698 | // map tags = 3; 699 | int tags_size() const; 700 | private: 701 | int _internal_tags_size() const; 702 | public: 703 | void clear_tags(); 704 | private: 705 | const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 706 | _internal_tags() const; 707 | ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 708 | _internal_mutable_tags(); 709 | public: 710 | const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 711 | tags() const; 712 | ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 713 | mutable_tags(); 714 | 715 | // string dataBase = 1; 716 | void clear_database(); 717 | const std::string& database() const; 718 | void set_database(const std::string& value); 719 | void set_database(std::string&& value); 720 | void set_database(const char* value); 721 | void set_database(const char* value, size_t size); 722 | std::string* mutable_database(); 723 | std::string* release_database(); 724 | void set_allocated_database(std::string* database); 725 | private: 726 | const std::string& _internal_database() const; 727 | void _internal_set_database(const std::string& value); 728 | std::string* _internal_mutable_database(); 729 | public: 730 | 731 | // string tableName = 2; 732 | void clear_tablename(); 733 | const std::string& tablename() const; 734 | void set_tablename(const std::string& value); 735 | void set_tablename(std::string&& value); 736 | void set_tablename(const char* value); 737 | void set_tablename(const char* value, size_t size); 738 | std::string* mutable_tablename(); 739 | std::string* release_tablename(); 740 | void set_allocated_tablename(std::string* tablename); 741 | private: 742 | const std::string& _internal_tablename() const; 743 | void _internal_set_tablename(const std::string& value); 744 | std::string* _internal_mutable_tablename(); 745 | public: 746 | 747 | // int64 startTime = 4; 748 | void clear_starttime(); 749 | ::PROTOBUF_NAMESPACE_ID::int64 starttime() const; 750 | void set_starttime(::PROTOBUF_NAMESPACE_ID::int64 value); 751 | private: 752 | ::PROTOBUF_NAMESPACE_ID::int64 _internal_starttime() const; 753 | void _internal_set_starttime(::PROTOBUF_NAMESPACE_ID::int64 value); 754 | public: 755 | 756 | // int64 endTime = 5; 757 | void clear_endtime(); 758 | ::PROTOBUF_NAMESPACE_ID::int64 endtime() const; 759 | void set_endtime(::PROTOBUF_NAMESPACE_ID::int64 value); 760 | private: 761 | ::PROTOBUF_NAMESPACE_ID::int64 _internal_endtime() const; 762 | void _internal_set_endtime(::PROTOBUF_NAMESPACE_ID::int64 value); 763 | public: 764 | 765 | // @@protoc_insertion_point(class_scope:TSCached.QueryRequest) 766 | private: 767 | class _Internal; 768 | 769 | ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; 770 | ::PROTOBUF_NAMESPACE_ID::internal::MapField< 771 | QueryRequest_TagsEntry_DoNotUse, 772 | std::string, std::string, 773 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, 774 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, 775 | 0 > tags_; 776 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr database_; 777 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr tablename_; 778 | ::PROTOBUF_NAMESPACE_ID::int64 starttime_; 779 | ::PROTOBUF_NAMESPACE_ID::int64 endtime_; 780 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 781 | friend struct ::TableStruct_point_2eproto; 782 | }; 783 | // ------------------------------------------------------------------- 784 | 785 | class QueryResponse_TagsEntry_DoNotUse : public ::PROTOBUF_NAMESPACE_ID::internal::MapEntry { 790 | public: 791 | typedef ::PROTOBUF_NAMESPACE_ID::internal::MapEntry SuperType; 796 | QueryResponse_TagsEntry_DoNotUse(); 797 | QueryResponse_TagsEntry_DoNotUse(::PROTOBUF_NAMESPACE_ID::Arena* arena); 798 | void MergeFrom(const QueryResponse_TagsEntry_DoNotUse& other); 799 | static const QueryResponse_TagsEntry_DoNotUse* internal_default_instance() { return reinterpret_cast(&_QueryResponse_TagsEntry_DoNotUse_default_instance_); } 800 | static bool ValidateKey(std::string* s) { 801 | return ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(s->data(), static_cast(s->size()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, "TSCached.QueryResponse.TagsEntry.key"); 802 | } 803 | static bool ValidateValue(std::string* s) { 804 | return ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(s->data(), static_cast(s->size()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE, "TSCached.QueryResponse.TagsEntry.value"); 805 | } 806 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& other) final; 807 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 808 | private: 809 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 810 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 811 | return ::descriptor_table_point_2eproto.file_level_metadata[6]; 812 | } 813 | 814 | public: 815 | }; 816 | 817 | // ------------------------------------------------------------------- 818 | 819 | class QueryResponse : 820 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:TSCached.QueryResponse) */ { 821 | public: 822 | QueryResponse(); 823 | virtual ~QueryResponse(); 824 | 825 | QueryResponse(const QueryResponse& from); 826 | QueryResponse(QueryResponse&& from) noexcept 827 | : QueryResponse() { 828 | *this = ::std::move(from); 829 | } 830 | 831 | inline QueryResponse& operator=(const QueryResponse& from) { 832 | CopyFrom(from); 833 | return *this; 834 | } 835 | inline QueryResponse& operator=(QueryResponse&& from) noexcept { 836 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 837 | if (this != &from) InternalSwap(&from); 838 | } else { 839 | CopyFrom(from); 840 | } 841 | return *this; 842 | } 843 | 844 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 845 | return GetDescriptor(); 846 | } 847 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 848 | return GetMetadataStatic().descriptor; 849 | } 850 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 851 | return GetMetadataStatic().reflection; 852 | } 853 | static const QueryResponse& default_instance(); 854 | 855 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 856 | static inline const QueryResponse* internal_default_instance() { 857 | return reinterpret_cast( 858 | &_QueryResponse_default_instance_); 859 | } 860 | static constexpr int kIndexInFileMessages = 861 | 7; 862 | 863 | friend void swap(QueryResponse& a, QueryResponse& b) { 864 | a.Swap(&b); 865 | } 866 | inline void Swap(QueryResponse* other) { 867 | if (other == this) return; 868 | InternalSwap(other); 869 | } 870 | 871 | // implements Message ---------------------------------------------- 872 | 873 | inline QueryResponse* New() const final { 874 | return CreateMaybeMessage(nullptr); 875 | } 876 | 877 | QueryResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 878 | return CreateMaybeMessage(arena); 879 | } 880 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 881 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 882 | void CopyFrom(const QueryResponse& from); 883 | void MergeFrom(const QueryResponse& from); 884 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 885 | bool IsInitialized() const final; 886 | 887 | size_t ByteSizeLong() const final; 888 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 889 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 890 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 891 | int GetCachedSize() const final { return _cached_size_.Get(); } 892 | 893 | private: 894 | inline void SharedCtor(); 895 | inline void SharedDtor(); 896 | void SetCachedSize(int size) const final; 897 | void InternalSwap(QueryResponse* other); 898 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 899 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 900 | return "TSCached.QueryResponse"; 901 | } 902 | private: 903 | inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { 904 | return nullptr; 905 | } 906 | inline void* MaybeArenaPtr() const { 907 | return nullptr; 908 | } 909 | public: 910 | 911 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 912 | private: 913 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 914 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 915 | return ::descriptor_table_point_2eproto.file_level_metadata[kIndexInFileMessages]; 916 | } 917 | 918 | public: 919 | 920 | // nested types ---------------------------------------------------- 921 | 922 | 923 | // accessors ------------------------------------------------------- 924 | 925 | enum : int { 926 | kTagsFieldNumber = 3, 927 | kMetricsFieldNumber = 4, 928 | kDataBaseFieldNumber = 1, 929 | kTableNameFieldNumber = 2, 930 | }; 931 | // map tags = 3; 932 | int tags_size() const; 933 | private: 934 | int _internal_tags_size() const; 935 | public: 936 | void clear_tags(); 937 | private: 938 | const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 939 | _internal_tags() const; 940 | ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 941 | _internal_mutable_tags(); 942 | public: 943 | const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 944 | tags() const; 945 | ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 946 | mutable_tags(); 947 | 948 | // repeated .TSCached.Metrics metrics = 4; 949 | int metrics_size() const; 950 | private: 951 | int _internal_metrics_size() const; 952 | public: 953 | void clear_metrics(); 954 | ::TSCached::Metrics* mutable_metrics(int index); 955 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics >* 956 | mutable_metrics(); 957 | private: 958 | const ::TSCached::Metrics& _internal_metrics(int index) const; 959 | ::TSCached::Metrics* _internal_add_metrics(); 960 | public: 961 | const ::TSCached::Metrics& metrics(int index) const; 962 | ::TSCached::Metrics* add_metrics(); 963 | const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics >& 964 | metrics() const; 965 | 966 | // string dataBase = 1; 967 | void clear_database(); 968 | const std::string& database() const; 969 | void set_database(const std::string& value); 970 | void set_database(std::string&& value); 971 | void set_database(const char* value); 972 | void set_database(const char* value, size_t size); 973 | std::string* mutable_database(); 974 | std::string* release_database(); 975 | void set_allocated_database(std::string* database); 976 | private: 977 | const std::string& _internal_database() const; 978 | void _internal_set_database(const std::string& value); 979 | std::string* _internal_mutable_database(); 980 | public: 981 | 982 | // string tableName = 2; 983 | void clear_tablename(); 984 | const std::string& tablename() const; 985 | void set_tablename(const std::string& value); 986 | void set_tablename(std::string&& value); 987 | void set_tablename(const char* value); 988 | void set_tablename(const char* value, size_t size); 989 | std::string* mutable_tablename(); 990 | std::string* release_tablename(); 991 | void set_allocated_tablename(std::string* tablename); 992 | private: 993 | const std::string& _internal_tablename() const; 994 | void _internal_set_tablename(const std::string& value); 995 | std::string* _internal_mutable_tablename(); 996 | public: 997 | 998 | // @@protoc_insertion_point(class_scope:TSCached.QueryResponse) 999 | private: 1000 | class _Internal; 1001 | 1002 | ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; 1003 | ::PROTOBUF_NAMESPACE_ID::internal::MapField< 1004 | QueryResponse_TagsEntry_DoNotUse, 1005 | std::string, std::string, 1006 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, 1007 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, 1008 | 0 > tags_; 1009 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics > metrics_; 1010 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr database_; 1011 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr tablename_; 1012 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 1013 | friend struct ::TableStruct_point_2eproto; 1014 | }; 1015 | // ------------------------------------------------------------------- 1016 | 1017 | class WriteRequest : 1018 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:TSCached.WriteRequest) */ { 1019 | public: 1020 | WriteRequest(); 1021 | virtual ~WriteRequest(); 1022 | 1023 | WriteRequest(const WriteRequest& from); 1024 | WriteRequest(WriteRequest&& from) noexcept 1025 | : WriteRequest() { 1026 | *this = ::std::move(from); 1027 | } 1028 | 1029 | inline WriteRequest& operator=(const WriteRequest& from) { 1030 | CopyFrom(from); 1031 | return *this; 1032 | } 1033 | inline WriteRequest& operator=(WriteRequest&& from) noexcept { 1034 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 1035 | if (this != &from) InternalSwap(&from); 1036 | } else { 1037 | CopyFrom(from); 1038 | } 1039 | return *this; 1040 | } 1041 | 1042 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 1043 | return GetDescriptor(); 1044 | } 1045 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 1046 | return GetMetadataStatic().descriptor; 1047 | } 1048 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 1049 | return GetMetadataStatic().reflection; 1050 | } 1051 | static const WriteRequest& default_instance(); 1052 | 1053 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 1054 | static inline const WriteRequest* internal_default_instance() { 1055 | return reinterpret_cast( 1056 | &_WriteRequest_default_instance_); 1057 | } 1058 | static constexpr int kIndexInFileMessages = 1059 | 8; 1060 | 1061 | friend void swap(WriteRequest& a, WriteRequest& b) { 1062 | a.Swap(&b); 1063 | } 1064 | inline void Swap(WriteRequest* other) { 1065 | if (other == this) return; 1066 | InternalSwap(other); 1067 | } 1068 | 1069 | // implements Message ---------------------------------------------- 1070 | 1071 | inline WriteRequest* New() const final { 1072 | return CreateMaybeMessage(nullptr); 1073 | } 1074 | 1075 | WriteRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 1076 | return CreateMaybeMessage(arena); 1077 | } 1078 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 1079 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 1080 | void CopyFrom(const WriteRequest& from); 1081 | void MergeFrom(const WriteRequest& from); 1082 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 1083 | bool IsInitialized() const final; 1084 | 1085 | size_t ByteSizeLong() const final; 1086 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 1087 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 1088 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 1089 | int GetCachedSize() const final { return _cached_size_.Get(); } 1090 | 1091 | private: 1092 | inline void SharedCtor(); 1093 | inline void SharedDtor(); 1094 | void SetCachedSize(int size) const final; 1095 | void InternalSwap(WriteRequest* other); 1096 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 1097 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 1098 | return "TSCached.WriteRequest"; 1099 | } 1100 | private: 1101 | inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { 1102 | return nullptr; 1103 | } 1104 | inline void* MaybeArenaPtr() const { 1105 | return nullptr; 1106 | } 1107 | public: 1108 | 1109 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 1110 | private: 1111 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 1112 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 1113 | return ::descriptor_table_point_2eproto.file_level_metadata[kIndexInFileMessages]; 1114 | } 1115 | 1116 | public: 1117 | 1118 | // nested types ---------------------------------------------------- 1119 | 1120 | // accessors ------------------------------------------------------- 1121 | 1122 | enum : int { 1123 | kPointsFieldNumber = 1, 1124 | }; 1125 | // repeated .TSCached.Point points = 1; 1126 | int points_size() const; 1127 | private: 1128 | int _internal_points_size() const; 1129 | public: 1130 | void clear_points(); 1131 | ::TSCached::Point* mutable_points(int index); 1132 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Point >* 1133 | mutable_points(); 1134 | private: 1135 | const ::TSCached::Point& _internal_points(int index) const; 1136 | ::TSCached::Point* _internal_add_points(); 1137 | public: 1138 | const ::TSCached::Point& points(int index) const; 1139 | ::TSCached::Point* add_points(); 1140 | const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Point >& 1141 | points() const; 1142 | 1143 | // @@protoc_insertion_point(class_scope:TSCached.WriteRequest) 1144 | private: 1145 | class _Internal; 1146 | 1147 | ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; 1148 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Point > points_; 1149 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 1150 | friend struct ::TableStruct_point_2eproto; 1151 | }; 1152 | // ------------------------------------------------------------------- 1153 | 1154 | class WriteResponse : 1155 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:TSCached.WriteResponse) */ { 1156 | public: 1157 | WriteResponse(); 1158 | virtual ~WriteResponse(); 1159 | 1160 | WriteResponse(const WriteResponse& from); 1161 | WriteResponse(WriteResponse&& from) noexcept 1162 | : WriteResponse() { 1163 | *this = ::std::move(from); 1164 | } 1165 | 1166 | inline WriteResponse& operator=(const WriteResponse& from) { 1167 | CopyFrom(from); 1168 | return *this; 1169 | } 1170 | inline WriteResponse& operator=(WriteResponse&& from) noexcept { 1171 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 1172 | if (this != &from) InternalSwap(&from); 1173 | } else { 1174 | CopyFrom(from); 1175 | } 1176 | return *this; 1177 | } 1178 | 1179 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 1180 | return GetDescriptor(); 1181 | } 1182 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 1183 | return GetMetadataStatic().descriptor; 1184 | } 1185 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 1186 | return GetMetadataStatic().reflection; 1187 | } 1188 | static const WriteResponse& default_instance(); 1189 | 1190 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 1191 | static inline const WriteResponse* internal_default_instance() { 1192 | return reinterpret_cast( 1193 | &_WriteResponse_default_instance_); 1194 | } 1195 | static constexpr int kIndexInFileMessages = 1196 | 9; 1197 | 1198 | friend void swap(WriteResponse& a, WriteResponse& b) { 1199 | a.Swap(&b); 1200 | } 1201 | inline void Swap(WriteResponse* other) { 1202 | if (other == this) return; 1203 | InternalSwap(other); 1204 | } 1205 | 1206 | // implements Message ---------------------------------------------- 1207 | 1208 | inline WriteResponse* New() const final { 1209 | return CreateMaybeMessage(nullptr); 1210 | } 1211 | 1212 | WriteResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 1213 | return CreateMaybeMessage(arena); 1214 | } 1215 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 1216 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 1217 | void CopyFrom(const WriteResponse& from); 1218 | void MergeFrom(const WriteResponse& from); 1219 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 1220 | bool IsInitialized() const final; 1221 | 1222 | size_t ByteSizeLong() const final; 1223 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 1224 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 1225 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 1226 | int GetCachedSize() const final { return _cached_size_.Get(); } 1227 | 1228 | private: 1229 | inline void SharedCtor(); 1230 | inline void SharedDtor(); 1231 | void SetCachedSize(int size) const final; 1232 | void InternalSwap(WriteResponse* other); 1233 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 1234 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 1235 | return "TSCached.WriteResponse"; 1236 | } 1237 | private: 1238 | inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { 1239 | return nullptr; 1240 | } 1241 | inline void* MaybeArenaPtr() const { 1242 | return nullptr; 1243 | } 1244 | public: 1245 | 1246 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 1247 | private: 1248 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 1249 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_point_2eproto); 1250 | return ::descriptor_table_point_2eproto.file_level_metadata[kIndexInFileMessages]; 1251 | } 1252 | 1253 | public: 1254 | 1255 | // nested types ---------------------------------------------------- 1256 | 1257 | // accessors ------------------------------------------------------- 1258 | 1259 | enum : int { 1260 | kMessageFieldNumber = 1, 1261 | kStatusCodeFieldNumber = 2, 1262 | }; 1263 | // string message = 1; 1264 | void clear_message(); 1265 | const std::string& message() const; 1266 | void set_message(const std::string& value); 1267 | void set_message(std::string&& value); 1268 | void set_message(const char* value); 1269 | void set_message(const char* value, size_t size); 1270 | std::string* mutable_message(); 1271 | std::string* release_message(); 1272 | void set_allocated_message(std::string* message); 1273 | private: 1274 | const std::string& _internal_message() const; 1275 | void _internal_set_message(const std::string& value); 1276 | std::string* _internal_mutable_message(); 1277 | public: 1278 | 1279 | // .TSCached.StatusCode statusCode = 2; 1280 | void clear_statuscode(); 1281 | ::TSCached::StatusCode statuscode() const; 1282 | void set_statuscode(::TSCached::StatusCode value); 1283 | private: 1284 | ::TSCached::StatusCode _internal_statuscode() const; 1285 | void _internal_set_statuscode(::TSCached::StatusCode value); 1286 | public: 1287 | 1288 | // @@protoc_insertion_point(class_scope:TSCached.WriteResponse) 1289 | private: 1290 | class _Internal; 1291 | 1292 | ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; 1293 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_; 1294 | int statuscode_; 1295 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 1296 | friend struct ::TableStruct_point_2eproto; 1297 | }; 1298 | // =================================================================== 1299 | 1300 | 1301 | // =================================================================== 1302 | 1303 | #ifdef __GNUC__ 1304 | #pragma GCC diagnostic push 1305 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" 1306 | #endif // __GNUC__ 1307 | // ------------------------------------------------------------------- 1308 | 1309 | // Metrics 1310 | 1311 | // int64 timeStamp = 1; 1312 | inline void Metrics::clear_timestamp() { 1313 | timestamp_ = PROTOBUF_LONGLONG(0); 1314 | } 1315 | inline ::PROTOBUF_NAMESPACE_ID::int64 Metrics::_internal_timestamp() const { 1316 | return timestamp_; 1317 | } 1318 | inline ::PROTOBUF_NAMESPACE_ID::int64 Metrics::timestamp() const { 1319 | // @@protoc_insertion_point(field_get:TSCached.Metrics.timeStamp) 1320 | return _internal_timestamp(); 1321 | } 1322 | inline void Metrics::_internal_set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value) { 1323 | 1324 | timestamp_ = value; 1325 | } 1326 | inline void Metrics::set_timestamp(::PROTOBUF_NAMESPACE_ID::int64 value) { 1327 | _internal_set_timestamp(value); 1328 | // @@protoc_insertion_point(field_set:TSCached.Metrics.timeStamp) 1329 | } 1330 | 1331 | // map fields = 2; 1332 | inline int Metrics::_internal_fields_size() const { 1333 | return fields_.size(); 1334 | } 1335 | inline int Metrics::fields_size() const { 1336 | return _internal_fields_size(); 1337 | } 1338 | inline void Metrics::clear_fields() { 1339 | fields_.Clear(); 1340 | } 1341 | inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, double >& 1342 | Metrics::_internal_fields() const { 1343 | return fields_.GetMap(); 1344 | } 1345 | inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, double >& 1346 | Metrics::fields() const { 1347 | // @@protoc_insertion_point(field_map:TSCached.Metrics.fields) 1348 | return _internal_fields(); 1349 | } 1350 | inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, double >* 1351 | Metrics::_internal_mutable_fields() { 1352 | return fields_.MutableMap(); 1353 | } 1354 | inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, double >* 1355 | Metrics::mutable_fields() { 1356 | // @@protoc_insertion_point(field_mutable_map:TSCached.Metrics.fields) 1357 | return _internal_mutable_fields(); 1358 | } 1359 | 1360 | // ------------------------------------------------------------------- 1361 | 1362 | // ------------------------------------------------------------------- 1363 | 1364 | // Point 1365 | 1366 | // string dataBase = 1; 1367 | inline void Point::clear_database() { 1368 | database_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1369 | } 1370 | inline const std::string& Point::database() const { 1371 | // @@protoc_insertion_point(field_get:TSCached.Point.dataBase) 1372 | return _internal_database(); 1373 | } 1374 | inline void Point::set_database(const std::string& value) { 1375 | _internal_set_database(value); 1376 | // @@protoc_insertion_point(field_set:TSCached.Point.dataBase) 1377 | } 1378 | inline std::string* Point::mutable_database() { 1379 | // @@protoc_insertion_point(field_mutable:TSCached.Point.dataBase) 1380 | return _internal_mutable_database(); 1381 | } 1382 | inline const std::string& Point::_internal_database() const { 1383 | return database_.GetNoArena(); 1384 | } 1385 | inline void Point::_internal_set_database(const std::string& value) { 1386 | 1387 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); 1388 | } 1389 | inline void Point::set_database(std::string&& value) { 1390 | 1391 | database_.SetNoArena( 1392 | &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); 1393 | // @@protoc_insertion_point(field_set_rvalue:TSCached.Point.dataBase) 1394 | } 1395 | inline void Point::set_database(const char* value) { 1396 | GOOGLE_DCHECK(value != nullptr); 1397 | 1398 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); 1399 | // @@protoc_insertion_point(field_set_char:TSCached.Point.dataBase) 1400 | } 1401 | inline void Point::set_database(const char* value, size_t size) { 1402 | 1403 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), 1404 | ::std::string(reinterpret_cast(value), size)); 1405 | // @@protoc_insertion_point(field_set_pointer:TSCached.Point.dataBase) 1406 | } 1407 | inline std::string* Point::_internal_mutable_database() { 1408 | 1409 | return database_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1410 | } 1411 | inline std::string* Point::release_database() { 1412 | // @@protoc_insertion_point(field_release:TSCached.Point.dataBase) 1413 | 1414 | return database_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1415 | } 1416 | inline void Point::set_allocated_database(std::string* database) { 1417 | if (database != nullptr) { 1418 | 1419 | } else { 1420 | 1421 | } 1422 | database_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), database); 1423 | // @@protoc_insertion_point(field_set_allocated:TSCached.Point.dataBase) 1424 | } 1425 | 1426 | // string tableName = 2; 1427 | inline void Point::clear_tablename() { 1428 | tablename_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1429 | } 1430 | inline const std::string& Point::tablename() const { 1431 | // @@protoc_insertion_point(field_get:TSCached.Point.tableName) 1432 | return _internal_tablename(); 1433 | } 1434 | inline void Point::set_tablename(const std::string& value) { 1435 | _internal_set_tablename(value); 1436 | // @@protoc_insertion_point(field_set:TSCached.Point.tableName) 1437 | } 1438 | inline std::string* Point::mutable_tablename() { 1439 | // @@protoc_insertion_point(field_mutable:TSCached.Point.tableName) 1440 | return _internal_mutable_tablename(); 1441 | } 1442 | inline const std::string& Point::_internal_tablename() const { 1443 | return tablename_.GetNoArena(); 1444 | } 1445 | inline void Point::_internal_set_tablename(const std::string& value) { 1446 | 1447 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); 1448 | } 1449 | inline void Point::set_tablename(std::string&& value) { 1450 | 1451 | tablename_.SetNoArena( 1452 | &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); 1453 | // @@protoc_insertion_point(field_set_rvalue:TSCached.Point.tableName) 1454 | } 1455 | inline void Point::set_tablename(const char* value) { 1456 | GOOGLE_DCHECK(value != nullptr); 1457 | 1458 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); 1459 | // @@protoc_insertion_point(field_set_char:TSCached.Point.tableName) 1460 | } 1461 | inline void Point::set_tablename(const char* value, size_t size) { 1462 | 1463 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), 1464 | ::std::string(reinterpret_cast(value), size)); 1465 | // @@protoc_insertion_point(field_set_pointer:TSCached.Point.tableName) 1466 | } 1467 | inline std::string* Point::_internal_mutable_tablename() { 1468 | 1469 | return tablename_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1470 | } 1471 | inline std::string* Point::release_tablename() { 1472 | // @@protoc_insertion_point(field_release:TSCached.Point.tableName) 1473 | 1474 | return tablename_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1475 | } 1476 | inline void Point::set_allocated_tablename(std::string* tablename) { 1477 | if (tablename != nullptr) { 1478 | 1479 | } else { 1480 | 1481 | } 1482 | tablename_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), tablename); 1483 | // @@protoc_insertion_point(field_set_allocated:TSCached.Point.tableName) 1484 | } 1485 | 1486 | // map tags = 3; 1487 | inline int Point::_internal_tags_size() const { 1488 | return tags_.size(); 1489 | } 1490 | inline int Point::tags_size() const { 1491 | return _internal_tags_size(); 1492 | } 1493 | inline void Point::clear_tags() { 1494 | tags_.Clear(); 1495 | } 1496 | inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 1497 | Point::_internal_tags() const { 1498 | return tags_.GetMap(); 1499 | } 1500 | inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 1501 | Point::tags() const { 1502 | // @@protoc_insertion_point(field_map:TSCached.Point.tags) 1503 | return _internal_tags(); 1504 | } 1505 | inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 1506 | Point::_internal_mutable_tags() { 1507 | return tags_.MutableMap(); 1508 | } 1509 | inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 1510 | Point::mutable_tags() { 1511 | // @@protoc_insertion_point(field_mutable_map:TSCached.Point.tags) 1512 | return _internal_mutable_tags(); 1513 | } 1514 | 1515 | // repeated .TSCached.Metrics metrics = 4; 1516 | inline int Point::_internal_metrics_size() const { 1517 | return metrics_.size(); 1518 | } 1519 | inline int Point::metrics_size() const { 1520 | return _internal_metrics_size(); 1521 | } 1522 | inline void Point::clear_metrics() { 1523 | metrics_.Clear(); 1524 | } 1525 | inline ::TSCached::Metrics* Point::mutable_metrics(int index) { 1526 | // @@protoc_insertion_point(field_mutable:TSCached.Point.metrics) 1527 | return metrics_.Mutable(index); 1528 | } 1529 | inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics >* 1530 | Point::mutable_metrics() { 1531 | // @@protoc_insertion_point(field_mutable_list:TSCached.Point.metrics) 1532 | return &metrics_; 1533 | } 1534 | inline const ::TSCached::Metrics& Point::_internal_metrics(int index) const { 1535 | return metrics_.Get(index); 1536 | } 1537 | inline const ::TSCached::Metrics& Point::metrics(int index) const { 1538 | // @@protoc_insertion_point(field_get:TSCached.Point.metrics) 1539 | return _internal_metrics(index); 1540 | } 1541 | inline ::TSCached::Metrics* Point::_internal_add_metrics() { 1542 | return metrics_.Add(); 1543 | } 1544 | inline ::TSCached::Metrics* Point::add_metrics() { 1545 | // @@protoc_insertion_point(field_add:TSCached.Point.metrics) 1546 | return _internal_add_metrics(); 1547 | } 1548 | inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics >& 1549 | Point::metrics() const { 1550 | // @@protoc_insertion_point(field_list:TSCached.Point.metrics) 1551 | return metrics_; 1552 | } 1553 | 1554 | // ------------------------------------------------------------------- 1555 | 1556 | // ------------------------------------------------------------------- 1557 | 1558 | // QueryRequest 1559 | 1560 | // string dataBase = 1; 1561 | inline void QueryRequest::clear_database() { 1562 | database_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1563 | } 1564 | inline const std::string& QueryRequest::database() const { 1565 | // @@protoc_insertion_point(field_get:TSCached.QueryRequest.dataBase) 1566 | return _internal_database(); 1567 | } 1568 | inline void QueryRequest::set_database(const std::string& value) { 1569 | _internal_set_database(value); 1570 | // @@protoc_insertion_point(field_set:TSCached.QueryRequest.dataBase) 1571 | } 1572 | inline std::string* QueryRequest::mutable_database() { 1573 | // @@protoc_insertion_point(field_mutable:TSCached.QueryRequest.dataBase) 1574 | return _internal_mutable_database(); 1575 | } 1576 | inline const std::string& QueryRequest::_internal_database() const { 1577 | return database_.GetNoArena(); 1578 | } 1579 | inline void QueryRequest::_internal_set_database(const std::string& value) { 1580 | 1581 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); 1582 | } 1583 | inline void QueryRequest::set_database(std::string&& value) { 1584 | 1585 | database_.SetNoArena( 1586 | &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); 1587 | // @@protoc_insertion_point(field_set_rvalue:TSCached.QueryRequest.dataBase) 1588 | } 1589 | inline void QueryRequest::set_database(const char* value) { 1590 | GOOGLE_DCHECK(value != nullptr); 1591 | 1592 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); 1593 | // @@protoc_insertion_point(field_set_char:TSCached.QueryRequest.dataBase) 1594 | } 1595 | inline void QueryRequest::set_database(const char* value, size_t size) { 1596 | 1597 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), 1598 | ::std::string(reinterpret_cast(value), size)); 1599 | // @@protoc_insertion_point(field_set_pointer:TSCached.QueryRequest.dataBase) 1600 | } 1601 | inline std::string* QueryRequest::_internal_mutable_database() { 1602 | 1603 | return database_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1604 | } 1605 | inline std::string* QueryRequest::release_database() { 1606 | // @@protoc_insertion_point(field_release:TSCached.QueryRequest.dataBase) 1607 | 1608 | return database_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1609 | } 1610 | inline void QueryRequest::set_allocated_database(std::string* database) { 1611 | if (database != nullptr) { 1612 | 1613 | } else { 1614 | 1615 | } 1616 | database_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), database); 1617 | // @@protoc_insertion_point(field_set_allocated:TSCached.QueryRequest.dataBase) 1618 | } 1619 | 1620 | // string tableName = 2; 1621 | inline void QueryRequest::clear_tablename() { 1622 | tablename_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1623 | } 1624 | inline const std::string& QueryRequest::tablename() const { 1625 | // @@protoc_insertion_point(field_get:TSCached.QueryRequest.tableName) 1626 | return _internal_tablename(); 1627 | } 1628 | inline void QueryRequest::set_tablename(const std::string& value) { 1629 | _internal_set_tablename(value); 1630 | // @@protoc_insertion_point(field_set:TSCached.QueryRequest.tableName) 1631 | } 1632 | inline std::string* QueryRequest::mutable_tablename() { 1633 | // @@protoc_insertion_point(field_mutable:TSCached.QueryRequest.tableName) 1634 | return _internal_mutable_tablename(); 1635 | } 1636 | inline const std::string& QueryRequest::_internal_tablename() const { 1637 | return tablename_.GetNoArena(); 1638 | } 1639 | inline void QueryRequest::_internal_set_tablename(const std::string& value) { 1640 | 1641 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); 1642 | } 1643 | inline void QueryRequest::set_tablename(std::string&& value) { 1644 | 1645 | tablename_.SetNoArena( 1646 | &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); 1647 | // @@protoc_insertion_point(field_set_rvalue:TSCached.QueryRequest.tableName) 1648 | } 1649 | inline void QueryRequest::set_tablename(const char* value) { 1650 | GOOGLE_DCHECK(value != nullptr); 1651 | 1652 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); 1653 | // @@protoc_insertion_point(field_set_char:TSCached.QueryRequest.tableName) 1654 | } 1655 | inline void QueryRequest::set_tablename(const char* value, size_t size) { 1656 | 1657 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), 1658 | ::std::string(reinterpret_cast(value), size)); 1659 | // @@protoc_insertion_point(field_set_pointer:TSCached.QueryRequest.tableName) 1660 | } 1661 | inline std::string* QueryRequest::_internal_mutable_tablename() { 1662 | 1663 | return tablename_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1664 | } 1665 | inline std::string* QueryRequest::release_tablename() { 1666 | // @@protoc_insertion_point(field_release:TSCached.QueryRequest.tableName) 1667 | 1668 | return tablename_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1669 | } 1670 | inline void QueryRequest::set_allocated_tablename(std::string* tablename) { 1671 | if (tablename != nullptr) { 1672 | 1673 | } else { 1674 | 1675 | } 1676 | tablename_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), tablename); 1677 | // @@protoc_insertion_point(field_set_allocated:TSCached.QueryRequest.tableName) 1678 | } 1679 | 1680 | // map tags = 3; 1681 | inline int QueryRequest::_internal_tags_size() const { 1682 | return tags_.size(); 1683 | } 1684 | inline int QueryRequest::tags_size() const { 1685 | return _internal_tags_size(); 1686 | } 1687 | inline void QueryRequest::clear_tags() { 1688 | tags_.Clear(); 1689 | } 1690 | inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 1691 | QueryRequest::_internal_tags() const { 1692 | return tags_.GetMap(); 1693 | } 1694 | inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 1695 | QueryRequest::tags() const { 1696 | // @@protoc_insertion_point(field_map:TSCached.QueryRequest.tags) 1697 | return _internal_tags(); 1698 | } 1699 | inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 1700 | QueryRequest::_internal_mutable_tags() { 1701 | return tags_.MutableMap(); 1702 | } 1703 | inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 1704 | QueryRequest::mutable_tags() { 1705 | // @@protoc_insertion_point(field_mutable_map:TSCached.QueryRequest.tags) 1706 | return _internal_mutable_tags(); 1707 | } 1708 | 1709 | // int64 startTime = 4; 1710 | inline void QueryRequest::clear_starttime() { 1711 | starttime_ = PROTOBUF_LONGLONG(0); 1712 | } 1713 | inline ::PROTOBUF_NAMESPACE_ID::int64 QueryRequest::_internal_starttime() const { 1714 | return starttime_; 1715 | } 1716 | inline ::PROTOBUF_NAMESPACE_ID::int64 QueryRequest::starttime() const { 1717 | // @@protoc_insertion_point(field_get:TSCached.QueryRequest.startTime) 1718 | return _internal_starttime(); 1719 | } 1720 | inline void QueryRequest::_internal_set_starttime(::PROTOBUF_NAMESPACE_ID::int64 value) { 1721 | 1722 | starttime_ = value; 1723 | } 1724 | inline void QueryRequest::set_starttime(::PROTOBUF_NAMESPACE_ID::int64 value) { 1725 | _internal_set_starttime(value); 1726 | // @@protoc_insertion_point(field_set:TSCached.QueryRequest.startTime) 1727 | } 1728 | 1729 | // int64 endTime = 5; 1730 | inline void QueryRequest::clear_endtime() { 1731 | endtime_ = PROTOBUF_LONGLONG(0); 1732 | } 1733 | inline ::PROTOBUF_NAMESPACE_ID::int64 QueryRequest::_internal_endtime() const { 1734 | return endtime_; 1735 | } 1736 | inline ::PROTOBUF_NAMESPACE_ID::int64 QueryRequest::endtime() const { 1737 | // @@protoc_insertion_point(field_get:TSCached.QueryRequest.endTime) 1738 | return _internal_endtime(); 1739 | } 1740 | inline void QueryRequest::_internal_set_endtime(::PROTOBUF_NAMESPACE_ID::int64 value) { 1741 | 1742 | endtime_ = value; 1743 | } 1744 | inline void QueryRequest::set_endtime(::PROTOBUF_NAMESPACE_ID::int64 value) { 1745 | _internal_set_endtime(value); 1746 | // @@protoc_insertion_point(field_set:TSCached.QueryRequest.endTime) 1747 | } 1748 | 1749 | // ------------------------------------------------------------------- 1750 | 1751 | // ------------------------------------------------------------------- 1752 | 1753 | // QueryResponse 1754 | 1755 | // string dataBase = 1; 1756 | inline void QueryResponse::clear_database() { 1757 | database_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1758 | } 1759 | inline const std::string& QueryResponse::database() const { 1760 | // @@protoc_insertion_point(field_get:TSCached.QueryResponse.dataBase) 1761 | return _internal_database(); 1762 | } 1763 | inline void QueryResponse::set_database(const std::string& value) { 1764 | _internal_set_database(value); 1765 | // @@protoc_insertion_point(field_set:TSCached.QueryResponse.dataBase) 1766 | } 1767 | inline std::string* QueryResponse::mutable_database() { 1768 | // @@protoc_insertion_point(field_mutable:TSCached.QueryResponse.dataBase) 1769 | return _internal_mutable_database(); 1770 | } 1771 | inline const std::string& QueryResponse::_internal_database() const { 1772 | return database_.GetNoArena(); 1773 | } 1774 | inline void QueryResponse::_internal_set_database(const std::string& value) { 1775 | 1776 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); 1777 | } 1778 | inline void QueryResponse::set_database(std::string&& value) { 1779 | 1780 | database_.SetNoArena( 1781 | &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); 1782 | // @@protoc_insertion_point(field_set_rvalue:TSCached.QueryResponse.dataBase) 1783 | } 1784 | inline void QueryResponse::set_database(const char* value) { 1785 | GOOGLE_DCHECK(value != nullptr); 1786 | 1787 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); 1788 | // @@protoc_insertion_point(field_set_char:TSCached.QueryResponse.dataBase) 1789 | } 1790 | inline void QueryResponse::set_database(const char* value, size_t size) { 1791 | 1792 | database_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), 1793 | ::std::string(reinterpret_cast(value), size)); 1794 | // @@protoc_insertion_point(field_set_pointer:TSCached.QueryResponse.dataBase) 1795 | } 1796 | inline std::string* QueryResponse::_internal_mutable_database() { 1797 | 1798 | return database_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1799 | } 1800 | inline std::string* QueryResponse::release_database() { 1801 | // @@protoc_insertion_point(field_release:TSCached.QueryResponse.dataBase) 1802 | 1803 | return database_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1804 | } 1805 | inline void QueryResponse::set_allocated_database(std::string* database) { 1806 | if (database != nullptr) { 1807 | 1808 | } else { 1809 | 1810 | } 1811 | database_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), database); 1812 | // @@protoc_insertion_point(field_set_allocated:TSCached.QueryResponse.dataBase) 1813 | } 1814 | 1815 | // string tableName = 2; 1816 | inline void QueryResponse::clear_tablename() { 1817 | tablename_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1818 | } 1819 | inline const std::string& QueryResponse::tablename() const { 1820 | // @@protoc_insertion_point(field_get:TSCached.QueryResponse.tableName) 1821 | return _internal_tablename(); 1822 | } 1823 | inline void QueryResponse::set_tablename(const std::string& value) { 1824 | _internal_set_tablename(value); 1825 | // @@protoc_insertion_point(field_set:TSCached.QueryResponse.tableName) 1826 | } 1827 | inline std::string* QueryResponse::mutable_tablename() { 1828 | // @@protoc_insertion_point(field_mutable:TSCached.QueryResponse.tableName) 1829 | return _internal_mutable_tablename(); 1830 | } 1831 | inline const std::string& QueryResponse::_internal_tablename() const { 1832 | return tablename_.GetNoArena(); 1833 | } 1834 | inline void QueryResponse::_internal_set_tablename(const std::string& value) { 1835 | 1836 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); 1837 | } 1838 | inline void QueryResponse::set_tablename(std::string&& value) { 1839 | 1840 | tablename_.SetNoArena( 1841 | &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); 1842 | // @@protoc_insertion_point(field_set_rvalue:TSCached.QueryResponse.tableName) 1843 | } 1844 | inline void QueryResponse::set_tablename(const char* value) { 1845 | GOOGLE_DCHECK(value != nullptr); 1846 | 1847 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); 1848 | // @@protoc_insertion_point(field_set_char:TSCached.QueryResponse.tableName) 1849 | } 1850 | inline void QueryResponse::set_tablename(const char* value, size_t size) { 1851 | 1852 | tablename_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), 1853 | ::std::string(reinterpret_cast(value), size)); 1854 | // @@protoc_insertion_point(field_set_pointer:TSCached.QueryResponse.tableName) 1855 | } 1856 | inline std::string* QueryResponse::_internal_mutable_tablename() { 1857 | 1858 | return tablename_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1859 | } 1860 | inline std::string* QueryResponse::release_tablename() { 1861 | // @@protoc_insertion_point(field_release:TSCached.QueryResponse.tableName) 1862 | 1863 | return tablename_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1864 | } 1865 | inline void QueryResponse::set_allocated_tablename(std::string* tablename) { 1866 | if (tablename != nullptr) { 1867 | 1868 | } else { 1869 | 1870 | } 1871 | tablename_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), tablename); 1872 | // @@protoc_insertion_point(field_set_allocated:TSCached.QueryResponse.tableName) 1873 | } 1874 | 1875 | // map tags = 3; 1876 | inline int QueryResponse::_internal_tags_size() const { 1877 | return tags_.size(); 1878 | } 1879 | inline int QueryResponse::tags_size() const { 1880 | return _internal_tags_size(); 1881 | } 1882 | inline void QueryResponse::clear_tags() { 1883 | tags_.Clear(); 1884 | } 1885 | inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 1886 | QueryResponse::_internal_tags() const { 1887 | return tags_.GetMap(); 1888 | } 1889 | inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >& 1890 | QueryResponse::tags() const { 1891 | // @@protoc_insertion_point(field_map:TSCached.QueryResponse.tags) 1892 | return _internal_tags(); 1893 | } 1894 | inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 1895 | QueryResponse::_internal_mutable_tags() { 1896 | return tags_.MutableMap(); 1897 | } 1898 | inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, std::string >* 1899 | QueryResponse::mutable_tags() { 1900 | // @@protoc_insertion_point(field_mutable_map:TSCached.QueryResponse.tags) 1901 | return _internal_mutable_tags(); 1902 | } 1903 | 1904 | // repeated .TSCached.Metrics metrics = 4; 1905 | inline int QueryResponse::_internal_metrics_size() const { 1906 | return metrics_.size(); 1907 | } 1908 | inline int QueryResponse::metrics_size() const { 1909 | return _internal_metrics_size(); 1910 | } 1911 | inline void QueryResponse::clear_metrics() { 1912 | metrics_.Clear(); 1913 | } 1914 | inline ::TSCached::Metrics* QueryResponse::mutable_metrics(int index) { 1915 | // @@protoc_insertion_point(field_mutable:TSCached.QueryResponse.metrics) 1916 | return metrics_.Mutable(index); 1917 | } 1918 | inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics >* 1919 | QueryResponse::mutable_metrics() { 1920 | // @@protoc_insertion_point(field_mutable_list:TSCached.QueryResponse.metrics) 1921 | return &metrics_; 1922 | } 1923 | inline const ::TSCached::Metrics& QueryResponse::_internal_metrics(int index) const { 1924 | return metrics_.Get(index); 1925 | } 1926 | inline const ::TSCached::Metrics& QueryResponse::metrics(int index) const { 1927 | // @@protoc_insertion_point(field_get:TSCached.QueryResponse.metrics) 1928 | return _internal_metrics(index); 1929 | } 1930 | inline ::TSCached::Metrics* QueryResponse::_internal_add_metrics() { 1931 | return metrics_.Add(); 1932 | } 1933 | inline ::TSCached::Metrics* QueryResponse::add_metrics() { 1934 | // @@protoc_insertion_point(field_add:TSCached.QueryResponse.metrics) 1935 | return _internal_add_metrics(); 1936 | } 1937 | inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Metrics >& 1938 | QueryResponse::metrics() const { 1939 | // @@protoc_insertion_point(field_list:TSCached.QueryResponse.metrics) 1940 | return metrics_; 1941 | } 1942 | 1943 | // ------------------------------------------------------------------- 1944 | 1945 | // WriteRequest 1946 | 1947 | // repeated .TSCached.Point points = 1; 1948 | inline int WriteRequest::_internal_points_size() const { 1949 | return points_.size(); 1950 | } 1951 | inline int WriteRequest::points_size() const { 1952 | return _internal_points_size(); 1953 | } 1954 | inline void WriteRequest::clear_points() { 1955 | points_.Clear(); 1956 | } 1957 | inline ::TSCached::Point* WriteRequest::mutable_points(int index) { 1958 | // @@protoc_insertion_point(field_mutable:TSCached.WriteRequest.points) 1959 | return points_.Mutable(index); 1960 | } 1961 | inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Point >* 1962 | WriteRequest::mutable_points() { 1963 | // @@protoc_insertion_point(field_mutable_list:TSCached.WriteRequest.points) 1964 | return &points_; 1965 | } 1966 | inline const ::TSCached::Point& WriteRequest::_internal_points(int index) const { 1967 | return points_.Get(index); 1968 | } 1969 | inline const ::TSCached::Point& WriteRequest::points(int index) const { 1970 | // @@protoc_insertion_point(field_get:TSCached.WriteRequest.points) 1971 | return _internal_points(index); 1972 | } 1973 | inline ::TSCached::Point* WriteRequest::_internal_add_points() { 1974 | return points_.Add(); 1975 | } 1976 | inline ::TSCached::Point* WriteRequest::add_points() { 1977 | // @@protoc_insertion_point(field_add:TSCached.WriteRequest.points) 1978 | return _internal_add_points(); 1979 | } 1980 | inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::TSCached::Point >& 1981 | WriteRequest::points() const { 1982 | // @@protoc_insertion_point(field_list:TSCached.WriteRequest.points) 1983 | return points_; 1984 | } 1985 | 1986 | // ------------------------------------------------------------------- 1987 | 1988 | // WriteResponse 1989 | 1990 | // string message = 1; 1991 | inline void WriteResponse::clear_message() { 1992 | message_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 1993 | } 1994 | inline const std::string& WriteResponse::message() const { 1995 | // @@protoc_insertion_point(field_get:TSCached.WriteResponse.message) 1996 | return _internal_message(); 1997 | } 1998 | inline void WriteResponse::set_message(const std::string& value) { 1999 | _internal_set_message(value); 2000 | // @@protoc_insertion_point(field_set:TSCached.WriteResponse.message) 2001 | } 2002 | inline std::string* WriteResponse::mutable_message() { 2003 | // @@protoc_insertion_point(field_mutable:TSCached.WriteResponse.message) 2004 | return _internal_mutable_message(); 2005 | } 2006 | inline const std::string& WriteResponse::_internal_message() const { 2007 | return message_.GetNoArena(); 2008 | } 2009 | inline void WriteResponse::_internal_set_message(const std::string& value) { 2010 | 2011 | message_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); 2012 | } 2013 | inline void WriteResponse::set_message(std::string&& value) { 2014 | 2015 | message_.SetNoArena( 2016 | &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); 2017 | // @@protoc_insertion_point(field_set_rvalue:TSCached.WriteResponse.message) 2018 | } 2019 | inline void WriteResponse::set_message(const char* value) { 2020 | GOOGLE_DCHECK(value != nullptr); 2021 | 2022 | message_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); 2023 | // @@protoc_insertion_point(field_set_char:TSCached.WriteResponse.message) 2024 | } 2025 | inline void WriteResponse::set_message(const char* value, size_t size) { 2026 | 2027 | message_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), 2028 | ::std::string(reinterpret_cast(value), size)); 2029 | // @@protoc_insertion_point(field_set_pointer:TSCached.WriteResponse.message) 2030 | } 2031 | inline std::string* WriteResponse::_internal_mutable_message() { 2032 | 2033 | return message_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 2034 | } 2035 | inline std::string* WriteResponse::release_message() { 2036 | // @@protoc_insertion_point(field_release:TSCached.WriteResponse.message) 2037 | 2038 | return message_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); 2039 | } 2040 | inline void WriteResponse::set_allocated_message(std::string* message) { 2041 | if (message != nullptr) { 2042 | 2043 | } else { 2044 | 2045 | } 2046 | message_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), message); 2047 | // @@protoc_insertion_point(field_set_allocated:TSCached.WriteResponse.message) 2048 | } 2049 | 2050 | // .TSCached.StatusCode statusCode = 2; 2051 | inline void WriteResponse::clear_statuscode() { 2052 | statuscode_ = 0; 2053 | } 2054 | inline ::TSCached::StatusCode WriteResponse::_internal_statuscode() const { 2055 | return static_cast< ::TSCached::StatusCode >(statuscode_); 2056 | } 2057 | inline ::TSCached::StatusCode WriteResponse::statuscode() const { 2058 | // @@protoc_insertion_point(field_get:TSCached.WriteResponse.statusCode) 2059 | return _internal_statuscode(); 2060 | } 2061 | inline void WriteResponse::_internal_set_statuscode(::TSCached::StatusCode value) { 2062 | 2063 | statuscode_ = value; 2064 | } 2065 | inline void WriteResponse::set_statuscode(::TSCached::StatusCode value) { 2066 | _internal_set_statuscode(value); 2067 | // @@protoc_insertion_point(field_set:TSCached.WriteResponse.statusCode) 2068 | } 2069 | 2070 | #ifdef __GNUC__ 2071 | #pragma GCC diagnostic pop 2072 | #endif // __GNUC__ 2073 | // ------------------------------------------------------------------- 2074 | 2075 | // ------------------------------------------------------------------- 2076 | 2077 | // ------------------------------------------------------------------- 2078 | 2079 | // ------------------------------------------------------------------- 2080 | 2081 | // ------------------------------------------------------------------- 2082 | 2083 | // ------------------------------------------------------------------- 2084 | 2085 | // ------------------------------------------------------------------- 2086 | 2087 | // ------------------------------------------------------------------- 2088 | 2089 | // ------------------------------------------------------------------- 2090 | 2091 | 2092 | // @@protoc_insertion_point(namespace_scope) 2093 | 2094 | } // namespace TSCached 2095 | 2096 | PROTOBUF_NAMESPACE_OPEN 2097 | 2098 | template <> struct is_proto_enum< ::TSCached::StatusCode> : ::std::true_type {}; 2099 | template <> 2100 | inline const EnumDescriptor* GetEnumDescriptor< ::TSCached::StatusCode>() { 2101 | return ::TSCached::StatusCode_descriptor(); 2102 | } 2103 | 2104 | PROTOBUF_NAMESPACE_CLOSE 2105 | 2106 | // @@protoc_insertion_point(global_scope) 2107 | 2108 | #include 2109 | #endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_point_2eproto 2110 | -------------------------------------------------------------------------------- /protobuf/point.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package TSCached; 4 | 5 | 6 | //一行数据 7 | message Metrics{ 8 | int64 timeStamp = 1; 9 | map fields=2; 10 | } 11 | message Point{ 12 | string dataBase = 1; 13 | string tableName = 2; 14 | map tags = 3; 15 | repeated Metrics metrics = 4; 16 | } 17 | 18 | 19 | message QueryRequest { 20 | string dataBase = 1; 21 | string tableName = 2; 22 | map tags = 3; 23 | int64 startTime = 4; //开始时间 24 | int64 endTime = 5; //结束时间 25 | } 26 | 27 | message QueryResponse { 28 | string dataBase = 1; 29 | string tableName = 2; 30 | map tags = 3; 31 | repeated Metrics metrics = 4; 32 | } 33 | 34 | 35 | message WriteRequest{ 36 | repeated Point points = 1; 37 | } 38 | 39 | enum StatusCode { 40 | OK = 0; 41 | ERROR = 1; 42 | } 43 | 44 | message WriteResponse { 45 | string message = 1; 46 | StatusCode statusCode = 2; 47 | } 48 | 49 | service TSCachedService{ 50 | rpc QueryPoints(QueryRequest) returns (QueryResponse) {}; 51 | rpc WritePoints(WriteRequest) returns (WriteResponse) {}; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /server.cpp: -------------------------------------------------------------------------------- 1 | #include "server/TSCachedServer.h" 2 | 3 | 4 | 5 | 6 | 7 | int main() { 8 | TSCached::TSCachedServer server; 9 | server.Run(); 10 | } 11 | -------------------------------------------------------------------------------- /server/TSCachedServer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/21. 3 | // 4 | 5 | #include "TSCachedServer.h" 6 | 7 | 8 | 9 | namespace TSCached{ 10 | 11 | TSCachedServer::TSCachedServer(): 12 | timeManager_(std::make_shared()), 13 | clearTaskManager_(std::make_shared(timeManager_)) 14 | { 15 | } 16 | 17 | void TSCachedServer::InitGRPCServer(Config& config) { 18 | TSCachedServiceImpl tsCachedService(std::make_shared(timeManager_,config)); 19 | ServerBuilder serverBuilder; 20 | serverBuilder.AddListeningPort(config.serverAddress, 21 | grpc::InsecureServerCredentials()); 22 | serverBuilder.RegisterService(&tsCachedService); 23 | std::unique_ptr server(serverBuilder.BuildAndStart()); 24 | std::cout<<"\nTSCachedServer Listening On Address : "<Wait(); 26 | } 27 | 28 | void TSCachedServer::InitBanner(Config& config) { 29 | std::fstream inBanner(config.bannerPath); 30 | 31 | std::string line; 32 | while (getline(inBanner,line)){ 33 | std::cout<(); 56 | auto bannerPath = conf["bannerPath"].as(); 57 | auto changeDataBlockTime = conf["changeDataBlockTime"]. 58 | as(); 59 | if (changeDataBlockTime <=0 ){ 60 | XLOG(ERR,"conf changeDataBlockTime can't less than 0 \n"); 61 | return; 62 | } 63 | auto purgeTimeSeriesTime = conf["purgeTimeSeriesTime"]. 64 | as(); 65 | if (purgeTimeSeriesTime <=0 ){ 66 | XLOG(ERR,"conf purgeTimeSeriesTime can't less than 0 \n"); 67 | return; 68 | } 69 | auto reserveDataBlockTime = conf["reserveDataBlockTime"]. 70 | as(); 71 | if (reserveDataBlockTime <=0 ){ 72 | XLOG(ERR,"conf reserveDataBlockTime can't less than 0 \n"); 73 | return; 74 | } 75 | auto maxPurgeTimeSeriesNum = conf["maxPurgeTimeSeriesNum"]. 76 | as(); 77 | if (maxPurgeTimeSeriesNum <=0 ){ 78 | XLOG(ERR,"conf maxPurgeTimeSeriesNum can't less than 0 \n"); 79 | return; 80 | } 81 | auto maxMemoryUsage = conf["maxMemoryUsage"]. 82 | as(); 83 | if (maxMemoryUsage <=0 ){ 84 | XLOG(ERR,"conf maxMemoryUsage can't less than 0 \n"); 85 | return; 86 | } 87 | 88 | config.changeDataBlockTime = changeDataBlockTime; 89 | config.purgeTimeSeriesTime = purgeTimeSeriesTime; 90 | config.serverAddress = serverAddress; 91 | config.bannerPath = bannerPath; 92 | config.reserveDataBlockTime = reserveDataBlockTime; 93 | config.maxPurgeTimeSeriesNum = maxPurgeTimeSeriesNum; 94 | config.maxMemoryUsage = maxMemoryUsage; 95 | } 96 | 97 | } -------------------------------------------------------------------------------- /server/TSCachedServer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/21. 3 | // 4 | 5 | #ifndef TSCACHED_TSCACHEDSERVER_H 6 | #define TSCACHED_TSCACHEDSERVER_H 7 | 8 | #include "TSCachedServiceImpl.h" 9 | #include "manager/ClearTaskManager.h" 10 | #include 11 | #include 12 | 13 | namespace TSCached{ 14 | 15 | class TSCachedServer { 16 | public: 17 | explicit TSCachedServer(); 18 | void Run() ; 19 | 20 | private: 21 | void InitBanner(Config&); 22 | void InitGRPCServer(Config&); 23 | void InitConfig(Config&); 24 | private: 25 | 26 | std::shared_ptr timeManager_; 27 | std::shared_ptr clearTaskManager_; 28 | }; 29 | 30 | } 31 | 32 | 33 | 34 | 35 | #endif //TSCACHED_TSCACHEDSERVER_H 36 | -------------------------------------------------------------------------------- /server/TSCachedServiceImpl.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/10. 3 | // 4 | 5 | #include "TSCachedServiceImpl.h" 6 | #include 7 | using grpc::Server; 8 | using grpc::ServerBuilder; 9 | using grpc::ServerContext; 10 | using grpc::Status; 11 | 12 | 13 | 14 | 15 | namespace TSCached{ 16 | 17 | TSCachedServiceImpl::TSCachedServiceImpl( 18 | std::shared_ptr timeSeriesMap): 19 | timeSeriesMap_(timeSeriesMap) 20 | { 21 | } 22 | 23 | ::grpc::Status TSCachedServiceImpl::QueryPoints(::grpc::ServerContext *context, const ::TSCached::QueryRequest *request, 24 | ::TSCached::QueryResponse *response) { 25 | assert(timeSeriesMap_); 26 | XLOGF(INFO,"Query Request From : %s",context->peer().c_str()); 27 | if (!request->IsInitialized()){ 28 | return Status::CANCELLED; 29 | } 30 | timeSeriesMap_->Query(*request,*response); 31 | return Status::OK; 32 | } 33 | 34 | 35 | 36 | ::grpc::Status TSCachedServiceImpl::WritePoints(::grpc::ServerContext *context, const ::TSCached::WriteRequest *request, 37 | ::TSCached::WriteResponse *response) { 38 | assert(timeSeriesMap_); 39 | XLOGF(INFO,"Query Request From : %s",context->peer().c_str()); 40 | if (!request->IsInitialized()){ 41 | return Status::CANCELLED; 42 | } 43 | 44 | if (request->points_size()==0){ 45 | response->set_statuscode(TSCached::StatusCode::ERROR); 46 | response->set_message("No Points in Request \n"); 47 | return Status::CANCELLED; 48 | } 49 | 50 | for (int i = 0; i < request->points_size(); ++i) { 51 | timeSeriesMap_->AppendPoint(request->points(i)); 52 | } 53 | response->set_message("Points Write Successful! \n"); 54 | response->set_statuscode(TSCached::StatusCode::OK); 55 | return Status::OK; 56 | } 57 | 58 | } //TSCached 59 | -------------------------------------------------------------------------------- /server/TSCachedServiceImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/10. 3 | // 4 | 5 | #ifndef TSCACHED_TSCACHEDSERVICEIMPL_H 6 | #define TSCACHED_TSCACHEDSERVICEIMPL_H 7 | 8 | 9 | #include "protobuf/point.pb.h" 10 | #include "protobuf/point.grpc.pb.h" 11 | #include "storage/TimeSeriesMap.h" 12 | #include 13 | 14 | #include 15 | 16 | using grpc::Server; 17 | using grpc::ServerBuilder; 18 | using grpc::ServerContext; 19 | using grpc::Status; 20 | 21 | using TSCached::TSCachedService; 22 | using TSCached::QueryRequest; 23 | using TSCached::QueryResponse; 24 | using TSCached::WriteRequest; 25 | using TSCached::WriteResponse; 26 | 27 | namespace TSCached{ 28 | 29 | class TSCachedServiceImpl final : public TSCachedService::Service{ 30 | public: 31 | explicit TSCachedServiceImpl( 32 | std::shared_ptr timeSeriesMap); 33 | public: 34 | ::grpc::Status QueryPoints(::grpc::ServerContext *context, const ::TSCached::QueryRequest *request, 35 | ::TSCached::QueryResponse *response) override; 36 | ::grpc::Status WritePoints(::grpc::ServerContext *context, const ::TSCached::WriteRequest *request, 37 | ::TSCached::WriteResponse *response) override; 38 | 39 | private: 40 | 41 | std::shared_ptr timeSeriesMap_; 42 | }; 43 | 44 | } //TSCached 45 | 46 | 47 | #endif //TSCACHED_TSCACHEDSERVICEIMPL_H 48 | -------------------------------------------------------------------------------- /server/banner.txt: -------------------------------------------------------------------------------- 1 | _____ _____ _____ _ _ ______ _____ __ _ _ 2 | |_ _/ ___/ __ \ | | | | | ___ \ / ___| / _| | | | | 3 | | | \ `--.| / \/ __ _ ___| |__ ___ __| | | |_/ _ _ _ __ \ `--. _ _ ___ ___ ___ ___ ___| |_ _ _| | | | 4 | | | `--. | | / _` |/ __| '_ \ / _ \/ _` | | | | | | '_ \ `--. | | | |/ __/ __/ _ / __/ __| _| | | | | | | 5 | | | /\__/ | \__/| (_| | (__| | | | __| (_| | | |\ | |_| | | | | /\__/ | |_| | (_| (_| __\__ \__ | | | |_| | | |_| 6 | \_/ \____/ \____/\__,_|\___|_| |_|\___|\__,_| \_| \_\__,_|_| |_| \____/ \__,_|\___\___\___|___|___|_| \__,_|_| (_) 7 | | | (_(_) | | 8 | | |__ _ _ _ _ _ __ ___| |__ _ _ __ _ _ _ __ _ _ __ __ _ 9 | | '_ \| | | | | | | '_ \|_ | '_ \| | | |/ _` | | | |/ _` | '_ \ / _` | 10 | | |_) | |_| | | | | | | |/ /| | | | |_| | (_| | |_| | (_| | | | | (_| | 11 | |_.__/ \__, | | |_|_| |_/___|_| |_|\__,_|\__, |\__,_|\__,_|_| |_|\__, | 12 | __/ | _/ | __/ | __/ | 13 | |___/ |__/ |___/ |___/ -------------------------------------------------------------------------------- /storage/BlockData.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/4/20. 3 | // 4 | 5 | #include "BlockData.h" 6 | 7 | namespace TSCached{ 8 | 9 | BlockData::BlockData() 10 | :pointNum_(0),startTime_(-1),endTime_(-1), 11 | statusCode_(BlockData::OPEN),createdTime_(time(nullptr)) 12 | { 13 | 14 | } 15 | 16 | //插入数据到一块BlockData中 17 | void BlockData::AppendPoint(const Point &point) { 18 | //插入数据时修改数据块的起止时间 19 | if (startTime_==-1 && point.metrics_size()>0){ 20 | startTime_ = point.metrics(0).timestamp(); 21 | endTime_ = point.metrics(point.metrics_size()-1).timestamp(); 22 | } else if (endTime_!=-1 && point.metrics_size()>0){ 23 | endTime_ = point.metrics(point.metrics_size()-1).timestamp(); 24 | } 25 | //开始插入数据 26 | for (const Metrics& metrics : point.metrics()) { 27 | timeList_.push_back(metrics.timestamp()); 28 | for(const auto& filed : metrics.fields()){ 29 | data_[filed.first].push_back(filed.second); 30 | } 31 | ++pointNum_; 32 | } 33 | } 34 | 35 | BlockData::StatusCode BlockData::Status() const { 36 | return statusCode_; 37 | } 38 | 39 | void BlockData::Query(const QueryRequest &queryRequest, QueryResponse &queryResponse) { 40 | for (int i = 0; i < pointNum_; ++i) { 41 | Metrics metrics; 42 | metrics.set_timestamp(timeList_[i]); 43 | // std::map fields; 44 | auto fields = metrics.mutable_fields(); 45 | for (const auto& field : data_){ 46 | (*fields)[field.first] = field.second[i]; 47 | } 48 | queryResponse.mutable_metrics()->Add(std::move(metrics)); 49 | } 50 | } 51 | 52 | 53 | 54 | 55 | //bool BlockData::IsOpen() const { 56 | // return this->is_open_; 57 | //} 58 | //向外提供关闭接口 59 | //void BlockData::MoveData() { 60 | // if (!append_list_.empty()){ 61 | // moveData(); 62 | // } 63 | //} 64 | 65 | //void BlockData::moveData() { 66 | // for (std::vector &fields : append_list_) { 67 | // for (Field &field : fields) { 68 | // closed_block_.push_back(std::move(field)); 69 | // } 70 | // fields.clear(); 71 | // } 72 | // //清空追加列表,并不回收内存,以备后续使用 73 | // append_list_.clear(); 74 | //} 75 | 76 | void BlockData::SetClosed() { 77 | statusCode_ = BlockData::CLOSED; 78 | closedTime_ = time(nullptr); 79 | } 80 | 81 | uint64_t BlockData::GetPointNum() const { 82 | return pointNum_; 83 | } 84 | 85 | uint64_t BlockData::GetCreatedTime() const { 86 | return createdTime_; 87 | } 88 | 89 | uint64_t BlockData::GetEndTime() const { 90 | return endTime_; 91 | } 92 | 93 | uint64_t BlockData::GetClosedTime() const { 94 | return closedTime_; 95 | } 96 | // 97 | //void BlockData::SetOpen() { 98 | // assert(!is_open_); 99 | // this->is_open_ = true; 100 | // closed_block_.clear(); 101 | //} 102 | // 103 | //void BlockData::Clear() { 104 | // 105 | //} 106 | 107 | 108 | 109 | 110 | 111 | 112 | } -------------------------------------------------------------------------------- /storage/BlockData.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/4/20. 3 | // 4 | 5 | #ifndef TSCACHED_BLOCKDATA_H 6 | #define TSCACHED_BLOCKDATA_H 7 | 8 | #include "protobuf/point.pb.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | 18 | namespace TSCached{ 19 | 20 | class BlockData{ 21 | public: 22 | enum StatusCode { 23 | OPEN, 24 | CLOSED 25 | }; 26 | 27 | BlockData(); 28 | ~BlockData()=default; 29 | void AppendPoint(const Point& point); 30 | [[nodiscard]] StatusCode Status() const ; 31 | 32 | void Query(const QueryRequest& queryRequest,QueryResponse& queryResponse); 33 | 34 | //关闭该数据块 35 | void SetClosed() ; 36 | 37 | [[nodiscard]] uint64_t GetPointNum() const ; 38 | 39 | //获取数据块创建事件 40 | [[nodiscard]] uint64_t GetCreatedTime() const ; 41 | 42 | //获取关闭时间 43 | uint64_t GetClosedTime() const ; 44 | 45 | //获取数据块中数据的结束时间 46 | [[nodiscard]] uint64_t GetEndTime() const ; 47 | 48 | private: 49 | uint64_t pointNum_; 50 | 51 | time_t startTime_; 52 | time_t endTime_; 53 | StatusCode statusCode_; //是否在打开 54 | time_t createdTime_; //该block创建时间 55 | //关闭时间 56 | time_t closedTime_; 57 | typedef std::vector dataList; 58 | std::vector timeList_; 59 | std::map data_; 60 | }; 61 | 62 | } //TSCached 63 | 64 | 65 | 66 | #endif //TSCACHED_BLOCKDATA_H 67 | -------------------------------------------------------------------------------- /storage/TimeSeries.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/4/20. 3 | // 4 | 5 | #include "TimeSeries.h" 6 | 7 | #include 8 | 9 | namespace TSCached{ 10 | 11 | TimeSeries::TimeSeries(std::string& key,std::shared_ptr& timerManager,Config* config) 12 | :key_(key),dataBlockNum_(1), 13 | config_(config), 14 | pointNum_(0),state_(State::ALIVE),startTime_(-1),endTime_(-1), 15 | openBlock_(std::make_unique()), 16 | timerManager_(timerManager) 17 | { 18 | //初始化第一块block的定时事件 19 | //存活Config::changeDataBlockTime后,关闭该数据块; 20 | timerManager_->AddTimer(openBlock_->GetCreatedTime()+config_->changeDataBlockTime, 21 | [this]{ProduceNewBlock();}); 22 | } 23 | 24 | //bool TimeSeries::IsTombstone() const { 25 | // return this->tombstone_; 26 | //} 27 | 28 | //设为墓碑,表面上删除 29 | //void TimeSeries::SetTombstone() { 30 | // std::lock_guard lock(this->mutex_); 31 | // this->tombstone_= true; 32 | // this->is_appending_ = false; 33 | // //如果当前的Block还没关闭,则关闭它 34 | // if (open_block_->IsOpen()){ 35 | // open_block_->SetClosed(); 36 | // } 37 | // closed_blocks_.push_back(std::make_shared(*open_block_)); 38 | // open_block_ = nullptr; 39 | // capacity_ = closed_blocks_.capacity(); 40 | // block_index_ = -1 ; 41 | // State_ = RECYCLING; 42 | // is_busy_ = false; 43 | //} 44 | 45 | //重新利用起来,把这个ts恢复成能用的样子 46 | //void TimeSeries::SetAlive() { 47 | // std::lock_guard lock(mutex_); 48 | // assert(open_block_ == nullptr); 49 | // assert(capacity_ > 0); 50 | // assert(block_index_ == -1); 51 | // tombstone_= false; 52 | // //取出一个空闲的block,capacity也要减一; 53 | // open_block_ = closed_blocks_[++block_index_].get(); 54 | // open_block_->SetOpen(); 55 | // if (--capacity_==0){ 56 | // State_ = LAST_BLOCK; 57 | // } 58 | //} 59 | 60 | //bool TimeSeries::IsOpen() const { 61 | // return open_block_!= nullptr&&is_appending_; 62 | //} 63 | 64 | //插入数据 65 | void TimeSeries::AppendPoint(const Point &point) { 66 | SLGuard guard(spinLock_); 67 | // assert(is_appending_); 68 | assert(openBlock_); 69 | assert(point.metrics_size()>0); 70 | //更新时间 71 | if (startTime_==-1 ){ 72 | //起止时间都要更新 73 | startTime_ = point.metrics(0).timestamp(); 74 | endTime_ = point.metrics(point.metrics_size()-1).timestamp(); 75 | }else if (startTime_!=-1 ){ 76 | //只需更新结束时间 77 | endTime_ = point.metrics(point.metrics_size()-1).timestamp(); 78 | } 79 | openBlock_->AppendPoint(point); 80 | pointNum_ += point.metrics_size(); 81 | } 82 | 83 | 84 | uint64_t TimeSeries::GetBlockNum() const { 85 | return dataBlockNum_; 86 | } 87 | 88 | uint64_t TimeSeries::GetPointNum() const { 89 | return pointNum_; 90 | } 91 | 92 | TimeSeries::State TimeSeries::GetState() const { 93 | return state_; 94 | } 95 | 96 | void TimeSeries::SetState(State state) { 97 | SLGuard guard(spinLock_); 98 | state_ = state; 99 | } 100 | void TimeSeries::ProduceNewBlock() { 101 | SLGuard guard(spinLock_); 102 | //关闭旧的数据块 103 | openBlock_->SetClosed(); 104 | timerManager_->AddClearTimer(openBlock_->GetClosedTime()+config_->reserveDataBlockTime, 105 | [this]{TimeSeries::ClearExpiredBlock();}); 106 | closedBlocks_.push_back(std::move(openBlock_)); 107 | //产生新的数据块 108 | openBlock_ = std::make_unique(); 109 | timerManager_->AddTimer(openBlock_->GetCreatedTime()+config_->changeDataBlockTime, 110 | [this]{TimeSeries::ProduceNewBlock();}); 111 | ++dataBlockNum_; 112 | XLOGF(INFO,"TimeSeries %s Produce New Block Successful!\n",key_.c_str()); 113 | } 114 | 115 | void TimeSeries::ClearExpiredBlock() { 116 | //检查是否有超时的旧数据 117 | SLGuard guard(spinLock_); 118 | time_t now = time(nullptr); 119 | for (auto blockIt = closedBlocks_.begin();blockIt!=closedBlocks_.end();) { 120 | //若没有过期则退出 121 | if (now - (*blockIt)->GetEndTime() < config_->reserveDataBlockTime){ 122 | break; 123 | } 124 | //超时的话则清除数据 125 | --dataBlockNum_; 126 | pointNum_ -= (*blockIt)->GetPointNum(); 127 | closedBlocks_.erase(blockIt++); 128 | } 129 | } 130 | 131 | //更换block的时候需要考虑block的来源,新建或利用已有的 132 | //void TimeSeries::CoolDown() { 133 | // //先更换一个新的block块,再慢慢的额把原来的block块移动到数据集中 134 | // std::lock_guard lock(this->mutex_); 135 | // 136 | // this->open_block_->SetClosed(); //关闭数据块 137 | // 138 | // if (State_ == RECYCLING){ 139 | // //重复利用状态 140 | // open_block_ = closed_blocks_[++block_index_].get(); 141 | // if (!open_block_->IsOpen()){ 142 | // open_block_->SetOpen(); 143 | // } 144 | // if (--capacity_==0) State_ = LAST_BLOCK; 145 | // }else if (State_ == LAST_BLOCK){ 146 | // open_block_ = new Block(); 147 | // if (!open_block_->IsOpen()) open_block_->SetOpen(); 148 | // State_ = NEW_BLOCK; 149 | // } else{ 150 | // Block *tmp = open_block_; 151 | // this->open_block_ = new Block(); 152 | // this->closed_blocks_.push_back(std::make_shared(*tmp)); 153 | // } 154 | // //2.把旧的数据移动到数据集中 155 | // 156 | //} 157 | 158 | 159 | const std::string& TimeSeries::GetKey() const { 160 | return key_; 161 | } 162 | 163 | //void TimeSeries::SetBusy(bool busy) { 164 | // this->is_busy_ = busy; 165 | //} 166 | 167 | //bool TimeSeries::IsBusy() const { 168 | // return is_busy_; 169 | //} 170 | 171 | void TimeSeries::Query(const QueryRequest& queryRequest,QueryResponse& queryResponse) { 172 | SLGuard guard(spinLock_); 173 | if (openBlock_!= nullptr){ 174 | openBlock_->Query(queryRequest,queryResponse); 175 | } 176 | for (const auto& closedBlock : closedBlocks_ ){ 177 | closedBlock->Query(queryRequest,queryResponse); 178 | } 179 | } 180 | 181 | uint64_t TimeSeries::GetCurrentBlockCreatedTime() { 182 | SLGuard guard(spinLock_); 183 | assert(openBlock_); 184 | return openBlock_->GetCreatedTime(); 185 | } 186 | 187 | 188 | 189 | 190 | } //TimeSeriesCached -------------------------------------------------------------------------------- /storage/TimeSeries.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/4/20. 3 | // 4 | 5 | #ifndef TSCACHED_TIMESERIES_H 6 | #define TSCACHED_TIMESERIES_H 7 | 8 | #include "BlockData.h" 9 | #include "manager/TimerManager.h" 10 | #include "manager/Config.h" 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace TSCached{ 18 | 19 | class TimeSeries{ 20 | public: 21 | enum State {ALIVE,DELETE}; 22 | 23 | typedef std::lock_guard SLGuard; 24 | 25 | explicit TimeSeries(std::string& key,std::shared_ptr&,Config* config); 26 | ~TimeSeries() = default; 27 | void AppendPoint(const Point& point); 28 | 29 | [[nodiscard]]const std::string& GetKey() const ; 30 | 31 | void Query(const QueryRequest& queryRequest,QueryResponse& queryResponse); 32 | //返回数据块数量 33 | uint64_t GetBlockNum() const ; 34 | //返回数据点数量 35 | uint64_t GetPointNum() const ; 36 | //返回当前写入数据块的创建时间 37 | uint64_t GetCurrentBlockCreatedTime() ; 38 | //获取和设置状态 39 | State GetState() const ; 40 | void SetState(State state); 41 | 42 | void ProduceNewBlock(); 43 | 44 | void ClearExpiredBlock(); 45 | private: 46 | //配置项 47 | const Config* config_; 48 | //起止时间 49 | time_t startTime_; 50 | time_t endTime_; 51 | //数据块状态 52 | State state_; 53 | //自旋锁 54 | folly::SpinLock spinLock_; 55 | //时间序列的key 56 | const std::string key_; 57 | //数据库数量 58 | uint64_t dataBlockNum_; 59 | //数据点的数量 60 | uint64_t pointNum_; 61 | //用于写入的数据块 62 | std::unique_ptr openBlock_; 63 | //已经关闭的数据块 64 | std::list> closedBlocks_; 65 | //时间管理器 66 | std::shared_ptr timerManager_; 67 | }; 68 | 69 | } //TSCached 70 | 71 | 72 | #endif //TSCACHED_TIMESERIES_H 73 | -------------------------------------------------------------------------------- /storage/TimeSeriesMap.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/4/21. 3 | // 4 | #include "TimeSeriesMap.h" 5 | 6 | namespace TSCached{ 7 | 8 | TimeSeriesMap::TimeSeriesMap(std::shared_ptr timerManager,Config& config): 9 | pointNum_(0), 10 | timeSeriesNum_(0), 11 | config_(config), 12 | timerManager_(timerManager) 13 | { 14 | timerManager_->AddTimer(time(nullptr)+config_.purgeTimeSeriesTime, 15 | [this] { ClearExpiredTimeSeries(); }); 16 | } 17 | 18 | //插入数据 19 | void TimeSeriesMap::AppendPoint(const Point &point){ 20 | RWLGuard guard(rwSpinLock_); 21 | std::string key = PointUtils::GetKey(point); 22 | assert(!key.empty()); 23 | if (timeSeriesMap_.count(key)==0){ 24 | //该时间序列不存在,新产生一个 25 | auto timeSeries = std::make_shared(key,timerManager_,&config_); 26 | timeSeriesMap_[key] = timeSeries; 27 | timeSeriesList_.push_back(timeSeries); 28 | } 29 | auto timeSeries = timeSeriesMap_[key]; 30 | timeSeries->AppendPoint(point); 31 | pointNum_ += point.metrics_size(); 32 | } 33 | void TimeSeriesMap::Delete(std::string& key) { 34 | RWLGuard guard(rwSpinLock_); 35 | if (timeSeriesMap_.count(key)==0){ 36 | XLOGF(WARNING,"TimeSeries %s is Not Exist\n",key); 37 | return; 38 | } 39 | auto timeSeries = timeSeriesMap_[key]; 40 | timeSeries->SetState(TimeSeries::DELETE); 41 | pointNum_ -= timeSeriesMap_[key]->GetPointNum(); 42 | --timeSeriesNum_; 43 | //删除这个timeseries,先加入待删除列表 44 | expiredTimeSeries_.push_back(timeSeries); 45 | timeSeriesMap_.erase(key); 46 | //遍历vector删除指针 47 | for(auto tsIt=timeSeriesList_.begin(); tsIt!=timeSeriesList_.end();tsIt++){ 48 | if (*tsIt == timeSeries){ 49 | timeSeriesList_.erase(tsIt); 50 | break; 51 | } 52 | } 53 | } 54 | 55 | void TimeSeriesMap::Query(const QueryRequest &queryRequest,QueryResponse& queryResponse) { 56 | //加上读锁 57 | RWLSGuard guard(rwSpinLock_); 58 | std::string key = PointUtils::GetKey(queryRequest); 59 | assert(!key.empty()); 60 | if (timeSeriesMap_.count(key)==0){ 61 | XLOGF(WARNING,"TimeSeries %s is Not Exist\n",key); 62 | return; 63 | } 64 | timeSeriesMap_[key]->Query(queryRequest,queryResponse); 65 | } 66 | 67 | void TimeSeriesMap::ClearExpiredTimeSeries() { 68 | RWLGuard guard(rwSpinLock_); 69 | //清理过期的TS 70 | uint64_t clearedTimeSeriesNum = 0; 71 | while (!expiredTimeSeries_.empty() &&clearedTimeSeriesNum < config_.maxPurgeTimeSeriesNum){ 72 | //删除开头的时间序列 73 | expiredTimeSeries_.erase(expiredTimeSeries_.begin()); 74 | //已经清理的个数增加 75 | ++clearedTimeSeriesNum; 76 | } 77 | 78 | //清理完成后,重新设置定时器便于下次清理 79 | timerManager_->AddTimer(time(nullptr)+config_.purgeTimeSeriesTime, 80 | [this] { ClearExpiredTimeSeries(); }); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /storage/TimeSeriesMap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/4/21. 3 | // 4 | 5 | #ifndef TSCACHED_TIMESERIESMAP_H 6 | #define TSCACHED_TIMESERIESMAP_H 7 | 8 | #include "TimeSeries.h" 9 | #include "manager/TimerManager.h" 10 | #include "utils/PointUtils.h" 11 | #include "manager/Config.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | 22 | namespace TSCached{ 23 | 24 | class TimeSeriesMap{ 25 | public: 26 | explicit TimeSeriesMap(std::shared_ptr timerManager,Config&) ; 27 | ~TimeSeriesMap() = default; 28 | TimeSeriesMap(const TimeSeriesMap&) = delete ; 29 | TimeSeriesMap& operator=(const TimeSeriesMap&) = delete ; 30 | //插入一个数据和一组数据 31 | void AppendPoint(const Point& point); 32 | 33 | //删除一个ts 34 | void Delete(std::string& key); 35 | //查询时间范围内的数据 36 | void Query(const QueryRequest& queryRequest,QueryResponse& queryResponse); ; 37 | 38 | //清理过期的TS 39 | void ClearExpiredTimeSeries(); 40 | 41 | private: 42 | typedef std::lock_guard RWLGuard; 43 | typedef std::shared_lock RWLSGuard; 44 | private: 45 | std::vector> timeSeriesList_; 46 | std::unordered_map> timeSeriesMap_; 47 | //待删除的时间序列列表 48 | std::list> expiredTimeSeries_; 49 | folly::RWSpinLock rwSpinLock_; 50 | 51 | //数据点数量 52 | uint64_t pointNum_ ; 53 | uint64_t timeSeriesNum_; 54 | 55 | //配置项 56 | Config config_; 57 | //时间管理器 58 | std::shared_ptr timerManager_; 59 | }; 60 | 61 | } 62 | 63 | 64 | #endif //TSCACHED_TIMESERIESMAP_H 65 | -------------------------------------------------------------------------------- /utils/PointUtils.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/18. 3 | // 4 | 5 | #include "PointUtils.h" 6 | 7 | namespace TSCached{ 8 | 9 | 10 | std::string TSCached::PointUtils::GetKey(const TSCached::Point &point) { 11 | assert(!point.database().empty()); 12 | assert(!point.tablename().empty()); 13 | assert(!point.tags().empty()); 14 | std::string key=point.database()+"&"+point.tablename(); 15 | for(const auto& kv : point.tags()){ 16 | key +="&" + kv.first + "=" +kv.second; 17 | } 18 | return key; 19 | } 20 | 21 | std::string TSCached::PointUtils::GetKey(const TSCached::QueryRequest &queryRequest) { 22 | assert(!queryRequest.database().empty()); 23 | assert(!queryRequest.tablename().empty()); 24 | assert(!queryRequest.tags().empty()); 25 | std::string key=queryRequest.database()+"&"+queryRequest.tablename(); 26 | for(const auto& kv : queryRequest.tags()){ 27 | key +="&" + kv.first + "=" +kv.second; 28 | } 29 | return key; 30 | } 31 | 32 | 33 | } //TSCached 34 | 35 | 36 | -------------------------------------------------------------------------------- /utils/PointUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 金祝光 on 2021/5/18. 3 | // 4 | 5 | #ifndef TSCACHED_POINTUTILS_H 6 | #define TSCACHED_POINTUTILS_H 7 | 8 | #include "protobuf/point.pb.h" 9 | 10 | 11 | namespace TSCached{ 12 | 13 | 14 | class PointUtils { 15 | public: 16 | static std::string GetKey(const Point& point) ; 17 | static std::string GetKey(const QueryRequest& queryRequest) ; 18 | }; 19 | 20 | 21 | } //TSCached 22 | 23 | 24 | 25 | 26 | #endif //TSCACHED_POINTUTILS_H 27 | --------------------------------------------------------------------------------