Loading...
Searching...
No Matches
geo_pbft_commitment.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
28#include "platform/proto/resdb.pb.h"
29
30namespace resdb {
31
33 public:
34 GeoPBFTCommitment(std::unique_ptr<GeoGlobalExecutor> global_executor,
35 const ResDBConfig& config,
36 std::unique_ptr<SystemInfo> system_info_,
37 ReplicaCommunicator* replica_communicator_,
38 SignatureVerifier* verifier);
39
41
42 int GeoProcessCcm(std::unique_ptr<Context> context,
43 std::unique_ptr<Request> request);
44
45 private:
46 bool VerifyCerts(const BatchUserRequest& request,
47 const std::string& raw_data);
48
49 bool AddNewReq(uint64_t seq, uint32_t sender_region);
50 void UpdateSeq(uint64_t seq);
51
52 int PostProcessExecutedMsg();
53
54 private:
55 std::unique_ptr<GeoGlobalExecutor> global_executor_;
56 std::atomic<bool> stop_;
57 std::set<uint32_t> checklist_[1 << 20];
58 ResDBConfig config_;
59 std::unique_ptr<SystemInfo> system_info_ = nullptr;
61 SignatureVerifier* verifier_;
62 Stats* global_stats_;
63 std::mutex mutex_;
64 std::thread executed_thread_;
65 uint64_t min_seq_ = 0;
66};
67
68} // namespace resdb
MockReplicaCommunicator replica_communicator_
int GeoProcessCcm(std::unique_ptr< Context > context, std::unique_ptr< Request > request)
SystemInfo system_info_