blob: 384cde3e3409a5cd0a56a4d23556966f45ab3565 (
plain) (
blame)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "tls_replay_progress.h"
#include "transactionlogmanagerbase.h"
namespace proton {
struct ConfigStore;
/**
* Class managing the initialization and replay of the transaction log.
**/
class TransactionLogManager : public TransactionLogManagerBase
{
std::unique_ptr<Visitor> _visitor;
void doLogReplayComplete(const vespalib::string &domainName, vespalib::duration elapsedTime) const override;
public:
/**
* Create a new manager.
*
* @param tlsSpec the spec of the transaction log server.
* @param domainName the name of the domain this manager should handle.
**/
TransactionLogManager(FNET_Transport & transport, const vespalib::string &tlsSpec, const vespalib::string &domainName);
~TransactionLogManager() override;
/**
* Init the transaction log.
*
* @param oldestConfigSerial the serial num of the oldest config.
* @param the pruned serial num will be set to 1 lower than
* the serial num of the first entry in the transaction log.
* @param replay_end_serial_num will be set to the serial num of
* the last entry in the transaction log.
**/
void init(SerialNum oldestConfigSerial, SerialNum &prunedSerialNum, SerialNum &replay_end_serial_num);
/**
* Prepare replay of the transaction log.
**/
static void
prepareReplay(TransLogClient &client,
const vespalib::string &domainName,
SerialNum flushedIndexMgrSerial,
SerialNum flushedSummaryMgrSerial,
ConfigStore &config_store);
/*
* Make a tls replay progress object for serial numbers (first..last]
*/
std::unique_ptr<TlsReplayProgress>
make_replay_progress(SerialNum first, SerialNum last);
/**
* Start replay of the transaction log.
**/
void startReplay(SerialNum first, SerialNum syncToken, Callback &callback);
/**
* Indicate that replay is done.
* Should be called when session callback handles eof().
**/
void replayDone();
};
} // namespace proton
|