forked from stellar/stellar-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckpointRange.h
36 lines (28 loc) · 934 Bytes
/
CheckpointRange.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
// Copyright 2017 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
#include <cstdint>
#include <string>
namespace stellar
{
class HistoryManager;
struct LedgerRange;
struct CheckpointRange final
{
uint32_t const mFirst;
uint32_t const mLast;
uint32_t const mFrequency;
CheckpointRange(uint32_t first, uint32_t last, uint32_t frequency);
CheckpointRange(LedgerRange const& ledgerRange,
HistoryManager const& historyManager);
friend bool operator==(CheckpointRange const& x, CheckpointRange const& y);
friend bool operator!=(CheckpointRange const& x, CheckpointRange const& y);
uint32_t
count() const
{
return (mLast - mFirst) / mFrequency + 1;
}
std::string toString() const;
};
}