Branch data Line data Source code
1 : : // Copyright 2026 HPActor Contributors
2 : : //
3 : : // Licensed under the Apache License, Version 2.0 (the "License");
4 : : // you may not use this file except in compliance with the License.
5 : : // You may obtain a copy of the License at
6 : : //
7 : : // http://www.apache.org/licenses/LICENSE-2.0
8 : : //
9 : : // Unless required by applicable law or agreed to in writing, software
10 : : // distributed under the License is distributed on an "AS IS" BASIS,
11 : : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : : // See the License for the specific language governing permissions and
13 : : // limitations under the License.
14 : :
15 : : #pragma once
16 : :
17 : : #include <hpactor/net/service_discovery.hpp>
18 : :
19 : : namespace hpactor::net {
20 : :
21 : : class StaticDiscovery : public IServiceDiscovery {
22 : : public:
23 : : explicit StaticDiscovery(std::vector<Member> members);
24 : :
25 : 0 : void start() override {}
26 : 0 : void stop() override {}
27 : : std::vector<Member> discover_all() const override;
28 : : const Member* discover(EndPoint) const override;
29 : 0 : void announce(Member) override {}
30 : 0 : void on_member_change(MemberChangeCallback) override {}
31 : 3 : std::string backend_name() const override { return "static"; }
32 : :
33 : : private:
34 : : std::vector<Member> members_;
35 : : std::unordered_map<EndPoint, size_t> index_;
36 : : };
37 : :
38 : : } // namespace hpactor::net
|