-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpartition_index.h
65 lines (35 loc) · 894 Bytes
/
partition_index.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
#ifndef _PARTITION_INDEX_H_
#define _PARTITION_INDEX_H_
#include "trace_types.h"
#include "snapshot_meta.h"
using namespace std;
class IndexEntry : public DataRecord
{
public:
Checksum mCksum;
DataRef mRef;
public:
int GetSize();
void FromBuffer(char* buf);
void ToBuffer(char* buf);
bool FromStream(istream& is);
void ToStream(ostream& os) const;
bool operator<(const IndexEntry& other) const;
bool operator==(const IndexEntry& other) const;
};
class PartitionIndex
{
public:
uint32_t mNodeID;
uint32_t mPartID;
vector<IndexEntry> mIndex;
public:
size_t getNumEntries();
void FromStream(istream& is);
void ToStream(ostream& os);
void FromFile(const string& fname);
void ToFile(const string& fname);
void AppendToFile(const string& fname);
bool Find(const Checksum& cksum);
};
#endif