IceFlow NDN-based stream processing library written in C++
Loading...
Searching...
No Matches
scaler.hpp
1/*
2 * Copyright 2024 The IceFlow Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 */
18
19#ifndef ICEFLOW_SCALER_HPP
20#define ICEFLOW_SCALER_HPP
21
22#include "congestion-reporter.hpp"
23
24#include "iceflow.hpp"
25#include "producer.hpp"
26
27namespace iceflow {
28
30public:
31 IceflowScaler(const std::string &serverAddress,
32 const std::string &clientAddress,
33 std::shared_ptr<IceFlow> iceflow);
34
35 ~IceflowScaler() override;
36
37 void reportCongestion(CongestionReason congestionReason,
38 const std::string &edgeName) override;
39
40 void registerConsumer(const std::string &edgeName,
41 std::shared_ptr<IceflowConsumer> consumer);
42
43 void deregisterConsumer(const std::string &edgeName);
44
45 void registerProducer(const std::string &edgeName,
46 std::shared_ptr<IceflowProducer> producer);
47
48 void deregisterProducer(const std::string &edgeName);
49
50private:
51 void runGrpcServer(const std::string &address);
52
53 void runGrpcClient(const std::string &address);
54
55private:
56 const std::string &m_serverAddress;
57
58 const std::string &m_clientAddress;
59
60 std::shared_ptr<IceFlow> m_iceflow;
61
62 std::unique_ptr<grpc::Server> m_server;
63
64 std::unique_ptr<NodeExecutor::Stub> m_nodeExecutorService;
65
66 std::unordered_map<std::string, std::shared_ptr<IceflowConsumer>>
67 m_consumerMap;
68
69 std::unordered_map<std::string, std::shared_ptr<IceflowProducer>>
70 m_producerMap;
71};
72} // namespace iceflow
73
74#endif // ICEFLOW_SCALER_HPP
Definition congestion-reporter.hpp:37
Definition scaler.hpp:29