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
|
#pragma once
#include <filesystem>
namespace saw {
namespace rmt {
struct FileSystem {};
}
template<>
class remote_address<rmt::FileSystem> {
private:
std::filesystem::path path_;
public:
remote_address(const std::filesystem::path& path__):
path_{path__}
{}
};
template<typename Iface, typename Encoding, typename Storage>
class rpc_client<Iface, Encoding, Storage, rmt::FileSystem> {
private:
ptr<remote_address<rmt::FileSystem>> addr_;
public:
rpc_client(ptr<remote_address<rmt::FileSystem>> addr__):
addr_{addr__}
{}
};
template<typename Iface, typename Encoding, typename Storage>
class rpc_server<Iface, Encoding, Storage, rmt::FileSystem> {
private:
ptr<remote_address<rmt::FileSystem>> addr_;
public:
rpc_server(ptr<remote_address<rmt::FileSystem>> addr__):
addr_{addr__}
{}
};
template<>
class remote<rmt::FileSystem> {
private:
SAW_FORBID_COPY(remote);
SAW_FORBID_MOVE(remote);
public:
error_or<own<remote_address<rmt::FileSystem>>> parse_address(const std::string_view& path_v){
return heap<remote_address<rmt::FileSystem>>(path_v);
}
template<typename Iface, typename Encoding, typename Storage>
rpc_server<Iface, Encoding, Storage, rmt::FileSystem> listen(const remote_address<rmt::FileSystem>& addr, typename rpc_server<Iface,Encoding,Storage,rmt::FileSystem>::InterfaceT iface){
return {addr, std::move(iface)};
}
};
}
|