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
|
#ifndef DAEMONVOLUME_H
#define DAEMONVOLUME_H
#include <entCache.h>
#include <filesystem>
#include <shared_mutex>
#include <typeConverter.h>
#include <volume.h>
class VolumeServer : public NetFS::Volume {
public:
VolumeServer(const std::filesystem::path & root, const EntCache<User> &, const EntCache<Group> &);
NetFS::DirectoryPrxPtr opendir(const NetFS::ReqEnv, std::string path, const Ice::Current &) override;
void mkdir(const NetFS::ReqEnv, std::string path, Ice::Int id, const Ice::Current &) override;
void rmdir(const NetFS::ReqEnv, std::string path, const Ice::Current &) override;
void truncate(const NetFS::ReqEnv, std::string path, Ice::Long size, const Ice::Current &) override;
void unlink(const NetFS::ReqEnv, std::string path, const Ice::Current &) override;
NetFS::FilePrxPtr open(const NetFS::ReqEnv, std::string path, Ice::Int flags, const Ice::Current &) override;
NetFS::FilePrxPtr create(
const NetFS::ReqEnv, std::string path, Ice::Int flags, Ice::Int mode, const Ice::Current &) override;
NetFS::VFS statfs(const NetFS::ReqEnv, std::string path, const Ice::Current &) override;
Ice::Int access(const NetFS::ReqEnv, std::string path, Ice::Int mode, const Ice::Current &) override;
NetFS::Attr getattr(const NetFS::ReqEnv, std::string path, const Ice::Current &) override;
void mknod(const NetFS::ReqEnv, std::string path, Ice::Int mode, Ice::Int dev, const Ice::Current &) override;
void symlink(const NetFS::ReqEnv, const std::string path1, const std::string path2, const Ice::Current &) override;
void link(const NetFS::ReqEnv, std::string path1, std::string path2, const Ice::Current &) override;
void rename(const NetFS::ReqEnv, std::string path1, const std::string path2, const Ice::optional<Ice::Int>,
const Ice::Current &) override;
std::string readlink(const NetFS::ReqEnv, std::string path, const Ice::Current &) override;
void chmod(const NetFS::ReqEnv, std::string path, Ice::Int mode, const Ice::Current &) override;
void chown(const NetFS::ReqEnv, std::string path, Ice::Int uid, Ice::Int gid, const Ice::Current &) override;
void utimens(const NetFS::ReqEnv, std::string path, Ice::Long, Ice::Long, Ice::Long, Ice::Long,
const Ice::Current &) override;
void disconnect(const Ice::Current &) override;
protected:
inline std::filesystem::path resolvePath(std::string && path) const;
private:
const std::filesystem::path root;
const EntCache<User> & userLookup;
const EntCache<Group> & groupLookup;
EntryTypeConverter converter;
};
#endif
|