IceFlow NDN-based stream processing library written in C++
Loading...
Searching...
No Matches
executor.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_NODE_EXECUTOR_HPP
20#define ICEFLOW_NODE_EXECUTOR_HPP
21
22#include "iceflow.hpp"
23#include "stats.hpp"
24
25#include "node-executor.grpc.pb.h"
26#include "node-instance.grpc.pb.h"
27
28#include <grpc/grpc.h>
29
30namespace iceflow {
31
32class IceflowExecutor : public std::enable_shared_from_this<IceflowExecutor> {
33public:
34 IceflowExecutor(const std::string &serverAddress,
35 const std::string &clientAddress,
36 std::function<void(CongestionReason, const std::string &)>
37 congestionReportCallback);
38
40
41 void receiveCongestionReport(CongestionReason congestionReason,
42 const std::string &edgeName);
43
44 void repartition(const std::string &edgeName, uint32_t lowerPartitionBound,
45 uint32_t upperPartitionBound);
46
47 std::unordered_map<std::string, EdgeStats> queryEdgeStats();
48
49private:
50 void runGrpcServer(const std::string &address);
51
52 void runGrpcClient(const std::string &address);
53
54private:
55 const std::string &m_serverAddress;
56
57 const std::string &m_clientAddress;
58
59 std::unique_ptr<grpc::Server> m_server;
60
61 std::unique_ptr<NodeInstance::Stub> m_nodeInstanceService;
62
63 std::function<void(CongestionReason, const std::string &)>
64 m_congestionReportCallback;
65};
66} // namespace iceflow
67
68#endif // ICEFLOW_NODE_EXECUTOR_HPP
Definition executor.hpp:32