#include "utils/Status.h" #include "meta/master/GrpcClient.h" #include "grpc/message.pb.h" #include "grpc/master.pb.h" #include "meta/etcd_watcher/Watcher.h" #include "meta/etcd_client/Etcd_client.h" #include "config/ServerConfig.h" #include namespace milvus { namespace server { class MetaWrapper { public: static MetaWrapper & GetInstance(); Status Init(); std::shared_ptr MetaClient(); uint64_t AskSegmentId(const std::string &collection_name, uint64_t channel_id, uint64_t timestamp); const milvus::grpc::Schema & AskCollectionSchema(const std::string &collection_name); Status SyncMeta(); int64_t CountCollection(const std::string& collection_name); private: bool IsCollectionMetaKey(const std::string &key); bool IsSegmentMetaKey(const std::string &key); void UpdateMeta(const etcdserverpb::WatchResponse &res); private: std::shared_ptr master_client_; std::shared_ptr etcd_client_; std::unordered_map schemas_; std::unordered_map segment_infos_; std::shared_ptr watcher_; std::shared_mutex mutex_; std::string etcd_root_path_; std::string segment_path_; std::string collection_path_; }; } }