forked from stellar/stellar-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHistoryArchiveManager.h
52 lines (40 loc) · 1.56 KB
/
HistoryArchiveManager.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
// Copyright 2018 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 <memory>
#include <string>
#include <vector>
namespace stellar
{
class Application;
class Config;
class HistoryArchive;
class HistoryArchiveManager
{
public:
explicit HistoryArchiveManager(Application& app);
// Check that config settings are at least somewhat reasonable.
bool checkSensibleConfig() const;
// Select any readable history archive. If there are more than one,
// select one at random.
std::shared_ptr<HistoryArchive> selectRandomReadableHistoryArchive() const;
// Initialize a named history archive by writing
// .well-known/stellar-history.json to it.
bool initializeHistoryArchive(std::string const& arch) const;
// Returns whether or not the HistoryManager has any writable history
// archives (those configured with both a `get` and `put` command).
bool hasAnyWritableHistoryArchive() const;
// Returns history archive with given name or nullptr.
std::shared_ptr<HistoryArchive>
getHistoryArchive(std::string const& name) const;
// Returns all writable history archives (those configured with both a `get`
// and `put` command).
std::vector<std::shared_ptr<HistoryArchive>>
getWritableHistoryArchives() const;
double getFailureRate() const;
private:
Application& mApp;
std::vector<std::shared_ptr<HistoryArchive>> mArchives;
};
}