-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlog_unstable.h
43 lines (28 loc) · 853 Bytes
/
log_unstable.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
#ifndef __LOG_UNSTABLE_H__
#define __LOG_UNSTABLE_H__
#include "raft.pb.h"
#include "logger.h"
#include "util.h"
using namespace raftpb;
struct unstable
{
unstable() : snapshot_(NULL)
{
}
// the incoming unstable snapshot, if any.
Snapshot* snapshot_;
// all entries that have not yet been written to storage.
EntryVec entries_;
uint64_t offset_;
Logger *logger_;
bool maybeFirstIndex(uint64_t *first);
bool maybeLastIndex(uint64_t* last);
bool maybeTerm(uint64_t i, uint64_t *term);
void stableTo(uint64_t i, uint64_t t);
void stableSnapTo(uint64_t i);
void restore(const Snapshot& snapshot);
void truncateAndAppend(const EntryVec& entries);
void slice(uint64_t lo, uint64_t hi, EntryVec *entries);
void mustCheckOutOfBounds(uint64_t lo, uint64_t hi);
};
#endif