SOLA
Loading...
Searching...
No Matches
paxos_data.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_PATH_PLANNING_CONSENSUS_PAXOS_DATA_H_
18#define DAISI_PATH_PLANNING_CONSENSUS_PAXOS_DATA_H_
19
20#include <vector>
21
22#include "path_planning/constants.h"
23#include "path_planning/path_planning_logger_ns_3.h"
24#include "path_planning/station.h"
25#include "sola-ns3/sola_ns3_wrapper.h"
26
27namespace daisi::path_planning::consensus {
28
29using InstanceID = uint32_t;
30using RequestID = std::pair<uint32_t, uint32_t>;
31
33 uint32_t instance_id = 0;
34 uint32_t proposal_id = 0;
35 uint32_t station_id = 0;
36 std::vector<IntersectionTimeInfo> data;
37
38 [[nodiscard]] bool initialized() const { return !data.empty(); }
39};
40
42 PaxosContainer(std::shared_ptr<sola_ns3::SOLAWrapperNs3> sola, uint32_t node_id,
43 PaxosSettings settings, std::shared_ptr<PathPlanningLoggerNs3> logger)
44 : sola(std::move(sola)),
45 node_id(node_id),
46 settings(std::move(settings)),
47 logger(std::move(logger)) {}
48 const std::shared_ptr<sola_ns3::SOLAWrapperNs3> sola{};
49 const uint32_t node_id;
50 const PaxosSettings settings;
51 std::shared_ptr<PathPlanningLoggerNs3> logger;
52
53 std::unordered_map<InstanceID, RequestID>
56
59
60 std::vector<std::vector<IntersectionTimeInfo>>
63
64 IntersectionOccupancy
67};
68} // namespace daisi::path_planning::consensus
69
70#endif // DAISI_PATH_PLANNING_CONSENSUS_PAXOS_DATA_H_
AcceptedProposal accepted_data_current_instance
Definition paxos_data.h:57
std::unordered_map< InstanceID, RequestID > instance_to_promised
Definition paxos_data.h:54
IntersectionOccupancy agreed_data
Definition paxos_data.h:65
std::vector< std::vector< IntersectionTimeInfo > > finally_accepted_data
Definition paxos_data.h:61