Loading...
Searching...
No Matches
resdb_poc_config.cpp
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
21
22namespace resdb {
23
25 const ResConfigData& config_data,
26 const ReplicaInfo& self_info,
27 const KeyInfo& private_key,
28 const CertificateInfo& public_key_cert_info)
29 : ResDBConfig(config_data, self_info, private_key, public_key_cert_info),
30 bft_config_(bft_config) {
33}
34
35const ResDBConfig* ResDBPoCConfig::GetBFTConfig() const { return &bft_config_; }
36
37void ResDBPoCConfig::SetMaxNonceBit(uint32_t bit) { max_nonce_bit_ = bit; }
38
39uint32_t ResDBPoCConfig::GetMaxNonceBit() const { return max_nonce_bit_; }
40
41void ResDBPoCConfig::SetDifficulty(uint32_t difficulty) {
42 difficulty_ = difficulty;
43}
44
45uint32_t ResDBPoCConfig::GetDifficulty() const { return difficulty_; }
46
47uint32_t ResDBPoCConfig::GetTargetValue() const { return target_value_; }
48
49void ResDBPoCConfig::SetTargetValue(uint32_t target_value) {
50 target_value_ = target_value;
51}
52
53std::vector<ReplicaInfo> ResDBPoCConfig::GetBFTReplicas() {
54 return bft_replicas_;
55}
56
57void ResDBPoCConfig::SetBFTReplicas(const std::vector<ReplicaInfo>& replicas) {
58 bft_replicas_ = replicas;
59}
60
61// Batch
62uint32_t ResDBPoCConfig::BatchTransactionNum() const { return batch_num_; }
63
65 batch_num_ = batch_num;
66}
67
68uint32_t ResDBPoCConfig::GetWokerNum() { return worker_num_; }
69
70void ResDBPoCConfig::SetWorkerNum(uint32_t worker_num) {
71 worker_num_ = worker_num;
72}
73
74} // namespace resdb
void SetSignatureVerifierEnabled(bool enable_sv)
void SetHeartBeatEnabled(bool enable_heartbeat)
void SetWorkerNum(uint32_t worker_num)
void SetTargetValue(uint32_t target_value)
void SetBFTReplicas(const std::vector< ReplicaInfo > &replicas)
void SetBatchTransactionNum(uint32_t batch_num)
uint32_t BatchTransactionNum() const
void SetDifficulty(uint32_t difficulty)
ResDBPoCConfig(const ResDBConfig &bft_config, const ResConfigData &config_data, const ReplicaInfo &self_info, const KeyInfo &private_key, const CertificateInfo &public_key_cert_info)
const ResDBConfig * GetBFTConfig() const
uint32_t GetMaxNonceBit() const
void SetMaxNonceBit(uint32_t bit)
uint32_t GetTargetValue() const
uint32_t GetDifficulty() const
std::vector< ReplicaInfo > GetBFTReplicas()