-
Notifications
You must be signed in to change notification settings - Fork 0
/
extent_client.h
54 lines (44 loc) · 1.57 KB
/
extent_client.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
// extent client interface.
#ifndef extent_client_h
#define extent_client_h
#include <string>
#include "extent_protocol.h"
#include "extent_server.h"
#include "lock_client_cache.h"
class extent_client : public lock_release_user {
public:
enum ext_cache_status {
SHARED,
EXCLUSIVE,
INVALID
};
struct ext_cache {
int status;
std::string buf;
bool hasattr;
extent_protocol::attr a;
ext_cache() {
status = INVALID;
buf.clear();
hasattr = false;
memset(&a, 0, sizeof(a));
}
};
private:
std::map<extent_protocol::extentid_t, struct ext_cache> extmap;
std::map<extent_protocol::extentid_t, struct ext_cache>::iterator it;
rpcc *cl;
public:
extent_client(std::string dst);
extent_protocol::status create(uint32_t type, extent_protocol::extentid_t &eid);
extent_protocol::status get(extent_protocol::extentid_t eid,
std::string &buf);
extent_protocol::status getattr(extent_protocol::extentid_t eid,
extent_protocol::attr &a);
extent_protocol::status put(extent_protocol::extentid_t eid, std::string buf);
extent_protocol::status remove(extent_protocol::extentid_t eid);
bool findext(extent_protocol::extentid_t eid, bool create = false);
extent_protocol::status flush(extent_protocol::extentid_t eid);
void dorelease(extent_protocol::extentid_t eid);
};
#endif