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#include "node-instance-service.hpp"
24
25#include "iceflow.hpp"
26#include "producer.hpp"
27
28namespace iceflow {
29
31public:
32 IceflowScaler(const std::string &serverAddress,
33 const std::string &clientAddress,
34 std::shared_ptr<IceFlow> iceflow);
35
36 ~IceflowScaler() override;
37
38 void reportCongestion(CongestionReason congestionReason,
39 const std::string &edgeName) override;
40
41 void registerConsumer(const std::string &edgeName,
42 std::shared_ptr<IceflowConsumer> consumer);
43
44 void deregisterConsumer(const std::string &edgeName);
45
46 void registerProducer(const std::string &edgeName,
47 std::shared_ptr<IceflowProducer> producer);
48
49 void deregisterProducer(const std::string &edgeName);
50
51private:
52 void runGrpcServer(const std::string &address);
53
54 void runGrpcClient(const std::string &address);
55
56private:
57 const std::string &m_serverAddress;
58
59 const std::string &m_clientAddress;
60
61 std::shared_ptr<IceFlow> m_iceflow;
62
63 std::shared_ptr<iceflow::NodeInstanceService> m_instanceService;
64
65 std::unique_ptr<grpc::Server> m_server;
66
67 std::unique_ptr<NodeExecutor::Stub> m_nodeExecutorService;
68
69 std::unordered_map<std::string, std::shared_ptr<IceflowConsumer>>
70 m_consumerMap;
71
72 std::unordered_map<std::string, std::shared_ptr<IceflowProducer>>
73 m_producerMap;
74};
75} // namespace iceflow
76
77#endif // ICEFLOW_SCALER_HPP
Definition congestion-reporter.hpp:37
Definition scaler.hpp:30