-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKVFSObject.h
75 lines (63 loc) · 1.57 KB
/
KVFSObject.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* KVFSObject.h
*
* Created on: Oct 15, 2015
* Author: Prasanna Ponnada
*/
#ifndef KVFS_OBJECT
#define KVFS_OBJECT
#include <iostream>
#include <sstream>
//#include <boost/serialization/base_object.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
enum KVFSEntryType {
KVFS_DIRECTORY,
KVFS_FILE,
KVFS_ENTRY_END
};
class KVFSObject {
public:
KVFSObject();
KVFSObject(uint64_t fsId, std::string parent, std::string name,
KVFSEntryType type):
fsId(fsId), parent(parent), name(name), type(type) {}
KVFSObject(const KVFSObject& kvFSObject)
:fsId(kvFSObject.fsId)
,parent(kvFSObject.parent)
,name(kvFSObject.name)
,type(kvFSObject.type) {}
class KVFSBuffer {
std::stringstream sst;
};
virtual bool exists(KVStore* store, void* fsHandle) = 0;
virtual bool create(KVStore* store, void* fsHandle) = 0;
virtual bool remove(KVStore* store, void* fsHandle) = 0;
virtual ~KVFSObject() {};
inline uint64_t getFSId() {
return fsId;
}
inline std::string getParentDirName() {
return parent;
}
inline std::string getDirName() {
return name;
}
inline KVFSEntryType getType() {
return type;
}
protected:
uint64_t fsId;
std::string parent;
std::string name;
KVFSEntryType type;
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version) {
ar& fsId;
ar& parent;
ar& name;
ar& type;
}
};
#endif /* LOGFS_OBJECT */