17 #ifndef CYBER_SERVICE_DISCOVERY_CONTAINER_SINGLE_VALUE_WAREHOUSE_H_ 18 #define CYBER_SERVICE_DISCOVERY_CONTAINER_SINGLE_VALUE_WAREHOUSE_H_ 21 #include <unordered_map> 29 namespace service_discovery {
33 using RoleMap = std::unordered_map<uint64_t, RolePtr>;
39 bool ignore_if_exist =
true)
override;
41 void Clear()
override;
42 std::size_t
Size()
override;
44 void Remove(uint64_t key)
override;
46 void Remove(
const proto::RoleAttributes& target_attr)
override;
48 bool Search(uint64_t key)
override;
49 bool Search(uint64_t key,
RolePtr* first_matched_role)
override;
51 proto::RoleAttributes* first_matched_role_attr)
override;
52 bool Search(uint64_t key, std::vector<RolePtr>* matched_roles)
override;
54 std::vector<proto::RoleAttributes>* matched_roles_attr)
override;
56 bool Search(
const proto::RoleAttributes& target_attr)
override;
57 bool Search(
const proto::RoleAttributes& target_attr,
58 RolePtr* first_matched)
override;
59 bool Search(
const proto::RoleAttributes& target_attr,
60 proto::RoleAttributes* first_matched_role_attr)
override;
61 bool Search(
const proto::RoleAttributes& target_attr,
62 std::vector<RolePtr>* matched_roles)
override;
63 bool Search(
const proto::RoleAttributes& target_attr,
64 std::vector<proto::RoleAttributes>* matched_roles_attr)
override;
66 void GetAllRoles(std::vector<RolePtr>* roles)
override;
67 void GetAllRoles(std::vector<proto::RoleAttributes>* roles_attr)
override;
78 #endif // CYBER_SERVICE_DISCOVERY_CONTAINER_SINGLE_VALUE_WAREHOUSE_H_ bool Search(uint64_t key) override
bool Add(uint64_t key, const RolePtr &role, bool ignore_if_exist=true) override
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: atomic_rw_lock.h:36
std::shared_ptr< RoleBase > RolePtr
Definition: role.h:31
void GetAllRoles(std::vector< RolePtr > *roles) override
std::size_t Size() override
Definition: warehouse_base.h:29
Definition: single_value_warehouse.h:31
std::unordered_map< uint64_t, RolePtr > RoleMap
Definition: single_value_warehouse.h:33
virtual ~SingleValueWarehouse()
Definition: single_value_warehouse.h:36
SingleValueWarehouse()
Definition: single_value_warehouse.h:35
void Remove(uint64_t key) override