forked from stellar/stellar-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLedgerHeaderUtils.h
34 lines (23 loc) · 1014 Bytes
/
LedgerHeaderUtils.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
#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 "database/Database.h"
#include "xdr/Stellar-ledger.h"
namespace stellar
{
class XDROutputFileStream;
namespace LedgerHeaderUtils
{
bool isValid(LedgerHeader const& lh);
void storeInDatabase(Database& db, LedgerHeader const& header);
LedgerHeader decodeFromData(std::string const& data);
std::shared_ptr<LedgerHeader> loadByHash(Database& db, Hash const& hash);
std::shared_ptr<LedgerHeader> loadBySequence(Database& db, soci::session& sess,
uint32_t seq);
void deleteOldEntries(Database& db, uint32_t ledgerSeq, uint32_t count);
size_t copyToStream(Database& db, soci::session& sess, uint32_t ledgerSeq,
uint32_t ledgerCount, XDROutputFileStream& headersOut);
void dropAll(Database& db);
}
}