Compare commits
659 Commits
v2.1.0-rc-
...
561cfd937a
Author | SHA1 | Date | |
---|---|---|---|
561cfd937a | |||
a22a92abc0 | |||
dffd718b5b | |||
303420406b | |||
fa720876d2 | |||
e204889e28 | |||
1d9fe59118 | |||
620b5733c9 | |||
5910ed3dae | |||
272d9a1502 | |||
92c0e4dabd | |||
643486b2c4 | |||
82bb90f66d | |||
c20575fdcf | |||
07ad8a55d3 | |||
17ebd56ed4 | |||
0ea1cb544e | |||
4bb34781fe | |||
6cae320556 | |||
e6bd5834f8 | |||
685e715884 | |||
d92a2d5e1c | |||
0320bb964f | |||
82b3efff0c | |||
f0b31aa7b2 | |||
4ac87fa5dd | |||
0db9052c3f | |||
4e0ad1c710 | |||
0b6c30fc85 | |||
27b64c60ec | |||
3b8413a686 | |||
bb7a80deef | |||
b638a0e497 | |||
8178e76ab6 | |||
ebfa54a78f | |||
1e31bbaf60 | |||
4a4ae36521 | |||
45ba5f7aed | |||
74c9a08135 | |||
25f076ea43 | |||
019e5e7ae8 | |||
24619d1c96 | |||
7f83401879 | |||
8e39850558 | |||
ea3d69a2ee | |||
01f11884aa | |||
ac11a283f7 | |||
72653dbc78 | |||
7cdb015392 | |||
aa9d314d89 | |||
81ece92a62 | |||
94f37d1845 | |||
a7c1bbbb1b | |||
b0a42cb488 | |||
089be73a08 | |||
f7dbbb9707 | |||
f31de883e4 | |||
710c7d56df | |||
891343aab9 | |||
ccfacb5964 | |||
e817ee678d | |||
fd71d5d452 | |||
84688f8166 | |||
0ddc714750 | |||
c0d855de89 | |||
707feacc6c | |||
0b3e187daa | |||
3c0f5c2eff | |||
059c57f1de | |||
bb6b90021f | |||
577f362382 | |||
775c893c65 | |||
3b904945bb | |||
875517a334 | |||
d810f287c2 | |||
8d12ef22b9 | |||
fc7a7063c2 | |||
66311b3f67 | |||
7833677738 | |||
c0be6765ab | |||
46490f9930 | |||
9ede9f5cf5 | |||
00a5f155ad | |||
b6eab4a932 | |||
d5d2b6a889 | |||
51320f9a09 | |||
31e0b4c5d9 | |||
bc0901f6a2 | |||
3b4c590404 | |||
953684f5a6 | |||
989c90bc8d | |||
776862d474 | |||
1ec287f41a | |||
01ed0c65bb | |||
9bed5e961f | |||
f8e7e8f0e3 | |||
9e9d46a9cd | |||
f654d269a7 | |||
c8929fed0b | |||
81fbe7a962 | |||
3bce0e9c70 | |||
d4f0431cd5 | |||
52f2b5b118 | |||
dfc8742fcb | |||
cf516d8663 | |||
e8af147805 | |||
2835809e5e | |||
bc0d299b85 | |||
13c136d01e | |||
218326f812 | |||
6dc10d2a11 | |||
4eff7aae64 | |||
bc85e34310 | |||
254578f4ab | |||
d5aa5c124c | |||
497b424840 | |||
1236bf1829 | |||
aa9c7d1ec1 | |||
c5d3453c1f | |||
71112d4977 | |||
ba3c6d78cb | |||
eb3ad67819 | |||
cc51ae61e4 | |||
b1fd78ebe3 | |||
7d0af3fb04 | |||
f8e9176538 | |||
734dab801d | |||
d83de7bb91 | |||
52cc40b4cf | |||
1e854aa368 | |||
3b19713111 | |||
83e66e2a1d | |||
a9c2af1c5f | |||
74d96745bf | |||
ebe78d1fbd | |||
f2dc325774 | |||
7977b4b304 | |||
e1ac9efaaa | |||
0b5efef569 | |||
6e4ae2896b | |||
ca97620b44 | |||
efb2be5839 | |||
33fa52f5a4 | |||
eaae2fea77 | |||
b4999323da | |||
1cdc174207 | |||
8262c2db29 | |||
dfd239c30d | |||
37b1e156d4 | |||
1751847ec2 | |||
f878a7b760 | |||
f9a8751a57 | |||
f73c706b8b | |||
1f4de69ead | |||
2b35df4d64 | |||
eddc6bb67c | |||
9d3e4b8767 | |||
cbb99c7b47 | |||
dca0752189 | |||
760a1e4322 | |||
56bc78f63c | |||
60b89c5c08 | |||
fa0f648a0b | |||
5592c663a4 | |||
c847353baf | |||
a140f59acb | |||
b2eae73fb0 | |||
a34dc8f1f8 | |||
92e2937a6b | |||
47757f69bd | |||
b642294193 | |||
8075af364f | |||
3d7285063a | |||
232420621a | |||
a0432be819 | |||
468093227d | |||
32facdc2ff | |||
3a719272cb | |||
9ce4c5a494 | |||
15cc7b0b87 | |||
6d152181d3 | |||
97082fa42c | |||
becd137cf5 | |||
89fc0fb372 | |||
68d79c73cf | |||
d0e9ed4181 | |||
535d2f85ca | |||
5ec20fbcbd | |||
0225fb8e5d | |||
035f830b71 | |||
7a1fb4a790 | |||
4939b05ca7 | |||
2e1f0c8f5f | |||
d8ac596687 | |||
1f43ab3bcc | |||
ef9fbf775c | |||
d6ff728a4d | |||
f6ea8f077b | |||
3e96764fc4 | |||
45b21ae0af | |||
490e49406f | |||
36e7d06b39 | |||
b26b52fd2d | |||
b35041f1f3 | |||
bf7ba3991f | |||
30806c6ebd | |||
29af6e5b7c | |||
cde0e92591 | |||
85b28f7ee3 | |||
df24b99303 | |||
d659a5e04d | |||
99c0246720 | |||
c0dba76ecd | |||
e37a375c18 | |||
6718eb374d | |||
bba7f10703 | |||
df947db055 | |||
256e873e7b | |||
34bc3b759e | |||
853aa2784c | |||
4011ab8080 | |||
07eaad7226 | |||
c743d3c341 | |||
05a5645f4c | |||
7aa71fb202 | |||
6410faa5b4 | |||
a3e578240b | |||
dd492ff52d | |||
e7b576bc45 | |||
7fcc40d0e1 | |||
e6fc6093b2 | |||
73ee70a862 | |||
b647053fb9 | |||
d518e55a67 | |||
fcd38db2ef | |||
89cd8c8fd0 | |||
88c7e7f192 | |||
a00e77d554 | |||
05d5bd9fe5 | |||
e14e7e96c7 | |||
4b8ac300c8 | |||
ee9c5fffad | |||
55caf049b1 | |||
4bdaeaa30d | |||
7c58d9c569 | |||
d6b2c1d81e | |||
4a2acf99a7 | |||
3567941139 | |||
50e7fb612c | |||
03dd9ee579 | |||
2a3c6f3522 | |||
2e46f2fead | |||
b00b72d70f | |||
7dbaf9b8d9 | |||
6b463adbb9 | |||
cb819d7da6 | |||
841ba37841 | |||
7cfefbc512 | |||
9ebba7252c | |||
835c56330a | |||
3e5c70e6b4 | |||
95b88b6ac6 | |||
c1f39afaa3 | |||
1893f7204e | |||
4a062abfde | |||
fb26aa04b6 | |||
7c538b471d | |||
c4c1941fc8 | |||
0ce2be24a3 | |||
3cf60d0d26 | |||
7d33ee80d0 | |||
52ba2de51f | |||
a1b8b57d34 | |||
cf9e0a356c | |||
e66b783df8 | |||
b695200123 | |||
a383fb405e | |||
1cebaf83e1 | |||
4976825bd6 | |||
098d172f40 | |||
f4a3c52428 | |||
2d60b637ec | |||
79b16d9a34 | |||
d69f2fd321 | |||
4015c1bb6e | |||
9f76f20ea8 | |||
b399ff3291 | |||
4fafc17b90 | |||
f1bb88624b | |||
f950e3192f | |||
bef2f078e0 | |||
218053a2be | |||
baca904079 | |||
b5175cb82b | |||
39888a1ebc | |||
ffea22c71b | |||
dd15bb2205 | |||
4b53b5544f | |||
24ca2d3531 | |||
5587e3430b | |||
0c36669fef | |||
bbce86cb9d | |||
ed3a45bfc6 | |||
144fd59c1c | |||
bdc54d7115 | |||
aa04371663 | |||
78ef412516 | |||
28f7f5cb14 | |||
624b92bc97 | |||
ca799298f4 | |||
42b67a7b61 | |||
4de4386142 | |||
509eeca760 | |||
1cb9663776 | |||
26667fdcd6 | |||
681a3eec53 | |||
2a5df890f7 | |||
ae0059591c | |||
8655becf1e | |||
2a3a0aa689 | |||
ce417ec7c8 | |||
4e848a998e | |||
d89f35775e | |||
88ebf72003 | |||
9437b175a2 | |||
302d73a078 | |||
ba7c36e30e | |||
b4da43c87f | |||
f5e078ea3d | |||
8aba39c955 | |||
68a5f90715 | |||
f3dfadddfa | |||
f1ec1fd4a6 | |||
cf59db9cee | |||
e21fbe84ba | |||
1e4d675f76 | |||
e02fe870e9 | |||
9ef9250c18 | |||
2e4b9d3787 | |||
fd2b3c3239 | |||
6640394bd3 | |||
84cc726c4f | |||
5d99d21915 | |||
3b8636544a | |||
14ce60ab65 | |||
7506431b34 | |||
8621209eb3 | |||
d1fe317fb9 | |||
a5c47d3f22 | |||
267c272ce5 | |||
7a8ae32b85 | |||
921d404a5a | |||
de6a7beb5e | |||
5a928208fd | |||
92fc163341 | |||
ca1e03f3ea | |||
de8c3ad603 | |||
f7d56bdd48 | |||
afc13b45f4 | |||
11d2c3c69e | |||
356521e176 | |||
468668e518 | |||
e53dec7bab | |||
26cd6de110 | |||
d1157ca261 | |||
0d49b49482 | |||
753820bd81 | |||
2a98e44a5c | |||
9650d3f56b | |||
aff308f67d | |||
be76d663b5 | |||
160863561f | |||
de02fdb812 | |||
1dda98e337 | |||
ccc6afdfa4 | |||
6b166551af | |||
90694f816f | |||
51636fbac3 | |||
3c7aa417a9 | |||
04d560739d | |||
2c1842f06c | |||
aba487277c | |||
1b95d5dfed | |||
7590fc4f45 | |||
a409408ac0 | |||
b121c9778f | |||
d452761ff9 | |||
dbc5725779 | |||
8b6536c55b | |||
c7318b0383 | |||
26fa85e421 | |||
939742a991 | |||
6ab7386a79 | |||
a750cdc3cb | |||
2f8af0fb08 | |||
7a9802ccb7 | |||
d356d04bf5 | |||
c99c4988ff | |||
6c564eb98b | |||
786d8634cf | |||
70b5204a9f | |||
1d70309a16 | |||
b2aba8c447 | |||
8757b47b35 | |||
b1a7632536 | |||
97c73d5358 | |||
bb3f05aef1 | |||
2001ffc27c | |||
bd2dd4035e | |||
7eb793f577 | |||
b05cedb509 | |||
cd484aa7bb | |||
fbfb528adc | |||
d9cba7f4cc | |||
7d5c5e18c6 | |||
2c0935a771 | |||
5312797b97 | |||
801af6b799 | |||
b42379b519 | |||
8b328b92b1 | |||
2e6ecf8ddb | |||
12c7c48b20 | |||
732a42a073 | |||
5638d5c010 | |||
6a984ac84c | |||
c1eb6b94ed | |||
85135b9267 | |||
670c5bac17 | |||
2dab1426b4 | |||
43004b19c3 | |||
4044d95aaa | |||
c6024c06ce | |||
e56bcb6489 | |||
d9e0164080 | |||
b588cd645e | |||
2c163d7219 | |||
39c53fe903 | |||
7b12d8f9e9 | |||
4649f66c00 | |||
9648abf4b9 | |||
cc1246d0f5 | |||
726aa43a95 | |||
224f983ca8 | |||
f962884341 | |||
6f35cc8bfa | |||
c08c9bc216 | |||
239652be7c | |||
68c9ec0f82 | |||
da07122997 | |||
5fb66dc6ee | |||
0c414fc8a6 | |||
097507a2d9 | |||
466b3fcead | |||
81dc6d1269 | |||
b6c020d35d | |||
dfbe97988f | |||
cd36679a1c | |||
4d555bce96 | |||
d96c6012c5 | |||
15793e714d | |||
437cb94dda | |||
544765e408 | |||
472b1f0da1 | |||
867b2eee40 | |||
5a30b15d1e | |||
0f2c507c30 | |||
c545916332 | |||
ac81f5f624 | |||
50ae7ab558 | |||
a5e29ed745 | |||
6d29170342 | |||
410314022f | |||
815e00d389 | |||
fbf5455f89 | |||
8925704555 | |||
462365dc97 | |||
e73dd52973 | |||
881eec4e02 | |||
bcdfc73767 | |||
0520aa3d40 | |||
c562d17b78 | |||
aee68520b3 | |||
88d8bf63f5 | |||
303887ea37 | |||
51d3d33175 | |||
cdb5ea279d | |||
311e1b318a | |||
31c5b6f1db | |||
a024f81e5d | |||
4089fca87c | |||
99533a9687 | |||
d175a38ad1 | |||
28e918be18 | |||
b4403ff959 | |||
8c548bad92 | |||
6ecad9af72 | |||
df73f9a18f | |||
9b453327a8 | |||
071552ffd5 | |||
33a0b4b295 | |||
21bcd0780c | |||
f6cdf2914c | |||
7698a62c1f | |||
2ae22cdb30 | |||
7705432820 | |||
f150832676 | |||
80c9375d65 | |||
48ddff9e85 | |||
6f64fe02d5 | |||
61ab4d8d58 | |||
3bb962a266 | |||
c286dc4f5c | |||
9d36ded2b3 | |||
71686405e0 | |||
34c4a9c508 | |||
effafd3e91 | |||
5a61bdf2b0 | |||
d21fcfd1c6 | |||
fff9a27362 | |||
ad7872a0e3 | |||
f3ea2ccc21 | |||
e959a9e795 | |||
3fe5eac56d | |||
67191be78d | |||
00cfb67b64 | |||
35aa8f5a94 | |||
f44972b8b3 | |||
94675a3011 | |||
7112fbee7e | |||
ff13633962 | |||
cb93e34de0 | |||
883968f53e | |||
d6d4b579c9 | |||
0e83d84360 | |||
63a6b3bdba | |||
aafa7e112a | |||
804eb7aa5a | |||
eeba641732 | |||
932ea6cb1d | |||
dd4724e374 | |||
e652c9956e | |||
d11767776e | |||
daefa58c0c | |||
7fe7299e7c | |||
0af9c6e8b0 | |||
b9c2113d43 | |||
4fd23de9b6 | |||
3b372ebe86 | |||
d14d149a3b | |||
44acf7dace | |||
da7efdb1a8 | |||
444f39f9ff | |||
fd9c26f016 | |||
7ef9f5cd65 | |||
d3321b3c57 | |||
bbe546008f | |||
5ec91e2d20 | |||
fbe4df0251 | |||
e5c690eb89 | |||
aeedd114a6 | |||
dfa5e0e005 | |||
5911d370e5 | |||
baf769c462 | |||
33e8e0890b | |||
e2e82edefb | |||
da1b5c6953 | |||
629725e262 | |||
6ba4c0091b | |||
99d5261aab | |||
97487cf0c4 | |||
8436f2e2bb | |||
310e436163 | |||
b64477fd7e | |||
782da43114 | |||
37854b693b | |||
7360b72c7b | |||
6f68f268c0 | |||
983587aeb7 | |||
ee415d2e4a | |||
0c075d7fe4 | |||
eec3653c6b | |||
5ac2a24611 | |||
144683d7b3 | |||
9c917a9119 | |||
dc48b84191 | |||
8555d31ddf | |||
cb0dde2a80 | |||
5f5b1f751b | |||
24c5dad929 | |||
f0046fcd57 | |||
3c3e415175 | |||
00d3355f43 | |||
907a14faff | |||
4348e89f99 | |||
7a24cc54f8 | |||
80f6e3c272 | |||
edb1297c4a | |||
1ee157f943 | |||
1b2981b06e | |||
7203fefd33 | |||
d808b2dd19 | |||
ee34a1e361 | |||
1766f91697 | |||
b3aa28d085 | |||
a605d7af11 | |||
19b1a33c48 | |||
04aa511448 | |||
8dc3d4466b | |||
0716a58ff0 | |||
60052081b4 | |||
f11d49b264 | |||
103dae6d08 | |||
821ed7b25e | |||
87f83b6f30 | |||
ace81d797e | |||
57ca2c7c6d | |||
8360d9e045 | |||
560ffbbb6a | |||
72314606f3 | |||
db009b69dd | |||
3ed99dc0ce | |||
762a7c99d5 | |||
4e62156b70 | |||
cc49536755 | |||
54b844dc3b | |||
1e8ba13f66 | |||
93011cee9c | |||
a474a5c73c | |||
17b98ca99d | |||
281eedb71e | |||
1ee533591c | |||
b87e1df140 | |||
f88239a13e | |||
68476cbc00 | |||
f2c1f64f02 | |||
a7209184c8 | |||
ba59e29499 | |||
f94196d865 | |||
bb5a9f9737 | |||
4bc5cf7c64 | |||
639d14452b | |||
e7413fb741 | |||
c0e720498d | |||
383c3b4be6 | |||
e9b202f5c8 | |||
bc3005a6a4 | |||
8cf19e0594 | |||
b137b57dbc | |||
5dff8927da | |||
197e79dd07 | |||
6262aca761 | |||
c156ae704b | |||
a67979ec40 | |||
54bfc11620 | |||
d33c2cd3a2 | |||
3a5f428fb6 | |||
0331152569 | |||
1b7e854f5f | |||
12a945d863 |
24
.clang-tidy
24
.clang-tidy
@ -1,30 +1,10 @@
|
|||||||
---
|
---
|
||||||
Checks: [
|
Checks: '-*,clang-diagnostic-*,clang-analyzer-*,bugprone-*,concurrency-*,cppcoreguidelines-*,modernize-*,readability-*,-readability-redundant-access-specifiers,-readability-function-cognitive-complexity'
|
||||||
'-*',
|
ExtraArgs: '-Wno-unknown-warning-option'
|
||||||
'clang-diagnostic-*',
|
|
||||||
'clang-analyzer-*',
|
|
||||||
'bugprone-*',
|
|
||||||
'concurrency-*',
|
|
||||||
'cppcoreguidelines-*',
|
|
||||||
'modernize-*',
|
|
||||||
'readability-*',
|
|
||||||
'-readability-redundant-access-specifiers',
|
|
||||||
'-readability-function-cognitive-complexity'
|
|
||||||
]
|
|
||||||
ExtraArgs: ['-Wno-unknown-warning-option']
|
|
||||||
FormatStyle: none
|
FormatStyle: none
|
||||||
HeaderFileExtensions: ['', 'h','hh','hpp','hxx']
|
HeaderFileExtensions: ['', 'h','hh','hpp','hxx']
|
||||||
HeaderFilterRegex: ''
|
HeaderFilterRegex: ''
|
||||||
ImplementationFileExtensions: ['c','cc','cpp','cxx']
|
ImplementationFileExtensions: ['c','cc','cpp','cxx']
|
||||||
CheckOptions:
|
|
||||||
- key: MinimumExceptionNameLength
|
|
||||||
value: 1
|
|
||||||
- key: MinimumLoopCounterNameLength
|
|
||||||
value: 3
|
|
||||||
- key: MinimumParameterNameLength
|
|
||||||
value: 3
|
|
||||||
- key: MinimumVariableNameLength
|
|
||||||
value: 3
|
|
||||||
User: 'scott.e.graves@protonmail.com'
|
User: 'scott.e.graves@protonmail.com'
|
||||||
WarningsAsErrors: ''
|
WarningsAsErrors: ''
|
||||||
...
|
...
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
_lseeki64
|
_lseeki64
|
||||||
_mkgmtime
|
|
||||||
_sh_denyno
|
_sh_denyno
|
||||||
_sh_denyrd
|
_sh_denyrd
|
||||||
_sh_denyrw
|
_sh_denyrw
|
||||||
@ -23,7 +22,6 @@ cppflags
|
|||||||
cpphttplib
|
cpphttplib
|
||||||
cpptrace
|
cpptrace
|
||||||
cppvsdbg
|
cppvsdbg
|
||||||
create_notraverse
|
|
||||||
crypto_aead_xchacha20poly1305_ietf_npubbytes
|
crypto_aead_xchacha20poly1305_ietf_npubbytes
|
||||||
cstdint
|
cstdint
|
||||||
cxxflags
|
cxxflags
|
||||||
@ -31,7 +29,6 @@ cxxstd
|
|||||||
d_largefile64_source
|
d_largefile64_source
|
||||||
d_largefile_source
|
d_largefile_source
|
||||||
d_ndebug
|
d_ndebug
|
||||||
dacl_security_information
|
|
||||||
dbackward_shared
|
dbackward_shared
|
||||||
dbghelp
|
dbghelp
|
||||||
dboost_root
|
dboost_root
|
||||||
@ -96,8 +93,6 @@ expect_streq
|
|||||||
fallocate_impl
|
fallocate_impl
|
||||||
fext
|
fext
|
||||||
fgetattr
|
fgetattr
|
||||||
fgetattr_impl
|
|
||||||
filebase
|
|
||||||
flac_version
|
flac_version
|
||||||
flag_nopath
|
flag_nopath
|
||||||
flarge
|
flarge
|
||||||
@ -120,11 +115,9 @@ icui18n
|
|||||||
icuuc
|
icuuc
|
||||||
iostreams
|
iostreams
|
||||||
iphlpapi
|
iphlpapi
|
||||||
jthread
|
|
||||||
libbitcoin
|
libbitcoin
|
||||||
libbitcoinsystem
|
libbitcoinsystem
|
||||||
libcurl
|
libcurl
|
||||||
libdsm
|
|
||||||
libevent
|
libevent
|
||||||
libexample
|
libexample
|
||||||
libfuse3
|
libfuse3
|
||||||
@ -139,15 +132,10 @@ libuuid
|
|||||||
libuuid_include_dirs
|
libuuid_include_dirs
|
||||||
libvlc
|
libvlc
|
||||||
linkflags
|
linkflags
|
||||||
lptr
|
|
||||||
lpwstr
|
|
||||||
markdownlint
|
|
||||||
mbig
|
mbig
|
||||||
msvc
|
msvc
|
||||||
msvcr120
|
msvcr120
|
||||||
msys2
|
|
||||||
mtune
|
mtune
|
||||||
musl-libc
|
|
||||||
nana
|
nana
|
||||||
ncrypt
|
ncrypt
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
@ -159,9 +147,6 @@ oleaut32
|
|||||||
openal_version
|
openal_version
|
||||||
openssldir
|
openssldir
|
||||||
pkgconfig
|
pkgconfig
|
||||||
plarge_integer
|
|
||||||
plex
|
|
||||||
println
|
|
||||||
project_enable_fontconfig
|
project_enable_fontconfig
|
||||||
project_enable_gtkmm
|
project_enable_gtkmm
|
||||||
project_enable_libdsm
|
project_enable_libdsm
|
||||||
@ -173,15 +158,10 @@ pugixml_project
|
|||||||
puint32
|
puint32
|
||||||
pvoid
|
pvoid
|
||||||
pwstr
|
pwstr
|
||||||
rdrw
|
|
||||||
remote_winfsp
|
remote_winfsp
|
||||||
renterd
|
|
||||||
richtext
|
richtext
|
||||||
rocksdb_library
|
rocksdb_library
|
||||||
rpcrt4
|
rpcrt4
|
||||||
s_igid
|
|
||||||
s_isvtx
|
|
||||||
s_iuid
|
|
||||||
sddl_revision_1
|
sddl_revision_1
|
||||||
secp256k1
|
secp256k1
|
||||||
secur32
|
secur32
|
||||||
|
@ -6,7 +6,7 @@ pipeline {
|
|||||||
environment {
|
environment {
|
||||||
DEVELOPER_PRIVATE_KEY = "/.ci/repertory/cert/developer.priv"
|
DEVELOPER_PRIVATE_KEY = "/.ci/repertory/cert/developer.priv"
|
||||||
DEVELOPER_PUBLIC_KEY = "/.ci/repertory/cert/developer.pub"
|
DEVELOPER_PUBLIC_KEY = "/.ci/repertory/cert/developer.pub"
|
||||||
PROJECT_TEST_CONFIG_DIR = "/.ci/repertory/test_config"
|
PROJECT_TEST_DIR = "/.ci/repertory/test"
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
|
7
.nvimrc
7
.nvimrc
@ -18,14 +18,14 @@ if vim.env.NV_DARCULA_ENABLE_DAP then
|
|||||||
|
|
||||||
local externalConsole = gos.is_windows
|
local externalConsole = gos.is_windows
|
||||||
local type = "cppdbg"
|
local type = "cppdbg"
|
||||||
local cwd = gpath.create_path("./dist/debug/shared/linux/x86_64/repertory/")
|
local cwd = gpath.create_path("./build")
|
||||||
dap.configurations.cpp = {
|
dap.configurations.cpp = {
|
||||||
{
|
{
|
||||||
name = "Mount",
|
name = "Mount",
|
||||||
type = type,
|
type = type,
|
||||||
request = "launch",
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return gpath.create_path(cwd, "bin/repertory")
|
return gpath.create_path(cwd, "repertory")
|
||||||
end,
|
end,
|
||||||
cwd = cwd,
|
cwd = cwd,
|
||||||
stopAtEntry = true,
|
stopAtEntry = true,
|
||||||
@ -36,9 +36,8 @@ if vim.env.NV_DARCULA_ENABLE_DAP then
|
|||||||
type = type,
|
type = type,
|
||||||
request = "launch",
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return gpath.create_path(cwd, "bin/repertory_test")
|
return gpath.create_path(cwd, "repertory_tests")
|
||||||
end,
|
end,
|
||||||
args={"--gtest_filter=utils_db*"},
|
|
||||||
cwd = cwd,
|
cwd = cwd,
|
||||||
stopAtEntry = true,
|
stopAtEntry = true,
|
||||||
externalConsole=externalConsole,
|
externalConsole=externalConsole,
|
||||||
|
33
CHANGELOG.md
33
CHANGELOG.md
@ -2,37 +2,19 @@
|
|||||||
|
|
||||||
## v2.0.2-rc
|
## v2.0.2-rc
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* Refactored `config.json` - will need to verify configuration settings prior to mounting
|
|
||||||
|
|
||||||
### Issues
|
### Issues
|
||||||
|
|
||||||
* \#12 \[Unit Test\] Complete all providers unit tests
|
* \#12 [Unit Test] Complete all providers unit tests
|
||||||
* \#14 \[Unit Test\] SQLite mini-ORM unit tests and cleanup
|
* Switched to common build system
|
||||||
* \#16 Add support for bucket name in Sia provider
|
|
||||||
* \#17 Update to common c++ build system
|
|
||||||
* A single 64-bit Linux Jenkins server is used to build all Linux and Windows versions
|
|
||||||
* All dependency sources are now included
|
|
||||||
* MSVC is no longer supported
|
|
||||||
* MSYS2 is required for building Windows binaries on Windows
|
|
||||||
* OS X support is temporarily disabled
|
|
||||||
* \#19 \[bug\] Rename file is broken for files that are existing
|
|
||||||
* \#23 \[bug\] Incorrect file size displayed while upload is pending
|
|
||||||
* \#24 RocksDB implementations should be transactional
|
|
||||||
* \#25 Writes should block when maximum cache size is reached
|
|
||||||
* \#26 Complete ring buffer and direct download support
|
|
||||||
|
|
||||||
### Changes from v2.0.1-rc
|
### Changes from v2.0.1-rc
|
||||||
|
|
||||||
* Ability to choose between RocksDB and SQLite databases
|
* Updated `JSON for Modern C++` to v3.11.3
|
||||||
* Added direct reads and implemented download fallback
|
|
||||||
* Corrected file times on S3 and Sia providers
|
|
||||||
* Corrected handling of `chown()` and `chmod()`
|
|
||||||
* Fixed erroneous download of chunks after resize
|
|
||||||
|
|
||||||
## v2.0.1-rc
|
## v2.0.1-rc
|
||||||
|
|
||||||
|
* Removed legacy win32 build binaries
|
||||||
|
|
||||||
<!-- markdownlint-disable-next-line -->
|
<!-- markdownlint-disable-next-line -->
|
||||||
### Issues
|
### Issues
|
||||||
|
|
||||||
@ -41,17 +23,16 @@
|
|||||||
|
|
||||||
### Changes from v2.0.0-rc
|
### Changes from v2.0.0-rc
|
||||||
|
|
||||||
* Fixed intermittent deadlock on file close
|
|
||||||
* Refactored Sia, S3 and base provider
|
* Refactored Sia, S3 and base provider
|
||||||
|
* Fixed intermittent deadlock on file close
|
||||||
* Removed MSVC compilation support (MinGW-64 should be used)
|
* Removed MSVC compilation support (MinGW-64 should be used)
|
||||||
* Removed legacy win32 build binaries
|
|
||||||
* Require `c++20`
|
* Require `c++20`
|
||||||
* Switched to Storj over Filebase for hosting binaries
|
* Switched to Storj over Filebase for hosting binaries
|
||||||
* Updated `OpenSSL` to v3.2.0
|
|
||||||
* Updated `boost` to v1.83.0
|
* Updated `boost` to v1.83.0
|
||||||
* Updated `cpp-httplib` to v0.14.2
|
* Updated `cpp-httplib` to v0.14.2
|
||||||
* Updated `curl` to v8.4.0
|
* Updated `curl` to v8.4.0
|
||||||
* Updated `libsodium` to v1.0.19
|
* Updated `libsodium` to v1.0.19
|
||||||
|
* Updated `OpenSSL` to v3.2.0
|
||||||
|
|
||||||
## v2.0.0-rc
|
## v2.0.0-rc
|
||||||
|
|
||||||
|
@ -148,7 +148,6 @@ endif()
|
|||||||
-DPROJECT_ENABLE_LIBSODIUM=${PROJECT_ENABLE_LIBSODIUM}
|
-DPROJECT_ENABLE_LIBSODIUM=${PROJECT_ENABLE_LIBSODIUM}
|
||||||
-DPROJECT_ENABLE_OPENSSL=${PROJECT_ENABLE_OPENSSL}
|
-DPROJECT_ENABLE_OPENSSL=${PROJECT_ENABLE_OPENSSL}
|
||||||
-DPROJECT_ENABLE_PUGIXML=${PROJECT_ENABLE_PUGIXML}
|
-DPROJECT_ENABLE_PUGIXML=${PROJECT_ENABLE_PUGIXML}
|
||||||
-DPROJECT_ENABLE_ROCKSDB=${PROJECT_ENABLE_ROCKSDB}
|
|
||||||
-DPROJECT_ENABLE_SPDLOG=${PROJECT_ENABLE_SPDLOG}
|
-DPROJECT_ENABLE_SPDLOG=${PROJECT_ENABLE_SPDLOG}
|
||||||
-DPROJECT_ENABLE_SQLITE=${PROJECT_ENABLE_SQLITE}
|
-DPROJECT_ENABLE_SQLITE=${PROJECT_ENABLE_SQLITE}
|
||||||
-DPROJECT_ENABLE_STDUUID=${PROJECT_ENABLE_STDUUID}
|
-DPROJECT_ENABLE_STDUUID=${PROJECT_ENABLE_STDUUID}
|
||||||
|
71
README.md
71
README.md
@ -1,15 +1,16 @@
|
|||||||
# Repertory
|
# Repertory
|
||||||
|
|
||||||
Repertory allows you to mount AWS S3 and Sia via FUSE on Linux ~~/OS X~~ or via WinFSP
|
Repertory allows you to mount AWS S3 and Sia via FUSE on Linux~~/OS X~~ or via WinFSP
|
||||||
on Windows.
|
on Windows.
|
||||||
|
|
||||||
## Details and Features
|
## Details and Features
|
||||||
|
|
||||||
* Optimized for [Plex Media Server](https://www.plex.tv/)
|
* Optimized for [Plex Media Server](https://www.plex.tv/)
|
||||||
* Single application to mount AWS S3 and/or Sia
|
* Single application to mount AWS S3 and/or Sia
|
||||||
* Remote mounting of Repertory instances on Linux ~~, OS X~~ and Windows
|
* Only 1 Sia mount and 1 S3 mount (per bucket) per user is supported.
|
||||||
|
* Remote mounting of Repertory instances on Linux~~, OS X~~ and Windows
|
||||||
* Securely share your mounts over TCP/IP (`XChaCha20-Poly1305` stream cipher)
|
* Securely share your mounts over TCP/IP (`XChaCha20-Poly1305` stream cipher)
|
||||||
* Cross-platform support (Linux 64-bit, Linux arm64/aarch64, ~~OS X,~~ Windows 64-bit)
|
* Cross-platform support (Linux 64-bit, Linux arm64/aarch64,~~OS X,~~ Windows 64-bit)
|
||||||
|
|
||||||
## Minimum Requirements
|
## Minimum Requirements
|
||||||
|
|
||||||
@ -28,70 +29,6 @@ on Windows.
|
|||||||
* ~~OS X Mojave and above~~
|
* ~~OS X Mojave and above~~
|
||||||
* Windows 64-bit 10, 11
|
* Windows 64-bit 10, 11
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Notable Options
|
|
||||||
|
|
||||||
* `-dc`
|
|
||||||
* Display mount configuration.
|
|
||||||
* For Sia, `--name` is optional
|
|
||||||
* For S3, the `-s3` option is required along with `--name`
|
|
||||||
* `--help`
|
|
||||||
* Display all mount utility options.
|
|
||||||
* `--name, -na [name]`
|
|
||||||
* The `--name` option can be set to any valid value allowed as a file name for your filesystem.
|
|
||||||
* For Sia, the bucket name will be set to the same value if it is empty in the configuration file.
|
|
||||||
* If the `--name` option is not specified, `default` will be used.
|
|
||||||
* For S3, the `--name` option is required and does not affect the bucket name.
|
|
||||||
* `-set SiaConfig.Bucket`
|
|
||||||
* Set Sia bucket name for the mount.
|
|
||||||
* Can be used in combination with `--name` to target a unique configuration.
|
|
||||||
* `-set S3Config.Bucket`
|
|
||||||
* S3 bucket name for the mount.
|
|
||||||
* Must be used in combination with `--name` to target a unique configuration.
|
|
||||||
* Must be used in combination with `-s3`.
|
|
||||||
|
|
||||||
### Sia
|
|
||||||
|
|
||||||
* Linux
|
|
||||||
* `repertory /mnt/location`
|
|
||||||
* `repertory --name default /mnt/location`
|
|
||||||
* Windows
|
|
||||||
* `repertory.exe t:`
|
|
||||||
* `repertory.exe --name default t:`
|
|
||||||
|
|
||||||
### S3
|
|
||||||
|
|
||||||
* Linux
|
|
||||||
* `repertory --name storj -s3 /mnt/location`
|
|
||||||
* Windows
|
|
||||||
* `repertory.exe --name storj -s3 t:`
|
|
||||||
|
|
||||||
## Compiling
|
|
||||||
|
|
||||||
* Successful compilation will result in all required files being placed in the `dist/` directory
|
|
||||||
* Linux
|
|
||||||
* Ensure `docker` is installed
|
|
||||||
* For x86_64:
|
|
||||||
* RelWithDebInfo: `scripts/make_unix.sh`
|
|
||||||
* Release: `scripts/make_unix.sh x86_64 Release`
|
|
||||||
* Debug: `scripts/make_unix.sh x86_64 Debug`
|
|
||||||
* For aarch64:
|
|
||||||
* RelWithDebInfo: `scripts/make_unix.sh aarch64`
|
|
||||||
* Release: `scripts/make_unix.sh aarch64 Release`
|
|
||||||
* Debug: `scripts/make_unix.sh aarch64 Debug`
|
|
||||||
* Windows
|
|
||||||
* OFFICIAL: Cross-compiling on Linux
|
|
||||||
* Ensure `docker` is installed
|
|
||||||
* RelWithDebInfo: `scripts/make_win32.sh`
|
|
||||||
* Release: `scripts/make_win32.sh x86_64 Release`
|
|
||||||
* Debug: `scripts/make_win32.sh x86_64 Debug`
|
|
||||||
* UNOFFICIAL: Compiling on Windows
|
|
||||||
* Ensure latest [MSYS2](https://www.msys2.org/) is installed
|
|
||||||
* RelWithDebInfo: `scripts\make_win32.cmd`
|
|
||||||
* Release: `scripts\make_win32.cmd x86_64 Release`
|
|
||||||
* Debug: `scripts\make_win32.cmd x86_64 Debug`
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
* [boost c++ libraries](https://www.boost.org/)
|
* [boost c++ libraries](https://www.boost.org/)
|
||||||
|
@ -1,20 +1,41 @@
|
|||||||
set(BINUTILS_HASH ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450)
|
set(BINUTILS_HASH ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450)
|
||||||
set(BOOST_HASH f55c340aa49763b1925ccf02b2e83f35fdcf634c9d5164a2acb87540173c741d)
|
|
||||||
set(BOOST2_HASH 7bd7ddceec1a1dfdcbdb3e609b60d01739c38390a5f956385a12f3122049f0ca)
|
set(BOOST2_HASH 7bd7ddceec1a1dfdcbdb3e609b60d01739c38390a5f956385a12f3122049f0ca)
|
||||||
set(CPP_HTTPLIB_HASH 405abd8170f2a446fc8612ac635d0db5947c0d2e156e32603403a4496255ff00)
|
set(BOOST_HASH be0d91732d5b0cc6fbb275c7939974457e79b54d6f07ce2e3dfdd68bef883b0b)
|
||||||
set(CURL_HASH 5a231145114589491fc52da118f9c7ef8abee885d1cb1ced99c7290e9a352f07)
|
set(CLI11_HASH f2d893a65c3b1324c50d4e682c0cdc021dd0477ae2c048544f39eed6654b699a)
|
||||||
set(EXPAT_HASH 372b18f6527d162fa9658f1c74d22a37429b82d822f5a1e1fc7e00f6045a06a2)
|
set(CPP_HTTPLIB_HASH c1742fc7179aaae2a67ad9bba0740b7e9ffaf4f5e62feef53101ecdef1478716)
|
||||||
|
set(CURL_HASH d714818f6ac41ae9154850158fed44b7a87650a6d52f83d3bcb9aa527be354d7)
|
||||||
|
set(CXXOPTS_HASH 841f49f2e045b9c6365997c2a8fbf76e6f215042dda4511a5bb04bc5ebc7f88a)
|
||||||
|
set(EXPAT_HASH fbd032683370d761ba68dba2566d3280a154f5290634172d60a79b24d366d9dc)
|
||||||
|
set(FLAC_HASH 0a4bb82a30609b606650d538a804a7b40205366ce8fc98871b0ecf3fbb0611ee)
|
||||||
|
set(FMT_HASH 6cb1e6d37bdcb756dbbe59be438790db409cdb4868c66e888d5df9f13f7c027f)
|
||||||
|
set(FONTCONFIG_HASH f5f359d6332861bd497570848fcb42520964a9e83d5e3abe397b6b6db9bcaaf4)
|
||||||
|
set(FREETYPE2_HASH 5c3a8e78f7b24c20b25b54ee575d6daa40007a5f4eea2845861c3409b3021747)
|
||||||
set(GCC_HASH 7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293)
|
set(GCC_HASH 7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293)
|
||||||
set(GTEST_HASH 7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926)
|
set(GTEST_HASH 7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926)
|
||||||
set(ICU_HASH 925e6b4b8cf8856e0ac214f6f34e30dee63b7bb7a50460ab4603950eff48f89e)
|
set(ICU_HASH 925e6b4b8cf8856e0ac214f6f34e30dee63b7bb7a50460ab4603950eff48f89e)
|
||||||
set(JSON_HASH 0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
|
set(JSON_HASH 0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
|
||||||
|
set(LIBDSM_HASH 747c4563d6291303d9b085c9e7dc96ac44f91871dcac3e20480fdcc066eee88a)
|
||||||
|
set(LIBEVENT_HASH 7180a979aaa7000e1264da484f712d403fcf7679b1e9212c4e3d09f5c93efc24)
|
||||||
|
set(LIBICONV_HASH 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313)
|
||||||
|
set(LIBJPEG_TURBO_HASH a649205a90e39a548863a3614a9576a3fb4465f8e8e66d54999f127957c25b21)
|
||||||
|
set(LIBPNG_HASH fecc95b46cf05e8e3fc8a414750e0ba5aad00d89e9fdf175e94ff041caf1a03a)
|
||||||
set(LIBSODIUM_HASH 8e5aeca07a723a27bbecc3beef14b0068d37e7fc0e97f51b3f1c82d2a58005c1)
|
set(LIBSODIUM_HASH 8e5aeca07a723a27bbecc3beef14b0068d37e7fc0e97f51b3f1c82d2a58005c1)
|
||||||
|
set(LIBTASN_HASH 1613f0ac1cf484d6ec0ce3b8c06d56263cc7242f1c23b30d82d23de345a63f7a)
|
||||||
set(MINGW_HASH 3f66bce069ee8bed7439a1a13da7cb91a5e67ea6170f21317ac7f5794625ee10)
|
set(MINGW_HASH 3f66bce069ee8bed7439a1a13da7cb91a5e67ea6170f21317ac7f5794625ee10)
|
||||||
set(OPENSSL_HASH e15dda82fe2fe8139dc2ac21a36d4ca01d5313c75f99f46c4e8a27709b7294bf)
|
set(NANA_HASH 56f7b1ed006c750fccf8ef15ab1e83f96751f2dfdcb68d93e5f712a6c9b58bcb)
|
||||||
|
set(NUSPELL_HASH 5d4baa1daf833a18dc06ae0af0571d9574cc849d47daff6b9ce11dac0a5ded6a)
|
||||||
|
set(OGG_HASH 0eb4b4b9420a0f51db142ba3f9c64b333f826532dc0f48c6410ae51f4799b664)
|
||||||
|
set(OPENAL_HASH dfddf3a1f61059853c625b7bb03de8433b455f2f79f89548cbcbd5edca3d4a4a)
|
||||||
|
set(OPENSSL_HASH 777cd596284c883375a2a7a11bf5d2786fc5413255efab20c50d6ffe6d020b7e)
|
||||||
set(PKG_CONFIG_HASH 6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591)
|
set(PKG_CONFIG_HASH 6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591)
|
||||||
set(PUGIXML_HASH 2f10e276870c64b1db6809050a75e11a897a8d7456c4be5c6b2e35a11168a015)
|
set(PUGIXML_HASH 2f10e276870c64b1db6809050a75e11a897a8d7456c4be5c6b2e35a11168a015)
|
||||||
set(ROCKSDB_HASH 9b810c81731835fda0d4bbdb51d3199d901fa4395733ab63752d297da84c5a47)
|
set(ROCKSDB_HASH b20780586d3df4a3c5bcbde341a2c1946b03d18237960bda5bc5e9538f42af40)
|
||||||
set(SPDLOG_HASH 9962648c9b4f1a7bbc76fd8d9172555bad1871fdb14ff4f842ef87949682caa5)
|
set(SDL_HASH 254a767aa486fa6308d4473159c1f23c794610be775d63e98084111d96814b85)
|
||||||
|
set(SECP256K1_HASH 61583939f1f25b92e6401e5b819e399da02562de663873df3056993b40148701)
|
||||||
|
set(SFML_HASH 82535db9e57105d4f3a8aedabd138631defaedc593cab589c924b7d7a11ffb9d)
|
||||||
|
set(SPDLOG_HASH 1586508029a7d0670dfcb2d97575dcdc242d3868a259742b69f100801ab4e16b)
|
||||||
set(SQLITE_HASH 77823cb110929c2bcb0f5d48e4833b5c59a8a6e40cdea3936b99e199dbbe5784)
|
set(SQLITE_HASH 77823cb110929c2bcb0f5d48e4833b5c59a8a6e40cdea3936b99e199dbbe5784)
|
||||||
set(STDUUID_HASH b1176597e789531c38481acbbed2a6894ad419aab0979c10410d59eb0ebf40d3)
|
set(STDUUID_HASH b1176597e789531c38481acbbed2a6894ad419aab0979c10410d59eb0ebf40d3)
|
||||||
|
set(VORBIS_HASH 270c76933d0934e42c5ee0a54a36280e2d87af1de3cc3e584806357e237afd13)
|
||||||
|
set(WXWIDGETS_HASH 0ad86a3ad3e2e519b6a705248fc9226e3a09bbf069c6c692a02acf7c2d1c6b51)
|
||||||
set(ZLIB_HASH 17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c)
|
set(ZLIB_HASH 17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c)
|
||||||
|
@ -17,7 +17,6 @@ include(cmake/libraries/fuse.cmake)
|
|||||||
include(cmake/libraries/json.cmake)
|
include(cmake/libraries/json.cmake)
|
||||||
include(cmake/libraries/libsodium.cmake)
|
include(cmake/libraries/libsodium.cmake)
|
||||||
include(cmake/libraries/pugixml.cmake)
|
include(cmake/libraries/pugixml.cmake)
|
||||||
include(cmake/libraries/rocksdb.cmake)
|
|
||||||
include(cmake/libraries/spdlog.cmake)
|
include(cmake/libraries/spdlog.cmake)
|
||||||
include(cmake/libraries/sqlite.cmake)
|
include(cmake/libraries/sqlite.cmake)
|
||||||
include(cmake/libraries/stduuid.cmake)
|
include(cmake/libraries/stduuid.cmake)
|
||||||
|
@ -18,47 +18,25 @@ if(PROJECT_ENABLE_BOOST)
|
|||||||
if(PROJECT_BUILD)
|
if(PROJECT_BUILD)
|
||||||
add_definitions(-DPROJECT_ENABLE_BOOST)
|
add_definitions(-DPROJECT_ENABLE_BOOST)
|
||||||
|
|
||||||
if (PROJECT_ENABLE_LIBBITCOIN_SYSTEM)
|
find_package(Boost ${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_PATCH_VERSION} EXACT
|
||||||
find_package(Boost ${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_PATCH_VERSION} EXACT
|
REQUIRED
|
||||||
REQUIRED
|
COMPONENTS
|
||||||
COMPONENTS
|
atomic
|
||||||
atomic
|
chrono
|
||||||
chrono
|
date_time
|
||||||
date_time
|
filesystem
|
||||||
filesystem
|
iostreams
|
||||||
iostreams
|
locale
|
||||||
locale
|
log
|
||||||
log
|
log_setup
|
||||||
log_setup
|
program_options
|
||||||
program_options
|
random
|
||||||
random
|
regex
|
||||||
regex
|
serialization
|
||||||
serialization
|
system
|
||||||
system
|
thread
|
||||||
thread
|
wserialization
|
||||||
wserialization
|
)
|
||||||
)
|
|
||||||
else()
|
|
||||||
find_package(Boost ${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_PATCH_VERSION}
|
|
||||||
REQUIRED
|
|
||||||
COMPONENTS
|
|
||||||
atomic
|
|
||||||
chrono
|
|
||||||
date_time
|
|
||||||
filesystem
|
|
||||||
iostreams
|
|
||||||
locale
|
|
||||||
log
|
|
||||||
log_setup
|
|
||||||
program_options
|
|
||||||
random
|
|
||||||
regex
|
|
||||||
serialization
|
|
||||||
system
|
|
||||||
thread
|
|
||||||
wserialization
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories(BEFORE SYSTEM
|
include_directories(BEFORE SYSTEM
|
||||||
${Boost_INCLUDE_DIRS}
|
${Boost_INCLUDE_DIRS}
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
if(PROJECT_ENABLE_ROCKSDB)
|
|
||||||
if(PROJECT_BUILD)
|
|
||||||
add_definitions(-DPROJECT_ENABLE_ROCKSDB)
|
|
||||||
find_library(ROCKSDB_LIBRARY NAMES librocksdb.a REQUIRED)
|
|
||||||
link_libraries(${ROCKSDB_LIBRARY})
|
|
||||||
elseif(NOT PROJECT_IS_MINGW OR CMAKE_HOST_WIN32)
|
|
||||||
ExternalProject_Add(rocksdb_project
|
|
||||||
PREFIX external
|
|
||||||
URL ${PROJECT_3RD_PARTY_DIR}/rocksdb-${ROCKSDB_VERSION}.tar.gz
|
|
||||||
URL_HASH SHA256=${ROCKSDB_HASH}
|
|
||||||
LIST_SEPARATOR |
|
|
||||||
CMAKE_ARGS ${PROJECT_EXTERNAL_CMAKE_FLAGS}
|
|
||||||
-DBUILD_SHARED_LIBS=OFF
|
|
||||||
-DBUILD_STATIC_LIBS=ON
|
|
||||||
-DFAIL_ON_WARNINGS=OFF
|
|
||||||
-DPORTABLE=1
|
|
||||||
-DROCKSDB_BUILD_SHARED=OFF
|
|
||||||
-DROCKSDB_INSTALL_ON_WINDOWS=ON
|
|
||||||
-DWITH_BENCHMARK=OFF
|
|
||||||
-DWITH_BENCHMARK_TOOLS=OFF
|
|
||||||
-DWITH_CORE_TOOLS=OFF
|
|
||||||
-DWITH_EXAMPLES=OFF
|
|
||||||
-DWITH_GFLAGS=OFF
|
|
||||||
-DWITH_IOSTATS_CONTEXT=OFF
|
|
||||||
-DWITH_PERF_CONTEXT=OFF
|
|
||||||
-DWITH_TESTS=OFF
|
|
||||||
-DWITH_TOOLS=OFF
|
|
||||||
-DWITH_TRACE_TOOLS=OFF
|
|
||||||
-DWITH_ZLIB=ON
|
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND PROJECT_DEPENDENCIES rocksdb_project)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
@ -6,7 +6,6 @@ option(PROJECT_ENABLE_JSON "Enable JSON for Modern C++ library" ON)
|
|||||||
option(PROJECT_ENABLE_LIBSODIUM "Enable libsodium library" ON)
|
option(PROJECT_ENABLE_LIBSODIUM "Enable libsodium library" ON)
|
||||||
option(PROJECT_ENABLE_OPENSSL "Enable OpenSSL library" ON)
|
option(PROJECT_ENABLE_OPENSSL "Enable OpenSSL library" ON)
|
||||||
option(PROJECT_ENABLE_PUGIXML "Enable PugiXML library" ON)
|
option(PROJECT_ENABLE_PUGIXML "Enable PugiXML library" ON)
|
||||||
option(PROJECT_ENABLE_ROCKSDB "Enable RocksDB library" ON)
|
|
||||||
option(PROJECT_ENABLE_SPDLOG "Enable spdlog library" ON)
|
option(PROJECT_ENABLE_SPDLOG "Enable spdlog library" ON)
|
||||||
option(PROJECT_ENABLE_SQLITE "Enable SQLite" ON)
|
option(PROJECT_ENABLE_SQLITE "Enable SQLite" ON)
|
||||||
option(PROJECT_ENABLE_STDUUID "Enable stduuid library" ON)
|
option(PROJECT_ENABLE_STDUUID "Enable stduuid library" ON)
|
||||||
|
@ -3,26 +3,51 @@ set(BOOST2_MAJOR_VERSION 1)
|
|||||||
set(BOOST2_MINOR_VERSION 76)
|
set(BOOST2_MINOR_VERSION 76)
|
||||||
set(BOOST2_PATCH_VERSION 0)
|
set(BOOST2_PATCH_VERSION 0)
|
||||||
set(BOOST_MAJOR_VERSION 1)
|
set(BOOST_MAJOR_VERSION 1)
|
||||||
set(BOOST_MINOR_VERSION 87)
|
set(BOOST_MINOR_VERSION 85)
|
||||||
set(BOOST_PATCH_VERSION 0)
|
set(BOOST_PATCH_VERSION 0)
|
||||||
set(CPP_HTTPLIB_VERSION 0.18.1)
|
set(CLI11_VERSION 2.4.2)
|
||||||
set(CURL2_VERSION 8_11_0)
|
set(CPP_HTTPLIB_VERSION 0.16.3)
|
||||||
set(CURL_VERSION 8.11.0)
|
set(CURL2_VERSION 8_9_1)
|
||||||
set(EXPAT2_VERSION 2_6_4)
|
set(CURL_VERSION 8.9.1)
|
||||||
set(EXPAT_VERSION 2.6.4)
|
set(CXXOPTS_VERSION 3.2.1)
|
||||||
|
set(DTL_VERSION 2.01)
|
||||||
|
set(EXPAT2_VERSION 2_6_2)
|
||||||
|
set(EXPAT_VERSION 2.6.2)
|
||||||
|
set(FLAC_VERSION 1.4.3)
|
||||||
|
set(FMT_VERSION 11.0.2)
|
||||||
|
set(FONTCONFIG_VERSION 2.15.0)
|
||||||
|
set(FREETYPE2_VERSION 2.13.3)
|
||||||
set(GCC_VERSION 14.2.0)
|
set(GCC_VERSION 14.2.0)
|
||||||
set(GTEST_VERSION 1.15.2)
|
set(GTEST_VERSION 1.15.2)
|
||||||
|
set(GTKMM_VERSION 3.0)
|
||||||
set(ICU_VERSION 75-1)
|
set(ICU_VERSION 75-1)
|
||||||
set(JSON_VERSION 3.11.3)
|
set(JSON_VERSION 3.11.3)
|
||||||
|
set(LIBBITCOIN_SYSTEM_VERSION 3.8.0)
|
||||||
|
set(LIBDSM_VERSION 0.4.3)
|
||||||
|
set(LIBEVENT_VERSION 2.1.12)
|
||||||
|
set(LIBICONV_VERSION 1.17)
|
||||||
|
set(LIBJPEG_TURBO_VERSION 3.0.3)
|
||||||
|
set(LIBPNG_VERSION 1.6.43)
|
||||||
set(LIBSODIUM_VERSION 1.0.20)
|
set(LIBSODIUM_VERSION 1.0.20)
|
||||||
|
set(LIBTASN_VERSION 4.19.0)
|
||||||
set(MESA_VERSION 23.3.3)
|
set(MESA_VERSION 23.3.3)
|
||||||
set(MINGW_VERSION 11.0.1)
|
set(MINGW_VERSION 11.0.1)
|
||||||
set(OPENSSL_VERSION 3.4.0)
|
set(NANA_VERSION 1.7.4)
|
||||||
|
set(NUSPELL_VERSION 5.1.6)
|
||||||
|
set(OGG_VERSION 1.3.5)
|
||||||
|
set(OPENAL_VERSION 1.23.1)
|
||||||
|
set(OPENSSL_VERSION 3.3.1)
|
||||||
set(PKG_CONFIG_VERSION 0.29.2)
|
set(PKG_CONFIG_VERSION 0.29.2)
|
||||||
set(PUGIXML_VERSION 1.14)
|
set(PUGIXML_VERSION 1.14)
|
||||||
set(ROCKSDB_VERSION 9.7.4)
|
set(ROCKSDB_VERSION 9.5.2)
|
||||||
set(SPDLOG_VERSION 1.15.0)
|
set(SDL_VERSION 2.30.6)
|
||||||
|
set(SECP256K1_VERSION 0.1.0.20)
|
||||||
|
set(SFML_VERSION 2.6.1)
|
||||||
|
set(SPDLOG_VERSION 1.14.1)
|
||||||
set(SQLITE2_VERSION 3.46.1)
|
set(SQLITE2_VERSION 3.46.1)
|
||||||
set(SQLITE_VERSION 3460100)
|
set(SQLITE_VERSION 3460100)
|
||||||
set(STDUUID_VERSION 1.2.3)
|
set(STDUUID_VERSION 1.2.3)
|
||||||
|
set(VLC_VERSION 3.0)
|
||||||
|
set(VORBIS_VERSION 1.3.7)
|
||||||
|
set(WXWIDGETS_VERSION 3.2.5)
|
||||||
set(ZLIB_VERSION 1.3.1)
|
set(ZLIB_VERSION 1.3.1)
|
||||||
|
@ -30,7 +30,6 @@ PROJECT_ENABLE_JSON=ON
|
|||||||
PROJECT_ENABLE_LIBSODIUM=ON
|
PROJECT_ENABLE_LIBSODIUM=ON
|
||||||
PROJECT_ENABLE_OPENSSL=ON
|
PROJECT_ENABLE_OPENSSL=ON
|
||||||
PROJECT_ENABLE_PUGIXML=ON
|
PROJECT_ENABLE_PUGIXML=ON
|
||||||
PROJECT_ENABLE_ROCKSDB=ON
|
|
||||||
PROJECT_ENABLE_SPDLOG=ON
|
PROJECT_ENABLE_SPDLOG=ON
|
||||||
PROJECT_ENABLE_SQLITE=ON
|
PROJECT_ENABLE_SQLITE=ON
|
||||||
PROJECT_ENABLE_STDUUID=ON
|
PROJECT_ENABLE_STDUUID=ON
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM arm64v8/alpine:3.20.3
|
FROM arm64v8/alpine:3.20.2
|
||||||
MAINTAINER Scott E. Graves <scott.e.graves@protonmail.com>
|
MAINTAINER Scott E. Graves <scott.e.graves@protonmail.com>
|
||||||
CMD bash
|
CMD bash
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM alpine:3.20.3
|
FROM alpine:3.20.2
|
||||||
MAINTAINER Scott E. Graves <scott.e.graves@protonmail.com>
|
MAINTAINER Scott E. Graves <scott.e.graves@protonmail.com>
|
||||||
CMD bash
|
CMD bash
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#comment
|
#comment
|
||||||
FROM alpine:3.20.3
|
FROM alpine:3.20.2
|
||||||
|
|
||||||
RUN apk update
|
RUN apk update
|
||||||
RUN apk upgrade
|
RUN apk upgrade
|
||||||
@ -572,8 +572,8 @@ RUN if [ -f "/3rd_party/flac-${MY_FLAC_VERSION}.tar.gz" ]; then \
|
|||||||
&& cd build \
|
&& cd build \
|
||||||
&& cmake .. \
|
&& cmake .. \
|
||||||
-DBUILD_DOCS=OFF \
|
-DBUILD_DOCS=OFF \
|
||||||
-DBUILD_EXAMPLES=OFF \
|
-DBUILD_EXAMPLES=ON \
|
||||||
-DBUILD_PROGRAMS=OFF \
|
-DBUILD_PROGRAMS=ON \
|
||||||
-DBUILD_SHARED_LIBS=ON \
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
-DBUILD_STATIC_LIBS=ON \
|
-DBUILD_STATIC_LIBS=ON \
|
||||||
-DBUILD_TESTING=OFF \
|
-DBUILD_TESTING=OFF \
|
||||||
@ -604,7 +604,6 @@ RUN if [ -f "/3rd_party/SFML-${MY_SFML_VERSION}.tar.gz" ]; then \
|
|||||||
-DBUILD_STATIC_LIBS=ON \
|
-DBUILD_STATIC_LIBS=ON \
|
||||||
-DCMAKE_CXX_STANDARD=${MY_CXX_STANDARD} \
|
-DCMAKE_CXX_STANDARD=${MY_CXX_STANDARD} \
|
||||||
-DCMAKE_INSTALL_PREFIX=${MY_MINGW_DIR} \
|
-DCMAKE_INSTALL_PREFIX=${MY_MINGW_DIR} \
|
||||||
-DCMAKE_SYSTEM_PROCESSOR=AMD64 \
|
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${MY_TOOLCHAIN_FILE_CMAKE} \
|
-DCMAKE_TOOLCHAIN_FILE=${MY_TOOLCHAIN_FILE_CMAKE} \
|
||||||
&& make -j${MY_NUM_JOBS} \
|
&& make -j${MY_NUM_JOBS} \
|
||||||
&& make install \
|
&& make install \
|
||||||
|
@ -3,8 +3,5 @@
|
|||||||
CURRENT_DIR=$(dirname "$0")
|
CURRENT_DIR=$(dirname "$0")
|
||||||
CURRENT_DIR=$(realpath ${CURRENT_DIR})
|
CURRENT_DIR=$(realpath ${CURRENT_DIR})
|
||||||
|
|
||||||
rsync -av --progress ${CURRENT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}_test/test_input/ \
|
rsync -av --progress ${CURRENT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}_test/test_data/ ${PROJECT_BUILD_DIR}/build/test_data/
|
||||||
${PROJECT_BUILD_DIR}/build/test_input/
|
rsync -av --progress ${CURRENT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}_test/test_data/ ${PROJECT_DIST_DIR}/test_data/
|
||||||
|
|
||||||
rsync -av --progress ${CURRENT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}_test/test_input/ \
|
|
||||||
${PROJECT_DIST_DIR}/test_input/
|
|
||||||
|
@ -19,12 +19,13 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_APP_CONFIG_HPP_
|
#ifndef INCLUDE_APP_CONFIG_HPP_
|
||||||
#define REPERTORY_INCLUDE_APP_CONFIG_HPP_
|
#define INCLUDE_APP_CONFIG_HPP_
|
||||||
|
|
||||||
#include "events/event.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "types/remote.hpp"
|
#include "events/events.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
#include "utils/error_utils.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
class app_config final {
|
class app_config final {
|
||||||
@ -39,7 +40,7 @@ public:
|
|||||||
default_data_directory(const provider_type &prov) -> std::string;
|
default_data_directory(const provider_type &prov) -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] static auto
|
[[nodiscard]] static auto
|
||||||
default_remote_api_port(const provider_type &prov) -> std::uint16_t;
|
default_remote_port(const provider_type &prov) -> std::uint16_t;
|
||||||
|
|
||||||
[[nodiscard]] static auto
|
[[nodiscard]] static auto
|
||||||
default_rpc_port(const provider_type &prov) -> std::uint16_t;
|
default_rpc_port(const provider_type &prov) -> std::uint16_t;
|
||||||
@ -53,206 +54,400 @@ public:
|
|||||||
public:
|
public:
|
||||||
app_config(const provider_type &prov, std::string_view data_directory = "");
|
app_config(const provider_type &prov, std::string_view data_directory = "");
|
||||||
|
|
||||||
app_config() = delete;
|
|
||||||
app_config(app_config &&) = delete;
|
|
||||||
app_config(const app_config &) = delete;
|
|
||||||
|
|
||||||
~app_config() { save(); }
|
~app_config() { save(); }
|
||||||
|
|
||||||
auto operator=(const app_config &) -> app_config & = delete;
|
|
||||||
auto operator=(app_config &&) -> app_config & = delete;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
provider_type prov_;
|
provider_type prov_;
|
||||||
atomic<std::string> api_auth_;
|
std::string api_auth_;
|
||||||
std::atomic<std::uint16_t> api_port_;
|
std::uint16_t api_port_;
|
||||||
atomic<std::string> api_user_;
|
std::string api_user_;
|
||||||
std::atomic<bool> config_changed_;
|
bool config_changed_;
|
||||||
std::atomic<database_type> db_type_{database_type::rocksdb};
|
|
||||||
std::atomic<std::uint8_t> download_timeout_secs_;
|
|
||||||
std::atomic<bool> enable_download_timeout_;
|
|
||||||
std::atomic<bool> enable_drive_events_;
|
|
||||||
#if defined(_WIN32)
|
|
||||||
std::atomic<bool> enable_mount_manager_;
|
|
||||||
#endif // defined(_WIN32)
|
|
||||||
std::atomic<event_level> event_level_;
|
|
||||||
std::atomic<std::uint32_t> eviction_delay_mins_;
|
|
||||||
std::atomic<bool> eviction_uses_accessed_time_;
|
|
||||||
std::atomic<std::uint16_t> high_freq_interval_secs_;
|
|
||||||
std::atomic<std::uint16_t> low_freq_interval_secs_;
|
|
||||||
std::atomic<std::uint64_t> max_cache_size_bytes_;
|
|
||||||
std::atomic<std::uint8_t> max_upload_count_;
|
|
||||||
std::atomic<std::uint16_t> med_freq_interval_secs_;
|
|
||||||
std::atomic<std::uint16_t> online_check_retry_secs_;
|
|
||||||
std::atomic<std::uint16_t> orphaned_file_retention_days_;
|
|
||||||
std::atomic<download_type> preferred_download_type_;
|
|
||||||
std::atomic<std::uint16_t> retry_read_count_;
|
|
||||||
std::atomic<std::uint16_t> ring_buffer_file_size_;
|
|
||||||
std::atomic<std::uint16_t> task_wait_ms_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string cache_directory_;
|
|
||||||
std::string data_directory_;
|
std::string data_directory_;
|
||||||
atomic<encrypt_config> encrypt_config_;
|
std::uint8_t download_timeout_secs_;
|
||||||
atomic<host_config> host_config_;
|
bool enable_chunk_downloader_timeout_;
|
||||||
|
bool enable_comm_duration_events_;
|
||||||
|
bool enable_drive_events_;
|
||||||
|
bool enable_max_cache_size_;
|
||||||
|
#if defined(_WIN32)
|
||||||
|
bool enable_mount_manager_;
|
||||||
|
#endif
|
||||||
|
bool enable_remote_mount_;
|
||||||
|
encrypt_config encrypt_config_;
|
||||||
|
event_level event_level_;
|
||||||
|
std::uint32_t eviction_delay_mins_;
|
||||||
|
bool eviction_uses_accessed_time_;
|
||||||
|
std::uint8_t high_freq_interval_secs_;
|
||||||
|
bool is_remote_mount_;
|
||||||
|
std::uint32_t low_freq_interval_secs_;
|
||||||
|
std::uint64_t max_cache_size_bytes_;
|
||||||
|
std::uint8_t max_upload_count_;
|
||||||
|
std::uint8_t min_download_timeout_secs_;
|
||||||
|
std::uint16_t online_check_retry_secs_;
|
||||||
|
std::uint16_t orphaned_file_retention_days_;
|
||||||
|
std::string preferred_download_type_;
|
||||||
|
std::uint8_t read_ahead_count_;
|
||||||
|
std::uint8_t remote_client_pool_size_;
|
||||||
|
std::string remote_host_name_or_ip_;
|
||||||
|
std::uint8_t remote_max_connections_;
|
||||||
|
std::uint16_t remote_port_;
|
||||||
|
std::uint16_t remote_receive_timeout_secs_;
|
||||||
|
std::uint16_t remote_send_timeout_secs_;
|
||||||
|
std::string remote_token_;
|
||||||
|
std::uint16_t retry_read_count_;
|
||||||
|
std::uint16_t ring_buffer_file_size_;
|
||||||
|
std::string cache_directory_;
|
||||||
|
host_config hc_;
|
||||||
|
s3_config s3_config_;
|
||||||
|
std::uint64_t version_{REPERTORY_CONFIG_VERSION};
|
||||||
std::string log_directory_;
|
std::string log_directory_;
|
||||||
mutable std::recursive_mutex read_write_mutex_;
|
mutable std::recursive_mutex read_write_mutex_;
|
||||||
atomic<remote::remote_config> remote_config_;
|
mutable std::recursive_mutex remote_mount_mutex_;
|
||||||
atomic<remote::remote_mount> remote_mount_;
|
|
||||||
atomic<s3_config> s3_config_;
|
|
||||||
atomic<sia_config> sia_config_;
|
|
||||||
std::unordered_map<std::string, std::function<std::string()>>
|
|
||||||
value_get_lookup_;
|
|
||||||
std::unordered_map<std::string,
|
|
||||||
std::function<std::string(const std::string &)>>
|
|
||||||
value_set_lookup_;
|
|
||||||
std::uint64_t version_{REPERTORY_CONFIG_VERSION};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto load() -> bool;
|
[[nodiscard]] auto load() -> bool;
|
||||||
|
|
||||||
|
template <typename dest>
|
||||||
|
auto get_value(const json &json_document, const std::string &name, dest &dst,
|
||||||
|
bool &success_flag) -> bool {
|
||||||
|
constexpr const auto *function_name =
|
||||||
|
static_cast<const char *>(__FUNCTION__);
|
||||||
|
|
||||||
|
auto ret = false;
|
||||||
|
try {
|
||||||
|
if (json_document.find(name) != json_document.end()) {
|
||||||
|
dst = json_document[name].get<dest>();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
success_flag = false;
|
||||||
|
}
|
||||||
|
} catch (const json::exception &ex) {
|
||||||
|
utils::error::raise_error(function_name, ex, "exception occurred");
|
||||||
|
success_flag = false;
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename dest, typename source>
|
template <typename dest, typename source>
|
||||||
auto set_value(dest &dst, const source &src) -> bool;
|
auto set_value(dest &dst, const source &src) -> bool {
|
||||||
|
auto ret = false;
|
||||||
|
recur_mutex_lock lock(read_write_mutex_);
|
||||||
|
if (dst != src) {
|
||||||
|
dst = src;
|
||||||
|
config_changed_ = true;
|
||||||
|
save();
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] auto get_api_auth() const -> std::string;
|
[[nodiscard]] auto get_api_auth() const -> std::string { return api_auth_; }
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_port() const -> std::uint16_t;
|
[[nodiscard]] auto get_api_port() const -> std::uint16_t { return api_port_; }
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_user() const -> std::string;
|
[[nodiscard]] auto get_api_user() const -> std::string { return api_user_; }
|
||||||
|
|
||||||
[[nodiscard]] auto get_cache_directory() const -> std::string;
|
[[nodiscard]] auto get_cache_directory() const -> std::string {
|
||||||
|
return cache_directory_;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_chunk_downloader_timeout_secs() const -> std::uint8_t {
|
||||||
|
return std::max(min_download_timeout_secs_, download_timeout_secs_);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_config_file_path() const -> std::string;
|
[[nodiscard]] auto get_config_file_path() const -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] auto get_database_type() const -> database_type;
|
[[nodiscard]] auto get_data_directory() const -> std::string {
|
||||||
|
return data_directory_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_data_directory() const -> std::string;
|
[[nodiscard]] auto get_enable_chunk_download_timeout() const -> bool {
|
||||||
|
return enable_chunk_downloader_timeout_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_download_timeout_secs() const -> std::uint8_t;
|
[[nodiscard]] auto get_enable_comm_duration_events() const -> bool {
|
||||||
|
return enable_comm_duration_events_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_enable_download_timeout() const -> bool;
|
[[nodiscard]] auto get_enable_drive_events() const -> bool {
|
||||||
|
return enable_drive_events_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_enable_drive_events() const -> bool;
|
[[nodiscard]] auto get_encrypt_config() const -> encrypt_config {
|
||||||
|
return encrypt_config_;
|
||||||
[[nodiscard]] auto get_encrypt_config() const -> encrypt_config;
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
[[nodiscard]] auto get_enable_mount_manager() const -> bool;
|
[[nodiscard]] auto get_enable_mount_manager() const -> bool {
|
||||||
#endif // defined(_WIN32)
|
return enable_mount_manager_;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
[[nodiscard]] auto get_event_level() const -> event_level;
|
[[nodiscard]] auto get_enable_max_cache_size() const -> bool {
|
||||||
|
return enable_max_cache_size_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_eviction_delay_mins() const -> std::uint32_t;
|
[[nodiscard]] auto get_enable_remote_mount() const -> bool {
|
||||||
|
return enable_remote_mount_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_eviction_uses_accessed_time() const -> bool;
|
[[nodiscard]] auto get_event_level() const -> event_level {
|
||||||
|
return event_level_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_high_frequency_interval_secs() const -> std::uint16_t;
|
[[nodiscard]] auto get_eviction_delay_mins() const -> std::uint32_t {
|
||||||
|
return eviction_delay_mins_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_host_config() const -> host_config;
|
[[nodiscard]] auto get_eviction_uses_accessed_time() const -> bool {
|
||||||
|
return eviction_uses_accessed_time_;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_high_frequency_interval_secs() const -> std::uint8_t {
|
||||||
|
return std::max(static_cast<std::uint8_t>(1U), high_freq_interval_secs_);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_host_config() const -> host_config { return hc_; }
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_is_remote_mount() const -> bool {
|
||||||
|
return is_remote_mount_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_json() const -> json;
|
[[nodiscard]] auto get_json() const -> json;
|
||||||
|
|
||||||
[[nodiscard]] auto get_log_directory() const -> std::string;
|
[[nodiscard]] auto get_log_directory() const -> std::string {
|
||||||
|
return log_directory_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_low_frequency_interval_secs() const -> std::uint16_t;
|
[[nodiscard]] auto get_low_frequency_interval_secs() const -> std::uint32_t {
|
||||||
|
return std::max(1U, low_freq_interval_secs_);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_max_cache_size_bytes() const -> std::uint64_t;
|
[[nodiscard]] auto get_max_cache_size_bytes() const -> std::uint64_t;
|
||||||
|
|
||||||
[[nodiscard]] auto get_max_upload_count() const -> std::uint8_t;
|
[[nodiscard]] auto get_max_upload_count() const -> std::uint8_t {
|
||||||
|
return std::max(std::uint8_t(1U), max_upload_count_);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_med_frequency_interval_secs() const -> std::uint16_t;
|
[[nodiscard]] auto get_online_check_retry_secs() const -> std::uint16_t {
|
||||||
|
return std::max(std::uint16_t(15U), online_check_retry_secs_);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_online_check_retry_secs() const -> std::uint16_t;
|
[[nodiscard]] auto get_orphaned_file_retention_days() const -> std::uint16_t {
|
||||||
|
return std::min(static_cast<std::uint16_t>(31U),
|
||||||
|
std::max(static_cast<std::uint16_t>(1U),
|
||||||
|
orphaned_file_retention_days_));
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_orphaned_file_retention_days() const -> std::uint16_t;
|
[[nodiscard]] auto get_preferred_download_type() const -> download_type {
|
||||||
|
return download_type_from_string(preferred_download_type_,
|
||||||
|
download_type::fallback);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_preferred_download_type() const -> download_type;
|
[[nodiscard]] auto get_provider_type() const -> provider_type {
|
||||||
|
return prov_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_provider_type() const -> provider_type;
|
[[nodiscard]] auto get_read_ahead_count() const -> std::uint8_t {
|
||||||
|
return std::max(static_cast<std::uint8_t>(1U), read_ahead_count_);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_remote_config() const -> remote::remote_config;
|
[[nodiscard]] auto get_remote_client_pool_size() const -> std::uint8_t {
|
||||||
|
return std::max(static_cast<std::uint8_t>(5U), remote_client_pool_size_);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_remote_mount() const -> remote::remote_mount;
|
[[nodiscard]] auto get_remote_host_name_or_ip() const -> std::string {
|
||||||
|
return remote_host_name_or_ip_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_retry_read_count() const -> std::uint16_t;
|
[[nodiscard]] auto get_remote_max_connections() const -> std::uint8_t {
|
||||||
|
return std::max(static_cast<std::uint8_t>(1U), remote_max_connections_);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_ring_buffer_file_size() const -> std::uint16_t;
|
[[nodiscard]] auto get_remote_port() const -> std::uint16_t {
|
||||||
|
return remote_port_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_s3_config() const -> s3_config;
|
[[nodiscard]] auto get_remote_receive_timeout_secs() const -> std::uint16_t {
|
||||||
|
return remote_receive_timeout_secs_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_sia_config() const -> sia_config;
|
[[nodiscard]] auto get_remote_send_timeout_secs() const -> std::uint16_t {
|
||||||
|
return remote_send_timeout_secs_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_task_wait_ms() const -> std::uint16_t;
|
[[nodiscard]] auto get_remote_token() const -> std::string {
|
||||||
|
return remote_token_;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto get_retry_read_count() const -> std::uint16_t {
|
||||||
get_value_by_name(const std::string &name) const -> std::string;
|
return std::max(std::uint16_t(2), retry_read_count_);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_version() const -> std::uint64_t;
|
[[nodiscard]] auto get_ring_buffer_file_size() const -> std::uint16_t {
|
||||||
|
return std::max(
|
||||||
|
static_cast<std::uint16_t>(64U),
|
||||||
|
std::min(static_cast<std::uint16_t>(1024U), ring_buffer_file_size_));
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_s3_config() const -> s3_config { return s3_config_; }
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_value_by_name(const std::string &name) -> std::string;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_version() const -> std::uint64_t { return version_; }
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
void set_api_auth(const std::string &value);
|
void set_api_auth(const std::string &api_auth) {
|
||||||
|
set_value(api_auth_, api_auth);
|
||||||
|
}
|
||||||
|
|
||||||
void set_api_port(std::uint16_t value);
|
void set_api_port(std::uint16_t api_port) { set_value(api_port_, api_port); }
|
||||||
|
|
||||||
void set_api_user(const std::string &value);
|
void set_api_user(const std::string &api_user) {
|
||||||
|
set_value(api_user_, api_user);
|
||||||
|
}
|
||||||
|
|
||||||
void set_download_timeout_secs(std::uint8_t value);
|
void set_chunk_downloader_timeout_secs(
|
||||||
|
std::uint8_t chunk_downloader_timeout_secs) {
|
||||||
|
set_value(download_timeout_secs_, chunk_downloader_timeout_secs);
|
||||||
|
}
|
||||||
|
|
||||||
void set_database_type(const database_type &value);
|
void
|
||||||
|
set_enable_chunk_downloader_timeout(bool enable_chunk_downloader_timeout) {
|
||||||
|
set_value(enable_chunk_downloader_timeout_,
|
||||||
|
enable_chunk_downloader_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
void set_enable_download_timeout(bool value);
|
void set_enable_comm_duration_events(bool enable_comm_duration_events) {
|
||||||
|
set_value(enable_comm_duration_events_, enable_comm_duration_events);
|
||||||
|
}
|
||||||
|
|
||||||
void set_enable_drive_events(bool value);
|
void set_enable_drive_events(bool enable_drive_events) {
|
||||||
|
set_value(enable_drive_events_, enable_drive_events);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_enable_max_cache_size(bool enable_max_cache_size) {
|
||||||
|
set_value(enable_max_cache_size_, enable_max_cache_size);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
void set_enable_mount_manager(bool value);
|
void set_enable_mount_manager(bool enable_mount_manager) {
|
||||||
#endif // defined(_WIN32)
|
set_value(enable_mount_manager_, enable_mount_manager);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void set_event_level(const event_level &value);
|
void set_enable_remote_mount(bool enable_remote_mount);
|
||||||
|
|
||||||
void set_encrypt_config(encrypt_config value);
|
void set_event_level(const event_level &level) {
|
||||||
|
if (set_value(event_level_, level)) {
|
||||||
|
event_system::instance().raise<event_level_changed>(
|
||||||
|
event_level_to_string(level));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void set_eviction_delay_mins(std::uint32_t value);
|
void set_eviction_delay_mins(std::uint32_t eviction_delay_mins) {
|
||||||
|
set_value(eviction_delay_mins_, eviction_delay_mins);
|
||||||
|
}
|
||||||
|
|
||||||
void set_eviction_uses_accessed_time(bool value);
|
void set_eviction_uses_accessed_time(bool eviction_uses_accessed_time) {
|
||||||
|
set_value(eviction_uses_accessed_time_, eviction_uses_accessed_time);
|
||||||
|
}
|
||||||
|
|
||||||
void set_high_frequency_interval_secs(std::uint16_t value);
|
void
|
||||||
|
set_high_frequency_interval_secs(std::uint8_t high_frequency_interval_secs) {
|
||||||
|
set_value(high_freq_interval_secs_, high_frequency_interval_secs);
|
||||||
|
}
|
||||||
|
|
||||||
void set_host_config(host_config value);
|
#if defined(PROJECT_TESTING)
|
||||||
|
void set_host_config(host_config hc) {
|
||||||
|
config_changed_ = true;
|
||||||
|
hc_ = std::move(hc);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
void set_low_frequency_interval_secs(std::uint16_t value);
|
void set_s3_config(s3_config s3) {
|
||||||
|
config_changed_ = true;
|
||||||
|
s3_config_ = std::move(s3);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void set_max_cache_size_bytes(std::uint64_t value);
|
void set_is_remote_mount(bool is_remote_mount);
|
||||||
|
|
||||||
void set_max_upload_count(std::uint8_t value);
|
void
|
||||||
|
set_low_frequency_interval_secs(std::uint32_t low_frequency_interval_secs) {
|
||||||
|
set_value(low_freq_interval_secs_, low_frequency_interval_secs);
|
||||||
|
}
|
||||||
|
|
||||||
void set_med_frequency_interval_secs(std::uint16_t value);
|
void set_max_cache_size_bytes(std::uint64_t max_cache_size_bytes) {
|
||||||
|
set_value(max_cache_size_bytes_, max_cache_size_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
void set_online_check_retry_secs(std::uint16_t value);
|
void set_max_upload_count(std::uint8_t max_upload_count) {
|
||||||
|
set_value(max_upload_count_, max_upload_count);
|
||||||
|
}
|
||||||
|
|
||||||
void set_orphaned_file_retention_days(std::uint16_t value);
|
void set_online_check_retry_secs(std::uint16_t online_check_retry_secs) {
|
||||||
|
set_value(online_check_retry_secs_, online_check_retry_secs);
|
||||||
|
}
|
||||||
|
|
||||||
void set_preferred_download_type(const download_type &value);
|
void
|
||||||
|
set_orphaned_file_retention_days(std::uint16_t orphaned_file_retention_days) {
|
||||||
|
set_value(orphaned_file_retention_days_, orphaned_file_retention_days);
|
||||||
|
}
|
||||||
|
|
||||||
void set_remote_config(remote::remote_config value);
|
void set_preferred_download_type(const download_type &dt) {
|
||||||
|
set_value(preferred_download_type_, download_type_to_string(dt));
|
||||||
|
}
|
||||||
|
|
||||||
void set_remote_mount(remote::remote_mount value);
|
void set_read_ahead_count(std::uint8_t read_ahead_count) {
|
||||||
|
set_value(read_ahead_count_, read_ahead_count);
|
||||||
|
}
|
||||||
|
|
||||||
void set_retry_read_count(std::uint16_t value);
|
void set_remote_client_pool_size(std::uint8_t remote_client_pool_size) {
|
||||||
|
set_value(remote_client_pool_size_, remote_client_pool_size);
|
||||||
|
}
|
||||||
|
|
||||||
void set_ring_buffer_file_size(std::uint16_t value);
|
void set_ring_buffer_file_size(std::uint16_t ring_buffer_file_size) {
|
||||||
|
set_value(ring_buffer_file_size_, ring_buffer_file_size);
|
||||||
|
}
|
||||||
|
|
||||||
void set_s3_config(s3_config value);
|
void set_remote_host_name_or_ip(const std::string &remote_host_name_or_ip) {
|
||||||
|
set_value(remote_host_name_or_ip_, remote_host_name_or_ip);
|
||||||
|
}
|
||||||
|
|
||||||
void set_sia_config(sia_config value);
|
void set_remote_max_connections(std::uint8_t remote_max_connections) {
|
||||||
|
set_value(remote_max_connections_, remote_max_connections);
|
||||||
|
}
|
||||||
|
|
||||||
void set_task_wait_ms(std::uint16_t value);
|
void set_remote_port(std::uint16_t remote_port) {
|
||||||
|
set_value(remote_port_, remote_port);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_remote_receive_timeout_secs(std::uint16_t remote_receive_timeout_secs) {
|
||||||
|
set_value(remote_receive_timeout_secs_, remote_receive_timeout_secs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_remote_send_timeout_secs(std::uint16_t remote_send_timeout_secs) {
|
||||||
|
set_value(remote_send_timeout_secs_, remote_send_timeout_secs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_remote_token(const std::string &remote_token) {
|
||||||
|
set_value(remote_token_, remote_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_retry_read_count(std::uint16_t retry_read_count) {
|
||||||
|
set_value(retry_read_count_, retry_read_count);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto set_value_by_name(const std::string &name,
|
[[nodiscard]] auto set_value_by_name(const std::string &name,
|
||||||
const std::string &value) -> std::string;
|
const std::string &value) -> std::string;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_APP_CONFIG_HPP_
|
#endif // INCLUDE_APP_CONFIG_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
#ifndef INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
#define INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
||||||
|
|
||||||
#include "comm/curl/multi_request.hpp"
|
#include "comm/curl/multi_request.hpp"
|
||||||
#include "comm/i_http_comm.hpp"
|
#include "comm/i_http_comm.hpp"
|
||||||
@ -238,4 +238,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
#endif // INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_
|
#ifndef INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_
|
#define INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
@ -41,4 +41,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_
|
#endif // INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_DELETE_HPP_
|
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_DELETE_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_DELETE_HPP_
|
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_DELETE_HPP_
|
||||||
|
|
||||||
#include "comm/curl/requests/http_request_base.hpp"
|
#include "comm/curl/requests/http_request_base.hpp"
|
||||||
|
|
||||||
@ -28,13 +28,13 @@ namespace repertory::curl::requests {
|
|||||||
struct http_delete final : http_request_base {
|
struct http_delete final : http_request_base {
|
||||||
~http_delete() override = default;
|
~http_delete() override = default;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto set_method(CURL *curl,
|
||||||
set_method(CURL *curl,
|
stop_type & /* stop_requested */) const
|
||||||
stop_type & /* stop_requested */) const -> bool override {
|
-> bool override {
|
||||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace repertory::curl::requests
|
} // namespace repertory::curl::requests
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_DELETE_HPP_
|
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_DELETE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_GET_HPP_
|
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_GET_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_GET_HPP_
|
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_GET_HPP_
|
||||||
|
|
||||||
#include "comm/curl/requests/http_request_base.hpp"
|
#include "comm/curl/requests/http_request_base.hpp"
|
||||||
|
|
||||||
@ -33,13 +33,13 @@ struct http_get final : http_request_base {
|
|||||||
auto operator=(http_get &&) -> http_get & = default;
|
auto operator=(http_get &&) -> http_get & = default;
|
||||||
~http_get() override = default;
|
~http_get() override = default;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto set_method(CURL *curl,
|
||||||
set_method(CURL *curl,
|
stop_type & /*stop_requested*/) const
|
||||||
stop_type & /*stop_requested*/) const -> bool override {
|
-> bool override {
|
||||||
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
|
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace repertory::curl::requests
|
} // namespace repertory::curl::requests
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_GET_HPP_
|
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_GET_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_HEAD_HPP_
|
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_HEAD_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_HEAD_HPP_
|
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_HEAD_HPP_
|
||||||
|
|
||||||
#include "comm/curl/requests/http_request_base.hpp"
|
#include "comm/curl/requests/http_request_base.hpp"
|
||||||
|
|
||||||
@ -28,9 +28,9 @@ namespace repertory::curl::requests {
|
|||||||
struct http_head final : http_request_base {
|
struct http_head final : http_request_base {
|
||||||
~http_head() override = default;
|
~http_head() override = default;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto set_method(CURL *curl,
|
||||||
set_method(CURL *curl,
|
stop_type & /* stop_requested */) const
|
||||||
stop_type & /* stop_requested */) const -> bool override {
|
-> bool override {
|
||||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "HEAD");
|
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "HEAD");
|
||||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
|
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||||
return true;
|
return true;
|
||||||
@ -38,4 +38,4 @@ struct http_head final : http_request_base {
|
|||||||
};
|
};
|
||||||
} // namespace repertory::curl::requests
|
} // namespace repertory::curl::requests
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_HEAD_HPP_
|
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_HEAD_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_POST_HPP_
|
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_POST_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_POST_HPP_
|
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_POST_HPP_
|
||||||
|
|
||||||
#include "comm/curl/requests/http_request_base.hpp"
|
#include "comm/curl/requests/http_request_base.hpp"
|
||||||
|
|
||||||
@ -36,8 +36,9 @@ struct http_post final : http_request_base {
|
|||||||
|
|
||||||
std::optional<nlohmann::json> json;
|
std::optional<nlohmann::json> json;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto set_method(CURL *curl,
|
||||||
set_method(CURL *curl, stop_type & /*stop_requested*/) const -> bool override;
|
stop_type & /*stop_requested*/) const
|
||||||
|
-> bool override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable curl_slist *headers{nullptr};
|
mutable curl_slist *headers{nullptr};
|
||||||
@ -45,4 +46,4 @@ private:
|
|||||||
};
|
};
|
||||||
} // namespace repertory::curl::requests
|
} // namespace repertory::curl::requests
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_POST_HPP_
|
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_POST_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_PUT_FILE_HPP_
|
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_PUT_FILE_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_PUT_FILE_HPP_
|
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_PUT_FILE_HPP_
|
||||||
|
|
||||||
#include "comm/curl/requests/http_request_base.hpp"
|
#include "comm/curl/requests/http_request_base.hpp"
|
||||||
#include "utils/encrypting_reader.hpp"
|
#include "utils/encrypting_reader.hpp"
|
||||||
@ -47,4 +47,4 @@ private:
|
|||||||
};
|
};
|
||||||
} // namespace repertory::curl::requests
|
} // namespace repertory::curl::requests
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_PUT_FILE_HPP_
|
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_PUT_FILE_HPP_
|
||||||
|
@ -19,14 +19,16 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_
|
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_
|
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
#include "utils/file.hpp"
|
#include "utils/file.hpp"
|
||||||
|
|
||||||
namespace repertory::curl::requests {
|
namespace repertory::curl::requests {
|
||||||
using curl_response_callback =
|
using read_callback = size_t (*)(char *, size_t, size_t, void *);
|
||||||
|
|
||||||
|
using response_callback =
|
||||||
std::function<void(const data_buffer &data, long response_code)>;
|
std::function<void(const data_buffer &data, long response_code)>;
|
||||||
|
|
||||||
struct read_file_info final {
|
struct read_file_info final {
|
||||||
@ -35,8 +37,19 @@ struct read_file_info final {
|
|||||||
std::uint64_t offset{};
|
std::uint64_t offset{};
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] auto curl_file_reader(char *buffer, size_t size, size_t nitems,
|
inline const auto read_file_data = static_cast<read_callback>(
|
||||||
void *instream) -> size_t;
|
[](char *buffer, size_t size, size_t nitems, void *instream) -> size_t {
|
||||||
|
auto *read_info = reinterpret_cast<read_file_info *>(instream);
|
||||||
|
std::size_t bytes_read{};
|
||||||
|
auto ret =
|
||||||
|
read_info->file->read(reinterpret_cast<unsigned char *>(buffer),
|
||||||
|
size * nitems, read_info->offset, &bytes_read);
|
||||||
|
if (ret) {
|
||||||
|
read_info->offset += bytes_read;
|
||||||
|
}
|
||||||
|
return ret && not read_info->stop_requested ? bytes_read
|
||||||
|
: CURL_READFUNC_ABORT;
|
||||||
|
});
|
||||||
|
|
||||||
struct http_request_base {
|
struct http_request_base {
|
||||||
http_request_base() = default;
|
http_request_base() = default;
|
||||||
@ -55,16 +68,15 @@ struct http_request_base {
|
|||||||
std::string path{};
|
std::string path{};
|
||||||
http_query_parameters query{};
|
http_query_parameters query{};
|
||||||
std::optional<http_range> range{};
|
std::optional<http_range> range{};
|
||||||
std::optional<curl_response_callback> response_handler;
|
std::optional<response_callback> response_handler;
|
||||||
std::optional<http_headers> response_headers;
|
std::optional<http_headers> response_headers;
|
||||||
std::optional<std::uint64_t> total_size{};
|
std::optional<std::uint64_t> total_size{};
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_path() const -> std::string { return path; }
|
[[nodiscard]] virtual auto get_path() const -> std::string { return path; }
|
||||||
|
|
||||||
[[nodiscard]] virtual auto set_method(CURL *curl,
|
[[nodiscard]] virtual auto
|
||||||
stop_type &stop_requested) const
|
set_method(CURL *curl, stop_type &stop_requested) const -> bool = 0;
|
||||||
-> bool = 0;
|
|
||||||
};
|
};
|
||||||
} // namespace repertory::curl::requests
|
} // namespace repertory::curl::requests
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_
|
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_I_HTTP_COMM_HPP_
|
#ifndef INCLUDE_COMM_I_HTTP_COMM_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_I_HTTP_COMM_HPP_
|
#define INCLUDE_COMM_I_HTTP_COMM_HPP_
|
||||||
|
|
||||||
#include "comm/curl/requests/http_delete.hpp"
|
#include "comm/curl/requests/http_delete.hpp"
|
||||||
#include "comm/curl/requests/http_get.hpp"
|
#include "comm/curl/requests/http_get.hpp"
|
||||||
@ -40,23 +40,26 @@ public:
|
|||||||
make_request(const curl::requests::http_delete &del, long &response_code,
|
make_request(const curl::requests::http_delete &del, long &response_code,
|
||||||
stop_type &stop_requested) const -> bool = 0;
|
stop_type &stop_requested) const -> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto make_request(const curl::requests::http_get &get,
|
||||||
make_request(const curl::requests::http_get &get, long &response_code,
|
long &response_code,
|
||||||
stop_type &stop_requested) const -> bool = 0;
|
stop_type &stop_requested) const
|
||||||
|
-> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto make_request(const curl::requests::http_head &head,
|
||||||
make_request(const curl::requests::http_head &head, long &response_code,
|
long &response_code,
|
||||||
stop_type &stop_requested) const -> bool = 0;
|
stop_type &stop_requested) const
|
||||||
|
-> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto make_request(const curl::requests::http_post &post,
|
||||||
make_request(const curl::requests::http_post &post, long &response_code,
|
long &response_code,
|
||||||
stop_type &stop_requested) const -> bool = 0;
|
stop_type &stop_requested) const
|
||||||
|
-> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
make_request(const curl::requests::http_put_file &put_file,
|
make_request(const curl::requests::http_put_file &put_file,
|
||||||
long &response_code,
|
long &response_code, stop_type &stop_requested) const
|
||||||
stop_type &stop_requested) const -> bool = 0;
|
-> bool = 0;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_I_HTTP_COMM_HPP_
|
#endif // INCLUDE_COMM_I_HTTP_COMM_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_
|
#ifndef INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_
|
#define INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_
|
||||||
|
|
||||||
#include "comm/packet/packet.hpp"
|
#include "comm/packet/packet.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -107,4 +107,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_
|
#endif // INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_PACKET_PACKET_HPP_
|
#ifndef INCLUDE_COMM_PACKET_PACKET_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_PACKET_PACKET_HPP_
|
#define INCLUDE_COMM_PACKET_PACKET_HPP_
|
||||||
|
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -52,23 +52,23 @@ public:
|
|||||||
~packet() = default;
|
~packet() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
data_buffer buffer_{};
|
data_buffer buffer_;
|
||||||
std::size_t decode_offset_{0U};
|
std::size_t decode_offset_ = 0U;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] static auto decode_json(packet &response, json &json_data)
|
[[nodiscard]] static auto decode_json(packet &response,
|
||||||
-> int;
|
json &json_data) -> int;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
[[nodiscard]] auto current_pointer() -> unsigned char * {
|
[[nodiscard]] auto current_pointer() -> unsigned char * {
|
||||||
return (decode_offset_ < buffer_.size()) ? &buffer_.at(decode_offset_)
|
return (decode_offset_ < buffer_.size()) ? &buffer_[decode_offset_]
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto current_pointer() const -> const unsigned char * {
|
[[nodiscard]] auto current_pointer() const -> const unsigned char * {
|
||||||
return (decode_offset_ < buffer_.size()) ? &buffer_.at(decode_offset_)
|
return (decode_offset_ < buffer_.size()) ? &buffer_[decode_offset_]
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ public:
|
|||||||
return static_cast<std::uint32_t>(buffer_.size());
|
return static_cast<std::uint32_t>(buffer_.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void to_buffer(data_buffer &buffer);
|
void transfer_into(data_buffer &buffer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
auto operator=(const data_buffer &buffer) noexcept -> packet &;
|
auto operator=(const data_buffer &buffer) noexcept -> packet &;
|
||||||
@ -226,6 +226,8 @@ public:
|
|||||||
return buffer_.at(index);
|
return buffer_.at(index);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using packet = packet;
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_PACKET_PACKET_HPP_
|
#endif // INCLUDE_COMM_PACKET_PACKET_HPP_
|
||||||
|
@ -19,11 +19,10 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_
|
#ifndef INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_
|
#define INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_
|
||||||
|
|
||||||
#include "comm/packet/packet.hpp"
|
#include "comm/packet/packet.hpp"
|
||||||
#include "types/remote.hpp"
|
|
||||||
|
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
@ -37,7 +36,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
packet_client(remote::remote_config cfg);
|
packet_client(std::string host_name_or_ip, std::uint8_t max_connections,
|
||||||
|
std::uint16_t port, std::uint16_t receive_timeout,
|
||||||
|
std::uint16_t send_timeout, std::string encryption_token);
|
||||||
|
|
||||||
~packet_client();
|
~packet_client();
|
||||||
|
|
||||||
@ -48,7 +49,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
boost::asio::io_context io_context_;
|
boost::asio::io_context io_context_;
|
||||||
remote::remote_config cfg_;
|
std::string host_name_or_ip_;
|
||||||
|
std::uint8_t max_connections_;
|
||||||
|
std::uint16_t port_;
|
||||||
|
std::uint16_t receive_timeout_;
|
||||||
|
std::uint16_t send_timeout_;
|
||||||
|
std::string encryption_token_;
|
||||||
std::string unique_id_;
|
std::string unique_id_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -69,22 +75,22 @@ private:
|
|||||||
|
|
||||||
void put_client(std::shared_ptr<client> &cli);
|
void put_client(std::shared_ptr<client> &cli);
|
||||||
|
|
||||||
[[nodiscard]] auto read_packet(client &cli, packet &response)
|
[[nodiscard]] auto read_packet(client &cli,
|
||||||
-> packet::error_type;
|
packet &response) -> packet::error_type;
|
||||||
|
|
||||||
void resolve();
|
void resolve();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] auto send(std::string_view method, std::uint32_t &service_flags)
|
[[nodiscard]] auto send(std::string_view method,
|
||||||
-> packet::error_type;
|
std::uint32_t &service_flags) -> packet::error_type;
|
||||||
|
|
||||||
[[nodiscard]] auto send(std::string_view method, packet &request,
|
[[nodiscard]] auto send(std::string_view method, packet &request,
|
||||||
std::uint32_t &service_flags) -> packet::error_type;
|
std::uint32_t &service_flags) -> packet::error_type;
|
||||||
|
|
||||||
[[nodiscard]] auto send(std::string_view method, packet &request,
|
[[nodiscard]] auto send(std::string_view method, packet &request,
|
||||||
packet &response, std::uint32_t &service_flags)
|
packet &response,
|
||||||
-> packet::error_type;
|
std::uint32_t &service_flags) -> packet::error_type;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_
|
#endif // INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
|
#ifndef INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
|
#define INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
|
||||||
|
|
||||||
#include "comm/packet/client_pool.hpp"
|
#include "comm/packet/client_pool.hpp"
|
||||||
#include "utils/common.hpp"
|
#include "utils/common.hpp"
|
||||||
@ -52,8 +52,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct connection {
|
struct connection {
|
||||||
connection(io_context &ctx, tcp::acceptor &acceptor_)
|
connection(boost::asio::io_service &io_service, tcp::acceptor &acceptor_)
|
||||||
: socket(ctx), acceptor(acceptor_) {}
|
: socket(io_service), acceptor(acceptor_) {}
|
||||||
|
|
||||||
tcp::socket socket;
|
tcp::socket socket;
|
||||||
tcp::acceptor &acceptor;
|
tcp::acceptor &acceptor;
|
||||||
@ -68,7 +68,7 @@ private:
|
|||||||
std::string encryption_token_;
|
std::string encryption_token_;
|
||||||
closed_callback closed_;
|
closed_callback closed_;
|
||||||
message_handler_callback message_handler_;
|
message_handler_callback message_handler_;
|
||||||
io_context io_context_;
|
boost::asio::io_context io_context_;
|
||||||
std::unique_ptr<std::thread> server_thread_;
|
std::unique_ptr<std::thread> server_thread_;
|
||||||
std::vector<std::thread> service_threads_;
|
std::vector<std::thread> service_threads_;
|
||||||
std::recursive_mutex connection_mutex_;
|
std::recursive_mutex connection_mutex_;
|
||||||
@ -95,4 +95,4 @@ private:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
|
#endif // INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_COMMON_HPP_
|
#ifndef INCLUDE_COMMON_HPP_
|
||||||
#define REPERTORY_INCLUDE_COMMON_HPP_
|
#define INCLUDE_COMMON_HPP_
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -221,25 +221,44 @@ using WCHAR = wchar_t;
|
|||||||
|
|
||||||
#define MAX_PATH 260
|
#define MAX_PATH 260
|
||||||
|
|
||||||
#define STATUS_SUCCESS std::uint32_t{0U}
|
#define STATUS_SUCCESS \
|
||||||
#define STATUS_ACCESS_DENIED std::uint32_t{0xC0000022L}
|
std::uint32_t { 0U }
|
||||||
#define STATUS_DEVICE_BUSY std::uint32_t{0x80000011L}
|
#define STATUS_ACCESS_DENIED \
|
||||||
#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::uint32_t{0xC0000468L}
|
std::uint32_t { 0xC0000022L }
|
||||||
#define STATUS_DIRECTORY_NOT_EMPTY std::uint32_t{0xC0000101L}
|
#define STATUS_DEVICE_BUSY \
|
||||||
#define STATUS_FILE_IS_A_DIRECTORY std::uint32_t{0xC00000BAL}
|
std::uint32_t { 0x80000011L }
|
||||||
#define STATUS_FILE_TOO_LARGE std::uint32_t{0xC0000904L}
|
#define STATUS_DEVICE_INSUFFICIENT_RESOURCES \
|
||||||
#define STATUS_INSUFFICIENT_RESOURCES std::uint32_t{0xC000009AL}
|
std::uint32_t { 0xC0000468L }
|
||||||
#define STATUS_INTERNAL_ERROR std::uint32_t{0xC00000E5L}
|
#define STATUS_DIRECTORY_NOT_EMPTY \
|
||||||
#define STATUS_INVALID_ADDRESS std::uint32_t{0xC0000141L}
|
std::uint32_t { 0xC0000101L }
|
||||||
#define STATUS_INVALID_HANDLE std::uint32_t{0xC0000006L}
|
#define STATUS_FILE_IS_A_DIRECTORY \
|
||||||
#define STATUS_INVALID_IMAGE_FORMAT std::uint32_t{0xC000007BL}
|
std::uint32_t { 0xC00000BAL }
|
||||||
#define STATUS_INVALID_PARAMETER std::uint32_t{0xC000000DL}
|
#define STATUS_FILE_TOO_LARGE \
|
||||||
#define STATUS_NO_MEMORY std::uint32_t{0xC0000017L}
|
std::uint32_t { 0xC0000904L }
|
||||||
#define STATUS_NOT_IMPLEMENTED std::uint32_t{0xC0000002L}
|
#define STATUS_INSUFFICIENT_RESOURCES \
|
||||||
#define STATUS_OBJECT_NAME_EXISTS std::uint32_t{0x40000000L}
|
std::uint32_t { 0xC000009AL }
|
||||||
#define STATUS_OBJECT_NAME_NOT_FOUND std::uint32_t{0xC0000034L}
|
#define STATUS_INTERNAL_ERROR \
|
||||||
#define STATUS_OBJECT_PATH_INVALID std::uint32_t{0xC0000039L}
|
std::uint32_t { 0xC00000E5L }
|
||||||
#define STATUS_UNEXPECTED_IO_ERROR std::uint32_t{0xC00000E9L}
|
#define STATUS_INVALID_ADDRESS \
|
||||||
|
std::uint32_t { 0xC0000141L }
|
||||||
|
#define STATUS_INVALID_HANDLE \
|
||||||
|
std::uint32_t { 0xC0000006L }
|
||||||
|
#define STATUS_INVALID_IMAGE_FORMAT \
|
||||||
|
std::uint32_t { 0xC000007BL }
|
||||||
|
#define STATUS_INVALID_PARAMETER \
|
||||||
|
std::uint32_t { 0xC000000DL }
|
||||||
|
#define STATUS_NO_MEMORY \
|
||||||
|
std::uint32_t { 0xC0000017L }
|
||||||
|
#define STATUS_NOT_IMPLEMENTED \
|
||||||
|
std::uint32_t { 0xC0000002L }
|
||||||
|
#define STATUS_OBJECT_NAME_EXISTS \
|
||||||
|
std::uint32_t { 0x40000000L }
|
||||||
|
#define STATUS_OBJECT_NAME_NOT_FOUND \
|
||||||
|
std::uint32_t { 0xC0000034L }
|
||||||
|
#define STATUS_OBJECT_PATH_INVALID \
|
||||||
|
std::uint32_t { 0xC0000039L }
|
||||||
|
#define STATUS_UNEXPECTED_IO_ERROR \
|
||||||
|
std::uint32_t { 0xC00000E9L }
|
||||||
|
|
||||||
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) \
|
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) \
|
||||||
((std::uint32_t(e) == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e)
|
((std::uint32_t(e) == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e)
|
||||||
@ -277,8 +296,8 @@ using namespace Fsp;
|
|||||||
#define INTERFACE_SETUP(name) \
|
#define INTERFACE_SETUP(name) \
|
||||||
public: \
|
public: \
|
||||||
name(const name &) noexcept = delete; \
|
name(const name &) noexcept = delete; \
|
||||||
auto operator=(const name &) noexcept -> name & = delete; \
|
name &operator=(const name &) noexcept = delete; \
|
||||||
auto operator=(name &&) noexcept -> name & = delete; \
|
name &operator=(name &&) noexcept = delete; \
|
||||||
\
|
\
|
||||||
protected: \
|
protected: \
|
||||||
name() = default; \
|
name() = default; \
|
||||||
@ -288,4 +307,4 @@ public: \
|
|||||||
virtual ~name() = default
|
virtual ~name() = default
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
#endif // REPERTORY_INCLUDE_COMMON_HPP_
|
#endif // INCLUDE_COMMON_HPP_
|
||||||
|
247
repertory/librepertory/include/database/db_common.hpp
Normal file
247
repertory/librepertory/include/database/db_common.hpp
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
/*
|
||||||
|
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
*/
|
||||||
|
#ifndef INCLUDE_DATABASE_DB_COMMON_HPP_
|
||||||
|
#define INCLUDE_DATABASE_DB_COMMON_HPP_
|
||||||
|
|
||||||
|
#include "utils/error_utils.hpp"
|
||||||
|
|
||||||
|
namespace repertory::db {
|
||||||
|
using db_types_t = std::variant<std::int64_t, std::string>;
|
||||||
|
|
||||||
|
struct sqlite3_deleter {
|
||||||
|
void operator()(sqlite3 *db3) {
|
||||||
|
if (db3 != nullptr) {
|
||||||
|
sqlite3_close_v2(db3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
using db3_t = std::unique_ptr<sqlite3, sqlite3_deleter>;
|
||||||
|
|
||||||
|
struct sqlite3_statement_deleter {
|
||||||
|
void operator()(sqlite3_stmt *stmt) {
|
||||||
|
if (stmt != nullptr) {
|
||||||
|
sqlite3_finalize(stmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
using db3_stmt_t = std::unique_ptr<sqlite3_stmt, sqlite3_statement_deleter>;
|
||||||
|
|
||||||
|
struct comp_data_t final {
|
||||||
|
std::string column_name;
|
||||||
|
std::string op_type;
|
||||||
|
db_types_t value;
|
||||||
|
};
|
||||||
|
|
||||||
|
class db_column final {
|
||||||
|
public:
|
||||||
|
db_column() noexcept = default;
|
||||||
|
db_column(const db_column &) = default;
|
||||||
|
db_column(db_column &&column) noexcept = default;
|
||||||
|
~db_column() = default;
|
||||||
|
|
||||||
|
auto operator=(const db_column &) -> db_column & = default;
|
||||||
|
auto operator=(db_column &&) -> db_column & = default;
|
||||||
|
|
||||||
|
db_column(std::int32_t index, std::string name, db_types_t value) noexcept
|
||||||
|
: index_(index), name_(std::move(name)), value_(std::move(value)) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::int32_t index_{};
|
||||||
|
std::string name_;
|
||||||
|
db_types_t value_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
[[nodiscard]] auto get_index() const -> std::int32_t { return index_; }
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_name() const -> std::string { return name_; }
|
||||||
|
|
||||||
|
template <typename data_type>
|
||||||
|
[[nodiscard]] auto get_value() const -> data_type {
|
||||||
|
return std::visit(
|
||||||
|
overloaded{
|
||||||
|
[](const data_type &value) -> data_type { return value; },
|
||||||
|
[](auto &&) -> data_type {
|
||||||
|
throw std::runtime_error("data type not supported");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
value_);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_value_as_json() const -> nlohmann::json {
|
||||||
|
return std::visit(
|
||||||
|
overloaded{
|
||||||
|
[this](std::int64_t value) -> auto {
|
||||||
|
return nlohmann::json({{name_, value}});
|
||||||
|
},
|
||||||
|
[](auto &&value) -> auto { return nlohmann::json::parse(value); },
|
||||||
|
},
|
||||||
|
value_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename context_t> class db_row final {
|
||||||
|
public:
|
||||||
|
db_row(std::shared_ptr<context_t> context) {
|
||||||
|
auto column_count = sqlite3_column_count(context->stmt.get());
|
||||||
|
for (std::int32_t col = 0; col < column_count; col++) {
|
||||||
|
std::string name{sqlite3_column_name(context->stmt.get(), col)};
|
||||||
|
auto column_type = sqlite3_column_type(context->stmt.get(), col);
|
||||||
|
|
||||||
|
db_types_t value;
|
||||||
|
switch (column_type) {
|
||||||
|
case SQLITE_INTEGER: {
|
||||||
|
value = sqlite3_column_int64(context->stmt.get(), col);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case SQLITE_TEXT: {
|
||||||
|
const auto *text = reinterpret_cast<const char *>(
|
||||||
|
sqlite3_column_text(context->stmt.get(), col));
|
||||||
|
value = std::string(text == nullptr ? "" : text);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw std::runtime_error("column type not implemented|" + name + '|' +
|
||||||
|
std::to_string(column_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
columns_[name] = db_column{col, name, value};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map<std::string, db_column> columns_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
[[nodiscard]] auto get_columns() const -> std::vector<db_column> {
|
||||||
|
std::vector<db_column> ret;
|
||||||
|
for (const auto &item : columns_) {
|
||||||
|
ret.push_back(item.second);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_column(std::int32_t index) const -> db_column {
|
||||||
|
auto iter = std::find_if(columns_.begin(), columns_.end(),
|
||||||
|
[&index](auto &&col) -> bool {
|
||||||
|
return col.second.get_index() == index;
|
||||||
|
});
|
||||||
|
if (iter == columns_.end()) {
|
||||||
|
throw std::out_of_range("");
|
||||||
|
}
|
||||||
|
|
||||||
|
return iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_column(std::string name) const -> db_column {
|
||||||
|
return columns_.at(name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename context_t> struct db_result final {
|
||||||
|
db_result(std::shared_ptr<context_t> context, std::int32_t res)
|
||||||
|
: context_(std::move(context)), res_(res) {
|
||||||
|
constexpr const auto *function_name =
|
||||||
|
static_cast<const char *>(__FUNCTION__);
|
||||||
|
|
||||||
|
if (res == SQLITE_OK) {
|
||||||
|
set_res(sqlite3_step(context_->stmt.get()), function_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<context_t> context_;
|
||||||
|
mutable std::int32_t res_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void set_res(std::int32_t res, std::string_view function) const {
|
||||||
|
if (res != SQLITE_OK && res != SQLITE_DONE && res != SQLITE_ROW) {
|
||||||
|
utils::error::raise_error(function, "failed to step|" +
|
||||||
|
std::to_string(res) + '|' +
|
||||||
|
sqlite3_errstr(res));
|
||||||
|
}
|
||||||
|
res_ = res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
[[nodiscard]] auto ok() const -> bool {
|
||||||
|
return res_ == SQLITE_DONE || res_ == SQLITE_ROW;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_error() const -> std::int32_t { return res_; }
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_error_str() const -> std::string {
|
||||||
|
return sqlite3_errstr(res_);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_row(std::optional<db_row<context_t>> &row) const -> bool {
|
||||||
|
constexpr const auto *function_name =
|
||||||
|
static_cast<const char *>(__FUNCTION__);
|
||||||
|
|
||||||
|
row.reset();
|
||||||
|
if (has_row()) {
|
||||||
|
row = db_row{context_};
|
||||||
|
set_res(sqlite3_step(context_->stmt.get()), function_name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto has_row() const -> bool { return res_ == SQLITE_ROW; }
|
||||||
|
|
||||||
|
void next_row() const {
|
||||||
|
constexpr const auto *function_name =
|
||||||
|
static_cast<const char *>(__FUNCTION__);
|
||||||
|
|
||||||
|
if (has_row()) {
|
||||||
|
set_res(sqlite3_step(context_->stmt.get()), function_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void set_journal_mode(sqlite3 &db3) {
|
||||||
|
sqlite3_exec(&db3, "PRAGMA journal_mode = WAL;PRAGMA synchronous = NORMAL;",
|
||||||
|
nullptr, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] inline auto execute_sql(sqlite3 &db3, const std::string &sql,
|
||||||
|
std::string &err) -> bool {
|
||||||
|
char *err_msg{nullptr};
|
||||||
|
auto res = sqlite3_exec(&db3, sql.c_str(), nullptr, nullptr, &err_msg);
|
||||||
|
if (err_msg != nullptr) {
|
||||||
|
err = err_msg;
|
||||||
|
sqlite3_free(err_msg);
|
||||||
|
err_msg = nullptr;
|
||||||
|
}
|
||||||
|
if (res != SQLITE_OK) {
|
||||||
|
err = "failed to execute sql|" + sql + "|" + std::to_string(res) + '|' +
|
||||||
|
(err.empty() ? sqlite3_errstr(res) : err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} // namespace repertory::db
|
||||||
|
|
||||||
|
#endif // INCLUDE_DATABASE_DB_COMMON_HPP_
|
@ -19,46 +19,51 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_UTILS_DB_SQLITE_DB_INSERT_HPP_
|
#ifndef INCLUDE_DATABASE_DB_INSERT_HPP_
|
||||||
#define REPERTORY_INCLUDE_UTILS_DB_SQLITE_DB_INSERT_HPP_
|
#define INCLUDE_DATABASE_DB_INSERT_HPP_
|
||||||
#if defined(PROJECT_ENABLE_SQLITE)
|
|
||||||
|
|
||||||
#include "utils/db/sqlite/db_common.hpp"
|
#include "database/db_common.hpp"
|
||||||
|
#include "utils/error_utils.hpp"
|
||||||
|
|
||||||
namespace repertory::utils::db::sqlite {
|
namespace repertory::db {
|
||||||
class db_insert final {
|
class db_insert final {
|
||||||
public:
|
public:
|
||||||
struct context final : db_context_t {
|
struct context final {
|
||||||
context(sqlite3 *db3_, std::string table_name_)
|
context(sqlite3 &db3_, std::string table_name_)
|
||||||
: db_context_t(db3_, table_name_) {}
|
: db3(db3_), table_name(std::move(table_name_)) {}
|
||||||
|
|
||||||
|
sqlite3 &db3;
|
||||||
|
std::string table_name;
|
||||||
|
|
||||||
bool or_replace{false};
|
bool or_replace{false};
|
||||||
std::map<std::string, db_types_t> values;
|
std::map<std::string, db_types_t> values{};
|
||||||
|
db3_stmt_t stmt{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using row = db_row<context>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
db_insert(sqlite3 &db3, std::string table_name)
|
db_insert(sqlite3 &db3, std::string table_name)
|
||||||
: ctx_(std::make_shared<context>(&db3, table_name)) {}
|
: context_(std::make_shared<context>(db3, table_name)) {}
|
||||||
|
|
||||||
db_insert(std::shared_ptr<context> ctx) : ctx_(std::move(ctx)) {}
|
db_insert(std::shared_ptr<context> ctx) : context_(std::move(ctx)) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<context> ctx_;
|
std::shared_ptr<context> context_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] auto or_replace() -> db_insert {
|
[[nodiscard]] auto or_replace() -> db_insert & {
|
||||||
ctx_->or_replace = true;
|
context_->or_replace = true;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto column_value(std::string column_name, db_types_t value)
|
[[nodiscard]] auto column_value(std::string column_name, db_types_t value)
|
||||||
-> db_insert;
|
-> db_insert &;
|
||||||
|
|
||||||
[[nodiscard]] auto dump() const -> std::string;
|
[[nodiscard]] auto dump() const -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] auto go() const -> db_result;
|
[[nodiscard]] auto go() const -> db_result<context>;
|
||||||
};
|
};
|
||||||
} // namespace repertory::utils::db::sqlite
|
} // namespace repertory::db
|
||||||
|
|
||||||
#endif // defined(PROJECT_ENABLE_SQLITE)
|
#endif // INCLUDE_DATABASE_DB_INSERT_HPP_
|
||||||
#endif // REPERTORY_INCLUDE_UTILS_DB_SQLITE_DB_INSERT_HPP_
|
|
125
repertory/librepertory/include/database/db_select.hpp
Normal file
125
repertory/librepertory/include/database/db_select.hpp
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
*/
|
||||||
|
#ifndef INCLUDE_DATABASE_DB_SELECT_HPP_
|
||||||
|
#define INCLUDE_DATABASE_DB_SELECT_HPP_
|
||||||
|
|
||||||
|
#include "database/db_common.hpp"
|
||||||
|
#include "utils/error_utils.hpp"
|
||||||
|
|
||||||
|
namespace repertory::db {
|
||||||
|
class db_select final {
|
||||||
|
public:
|
||||||
|
struct context final {
|
||||||
|
context(sqlite3 &db3_, std::string table_name_)
|
||||||
|
: db3(db3_), table_name(std::move(table_name_)) {}
|
||||||
|
|
||||||
|
sqlite3 &db3;
|
||||||
|
std::string table_name;
|
||||||
|
|
||||||
|
std::vector<comp_data_t> ands{};
|
||||||
|
std::vector<std::string> columns{};
|
||||||
|
std::map<std::string, std::string> count_columns{};
|
||||||
|
bool delete_query{false};
|
||||||
|
std::optional<std::int32_t> limit;
|
||||||
|
std::optional<std::pair<std::string, bool>> order_by;
|
||||||
|
db3_stmt_t stmt{nullptr};
|
||||||
|
};
|
||||||
|
|
||||||
|
using row = db_row<context>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
db_select(sqlite3 &db3, std::string table_name)
|
||||||
|
: context_(std::make_shared<context>(db3, table_name)) {}
|
||||||
|
|
||||||
|
db_select(std::shared_ptr<context> ctx) : context_(std::move(ctx)) {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
struct db_where final {
|
||||||
|
db_where(std::shared_ptr<context> ctx, std::string column_name)
|
||||||
|
: context_(std::move(ctx)), column_name_(std::move(column_name)) {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
struct db_where_next final {
|
||||||
|
db_where_next(std::shared_ptr<context> ctx) : context_(std::move(ctx)) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<context> context_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
[[nodiscard]] auto and_where(std::string column_name) const -> db_where {
|
||||||
|
return db_where{context_, column_name};
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto dump() const -> std::string {
|
||||||
|
return db_select{context_}.dump();
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto go() const -> db_result<context> {
|
||||||
|
return db_select{context_}.go();
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto limit(std::int32_t value) const -> db_select {
|
||||||
|
return db_select{context_}.limit(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto order_by(std::string column_name, bool ascending) const
|
||||||
|
-> db_select {
|
||||||
|
return db_select{context_}.order_by(column_name, ascending);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<context> context_;
|
||||||
|
std::string column_name_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
[[nodiscard]] auto equals(db_types_t value) const -> db_where_next {
|
||||||
|
context_->ands.emplace_back(comp_data_t{column_name_, "=", value});
|
||||||
|
return db_where_next{context_};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<context> context_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
[[nodiscard]] auto column(std::string column_name) -> db_select &;
|
||||||
|
|
||||||
|
[[nodiscard]] auto count(std::string column_name, std::string as_column_name)
|
||||||
|
-> db_select &;
|
||||||
|
|
||||||
|
[[nodiscard]] auto delete_query() -> db_select &;
|
||||||
|
|
||||||
|
[[nodiscard]] auto dump() const -> std::string;
|
||||||
|
|
||||||
|
[[nodiscard]] auto go() const -> db_result<context>;
|
||||||
|
|
||||||
|
[[nodiscard]] auto limit(std::int32_t value) -> db_select &;
|
||||||
|
|
||||||
|
[[nodiscard]] auto order_by(std::string column_name, bool ascending)
|
||||||
|
-> db_select &;
|
||||||
|
|
||||||
|
[[nodiscard]] auto where(std::string column_name) const -> db_where;
|
||||||
|
};
|
||||||
|
} // namespace repertory::db
|
||||||
|
|
||||||
|
#endif // INCLUDE_DATABASE_DB_SELECT_HPP_
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_FILE_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_FILE_DB_HPP_
|
|
||||||
|
|
||||||
#include "db/i_file_db.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
[[nodiscard]] auto create_file_db(const app_config &cfg)
|
|
||||||
-> std::unique_ptr<i_file_db>;
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_FILE_DB_HPP_
|
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_FILE_MGR_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_FILE_MGR_DB_HPP_
|
|
||||||
|
|
||||||
#include "db/i_file_mgr_db.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
create_file_mgr_db(const app_config &cfg) -> std::unique_ptr<i_file_mgr_db>;
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_FILE_MGR_DB_HPP_
|
|
@ -1,95 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_I_FILE_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_I_FILE_DB_HPP_
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_file_db {
|
|
||||||
INTERFACE_SETUP(i_file_db);
|
|
||||||
|
|
||||||
public:
|
|
||||||
struct file_info final {
|
|
||||||
std::string api_path;
|
|
||||||
bool directory;
|
|
||||||
std::string source_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct file_data final {
|
|
||||||
std::string api_path;
|
|
||||||
std::uint64_t file_size{};
|
|
||||||
std::vector<
|
|
||||||
std::array<unsigned char, crypto_aead_xchacha20poly1305_IETF_NPUBBYTES>>
|
|
||||||
iv_list{};
|
|
||||||
std::string source_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] virtual auto add_directory(const std::string &api_path,
|
|
||||||
const std::string &source_path)
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto add_or_update_file(const file_data &data)
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
virtual void clear() = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto count() const -> std::uint64_t = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
|
||||||
get_directory_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const -> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
|
||||||
get_directory_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const -> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_file_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_file_data(const std::string &api_path,
|
|
||||||
file_data &data) const
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
|
||||||
get_file_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const -> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_item_list() const
|
|
||||||
-> std::vector<file_info> = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto remove_item(const std::string &api_path)
|
|
||||||
-> api_error = 0;
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_I_FILE_DB_HPP_
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_I_FILE_MGR_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_I_FILE_MGR_DB_HPP_
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_file_mgr_db {
|
|
||||||
INTERFACE_SETUP(i_file_mgr_db);
|
|
||||||
|
|
||||||
public:
|
|
||||||
struct resume_entry final {
|
|
||||||
std::string api_path;
|
|
||||||
std::uint64_t chunk_size{};
|
|
||||||
boost::dynamic_bitset<> read_state;
|
|
||||||
std::string source_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct upload_active_entry final {
|
|
||||||
std::string api_path;
|
|
||||||
std::string source_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct upload_entry final {
|
|
||||||
std::string api_path;
|
|
||||||
std::string source_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] virtual auto add_resume(const resume_entry &entry) -> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto add_upload(const upload_entry &entry) -> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto add_upload_active(const upload_active_entry &entry)
|
|
||||||
-> bool = 0;
|
|
||||||
|
|
||||||
virtual void clear() = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_next_upload() const
|
|
||||||
-> std::optional<upload_entry> = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_resume_list() const
|
|
||||||
-> std::vector<resume_entry> = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_upload(const std::string &api_path) const
|
|
||||||
-> std::optional<upload_entry> = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_upload_active_list() const
|
|
||||||
-> std::vector<upload_active_entry> = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto remove_resume(const std::string &api_path)
|
|
||||||
-> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto remove_upload(const std::string &api_path)
|
|
||||||
-> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto remove_upload_active(const std::string &api_path)
|
|
||||||
-> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto rename_resume(const std::string &from_api_path,
|
|
||||||
const std::string &to_api_path)
|
|
||||||
-> bool = 0;
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_I_FILE_MGR_DB_HPP_
|
|
@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_I_META_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_I_META_DB_HPP_
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_meta_db {
|
|
||||||
INTERFACE_SETUP(i_meta_db);
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void clear() = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_api_path_list() const
|
|
||||||
-> std::vector<std::string> = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
|
|
||||||
api_meta_map &meta) const
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
|
|
||||||
const std::string &key,
|
|
||||||
std::string &value) const
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_pinned_files() const
|
|
||||||
-> std::vector<std::string> = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_total_item_count() const -> std::uint64_t = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_total_size() const -> std::uint64_t = 0;
|
|
||||||
|
|
||||||
virtual void remove_api_path(const std::string &api_path) = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto remove_item_meta(const std::string &api_path,
|
|
||||||
const std::string &key)
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto rename_item_meta(const std::string &from_api_path,
|
|
||||||
const std::string &to_api_path)
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto set_item_meta(const std::string &api_path,
|
|
||||||
const std::string &key,
|
|
||||||
const std::string &value)
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto set_item_meta(const std::string &api_path,
|
|
||||||
const api_meta_map &meta)
|
|
||||||
-> api_error = 0;
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_I_META_DB_HPP_
|
|
@ -1,117 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_DB_HPP_
|
|
||||||
|
|
||||||
#include "db/i_file_db.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
class rdb_file_db final : public i_file_db {
|
|
||||||
public:
|
|
||||||
rdb_file_db(const app_config &cfg);
|
|
||||||
~rdb_file_db() override;
|
|
||||||
|
|
||||||
rdb_file_db(const rdb_file_db &) = delete;
|
|
||||||
rdb_file_db(rdb_file_db &&) = delete;
|
|
||||||
auto operator=(const rdb_file_db &) -> rdb_file_db & = delete;
|
|
||||||
auto operator=(rdb_file_db &&) -> rdb_file_db & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const app_config &cfg_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<rocksdb::TransactionDB> db_{nullptr};
|
|
||||||
rocksdb::ColumnFamilyHandle *directory_family_{};
|
|
||||||
rocksdb::ColumnFamilyHandle *file_family_{};
|
|
||||||
rocksdb::ColumnFamilyHandle *path_family_{};
|
|
||||||
rocksdb::ColumnFamilyHandle *source_family_{};
|
|
||||||
|
|
||||||
private:
|
|
||||||
void create_or_open(bool clear);
|
|
||||||
|
|
||||||
[[nodiscard]] auto create_iterator(rocksdb::ColumnFamilyHandle *family) const
|
|
||||||
-> std::shared_ptr<rocksdb::Iterator>;
|
|
||||||
|
|
||||||
[[nodiscard]] static auto
|
|
||||||
perform_action(std::string_view function_name,
|
|
||||||
std::function<rocksdb::Status()> action) -> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto perform_action(
|
|
||||||
std::string_view function_name,
|
|
||||||
std::function<rocksdb::Status(rocksdb::Transaction *txn)> action)
|
|
||||||
-> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_item(const std::string &api_path,
|
|
||||||
const std::string &source_path,
|
|
||||||
rocksdb::Transaction *txn) -> rocksdb::Status;
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] auto
|
|
||||||
add_directory(const std::string &api_path,
|
|
||||||
const std::string &source_path) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
add_or_update_file(const i_file_db::file_data &data) -> api_error override;
|
|
||||||
|
|
||||||
void clear() override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto count() const -> std::uint64_t override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_directory_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_file_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_file_data(const std::string &api_path,
|
|
||||||
i_file_db::file_data &data) const -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_file_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_item_list() const -> std::vector<i_file_db::file_info> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
remove_item(const std::string &api_path) -> api_error override;
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_DB_HPP_
|
|
@ -1,109 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_
|
|
||||||
|
|
||||||
#include "db/i_file_mgr_db.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
class rdb_file_mgr_db final : public i_file_mgr_db {
|
|
||||||
public:
|
|
||||||
rdb_file_mgr_db(const app_config &cfg);
|
|
||||||
~rdb_file_mgr_db() override;
|
|
||||||
|
|
||||||
rdb_file_mgr_db(const rdb_file_mgr_db &) = delete;
|
|
||||||
rdb_file_mgr_db(rdb_file_mgr_db &&) = delete;
|
|
||||||
auto operator=(const rdb_file_mgr_db &) -> rdb_file_mgr_db & = delete;
|
|
||||||
auto operator=(rdb_file_mgr_db &&) -> rdb_file_mgr_db & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const app_config &cfg_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<rocksdb::TransactionDB> db_{nullptr};
|
|
||||||
std::atomic<std::uint64_t> id_{0U};
|
|
||||||
rocksdb::ColumnFamilyHandle *resume_family_{};
|
|
||||||
rocksdb::ColumnFamilyHandle *upload_active_family_{};
|
|
||||||
rocksdb::ColumnFamilyHandle *upload_family_{};
|
|
||||||
|
|
||||||
private:
|
|
||||||
void create_or_open(bool clear);
|
|
||||||
|
|
||||||
[[nodiscard]] auto create_iterator(rocksdb::ColumnFamilyHandle *family) const
|
|
||||||
-> std::shared_ptr<rocksdb::Iterator>;
|
|
||||||
|
|
||||||
[[nodiscard]] static auto
|
|
||||||
perform_action(std::string_view function_name,
|
|
||||||
std::function<rocksdb::Status()> action) -> bool;
|
|
||||||
|
|
||||||
[[nodiscard]] auto perform_action(
|
|
||||||
std::string_view function_name,
|
|
||||||
std::function<rocksdb::Status(rocksdb::Transaction *txn)> action) -> bool;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_resume(const std::string &api_path,
|
|
||||||
rocksdb::Transaction *txn)
|
|
||||||
-> rocksdb::Status;
|
|
||||||
|
|
||||||
[[nodiscard]] auto add_resume(const resume_entry &entry,
|
|
||||||
rocksdb::Transaction *txn) -> rocksdb::Status;
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] auto add_resume(const resume_entry &entry) -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto add_upload(const upload_entry &entry) -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto add_upload_active(const upload_active_entry &entry)
|
|
||||||
-> bool override;
|
|
||||||
|
|
||||||
void clear() override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_next_upload() const
|
|
||||||
-> std::optional<upload_entry> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_resume_list() const
|
|
||||||
-> std::vector<resume_entry> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_upload(const std::string &api_path) const
|
|
||||||
-> std::optional<upload_entry> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_upload_active_list() const
|
|
||||||
-> std::vector<upload_active_entry> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_resume(const std::string &api_path)
|
|
||||||
-> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_upload(const std::string &api_path)
|
|
||||||
-> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_upload_active(const std::string &api_path)
|
|
||||||
-> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto rename_resume(const std::string &from_api_path,
|
|
||||||
const std::string &to_api_path)
|
|
||||||
-> bool override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_
|
|
@ -1,127 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_
|
|
||||||
|
|
||||||
#include "db/i_meta_db.hpp"
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
class rdb_meta_db final : public i_meta_db {
|
|
||||||
public:
|
|
||||||
rdb_meta_db(const app_config &cfg);
|
|
||||||
~rdb_meta_db() override;
|
|
||||||
|
|
||||||
rdb_meta_db(const rdb_meta_db &) = delete;
|
|
||||||
rdb_meta_db(rdb_meta_db &&) = delete;
|
|
||||||
auto operator=(const rdb_meta_db &) -> rdb_meta_db & = delete;
|
|
||||||
auto operator=(rdb_meta_db &&) -> rdb_meta_db & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const app_config &cfg_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<rocksdb::TransactionDB> db_{nullptr};
|
|
||||||
rocksdb::ColumnFamilyHandle *meta_family_{};
|
|
||||||
rocksdb::ColumnFamilyHandle *pinned_family_{};
|
|
||||||
rocksdb::ColumnFamilyHandle *size_family_{};
|
|
||||||
rocksdb::ColumnFamilyHandle *source_family_{};
|
|
||||||
|
|
||||||
private:
|
|
||||||
[[nodiscard]] auto create_iterator(rocksdb::ColumnFamilyHandle *family) const
|
|
||||||
-> std::shared_ptr<rocksdb::Iterator>;
|
|
||||||
|
|
||||||
void create_or_open(bool clear);
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta_json(const std::string &api_path,
|
|
||||||
json &json_data) const -> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] static auto
|
|
||||||
perform_action(std::string_view function_name,
|
|
||||||
std::function<rocksdb::Status()> action) -> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto perform_action(
|
|
||||||
std::string_view function_name,
|
|
||||||
std::function<rocksdb::Status(rocksdb::Transaction *txn)> action)
|
|
||||||
-> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_api_path(const std::string &api_path,
|
|
||||||
const std::string &source_path,
|
|
||||||
rocksdb::Transaction *txn)
|
|
||||||
-> rocksdb::Status;
|
|
||||||
|
|
||||||
[[nodiscard]] auto update_item_meta(const std::string &api_path,
|
|
||||||
json json_data,
|
|
||||||
rocksdb::Transaction *base_txn = nullptr,
|
|
||||||
rocksdb::Status *status = nullptr)
|
|
||||||
-> api_error;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void clear() override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_path_list() const
|
|
||||||
-> std::vector<std::string> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
|
||||||
api_meta_map &meta) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
|
||||||
const std::string &key,
|
|
||||||
std::string &value) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_pinned_files() const
|
|
||||||
-> std::vector<std::string> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_total_item_count() const -> std::uint64_t override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_total_size() const -> std::uint64_t override;
|
|
||||||
|
|
||||||
void remove_api_path(const std::string &api_path) override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_item_meta(const std::string &api_path,
|
|
||||||
const std::string &key)
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto rename_item_meta(const std::string &from_api_path,
|
|
||||||
const std::string &to_api_path)
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto set_item_meta(const std::string &api_path,
|
|
||||||
const std::string &key,
|
|
||||||
const std::string &value)
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto set_item_meta(const std::string &api_path,
|
|
||||||
const api_meta_map &meta)
|
|
||||||
-> api_error override;
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_
|
|
@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_DB_HPP_
|
|
||||||
|
|
||||||
#include "db/i_file_db.hpp"
|
|
||||||
#include "utils/db/sqlite/db_common.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
class sqlite_file_db final : public i_file_db {
|
|
||||||
public:
|
|
||||||
sqlite_file_db(const app_config &cfg);
|
|
||||||
~sqlite_file_db() override;
|
|
||||||
|
|
||||||
sqlite_file_db(const sqlite_file_db &) = delete;
|
|
||||||
sqlite_file_db(sqlite_file_db &&) = delete;
|
|
||||||
auto operator=(const sqlite_file_db &) -> sqlite_file_db & = delete;
|
|
||||||
auto operator=(sqlite_file_db &&) -> sqlite_file_db & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
utils::db::sqlite::db3_t db_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] auto add_directory(const std::string &api_path,
|
|
||||||
const std::string &source_path)
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto add_or_update_file(const i_file_db::file_data &data)
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
void clear() override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto count() const -> std::uint64_t override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_api_path(const std::string &source_path,
|
|
||||||
std::string &api_path) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_data(const std::string &api_path,
|
|
||||||
i_file_db::file_data &data) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_list() const
|
|
||||||
-> std::vector<i_file_db::file_info> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_source_path(const std::string &api_path,
|
|
||||||
std::string &source_path) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_item(const std::string &api_path)
|
|
||||||
-> api_error override;
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_DB_HPP_
|
|
@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_
|
|
||||||
|
|
||||||
#include "db/i_file_mgr_db.hpp"
|
|
||||||
#include "utils/db/sqlite/db_common.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
class sqlite_file_mgr_db final : public i_file_mgr_db {
|
|
||||||
public:
|
|
||||||
sqlite_file_mgr_db(const app_config &cfg);
|
|
||||||
~sqlite_file_mgr_db() override;
|
|
||||||
|
|
||||||
sqlite_file_mgr_db(const sqlite_file_mgr_db &) = delete;
|
|
||||||
sqlite_file_mgr_db(sqlite_file_mgr_db &&) = delete;
|
|
||||||
auto operator=(const sqlite_file_mgr_db &) -> sqlite_file_mgr_db & = delete;
|
|
||||||
auto operator=(sqlite_file_mgr_db &&) -> sqlite_file_mgr_db & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
utils::db::sqlite::db3_t db_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] auto add_resume(const resume_entry &entry) -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto add_upload(const upload_entry &entry) -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto add_upload_active(const upload_active_entry &entry)
|
|
||||||
-> bool override;
|
|
||||||
|
|
||||||
void clear() override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_next_upload() const
|
|
||||||
-> std::optional<upload_entry> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_resume_list() const
|
|
||||||
-> std::vector<resume_entry> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_upload(const std::string &api_path) const
|
|
||||||
-> std::optional<upload_entry> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_upload_active_list() const
|
|
||||||
-> std::vector<upload_active_entry> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_resume(const std::string &api_path)
|
|
||||||
-> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_upload(const std::string &api_path)
|
|
||||||
-> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_upload_active(const std::string &api_path)
|
|
||||||
-> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto rename_resume(const std::string &from_api_path,
|
|
||||||
const std::string &to_api_path)
|
|
||||||
-> bool override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_
|
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_DB_META_DB_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_DB_META_DB_HPP_
|
|
||||||
|
|
||||||
#include "db/i_meta_db.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
[[nodiscard]] auto create_meta_db(const app_config &cfg)
|
|
||||||
-> std::unique_ptr<i_meta_db>;
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_META_DB_HPP_
|
|
@ -19,10 +19,11 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
|
#ifndef INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
|
#define INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
|
||||||
|
|
||||||
#include "utils/single_thread_service_base.hpp"
|
#include "utils/single_thread_service_base.hpp"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
class directory_iterator;
|
class directory_iterator;
|
||||||
@ -34,7 +35,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
struct open_directory final {
|
struct open_directory final {
|
||||||
std::shared_ptr<directory_iterator> iterator;
|
std::shared_ptr<directory_iterator> iterator;
|
||||||
std::vector<std::uint64_t> handles;
|
std::vector<std::uint64_t> handles{};
|
||||||
std::chrono::system_clock::time_point last_update{
|
std::chrono::system_clock::time_point last_update{
|
||||||
std::chrono::system_clock::now()};
|
std::chrono::system_clock::now()};
|
||||||
};
|
};
|
||||||
@ -60,8 +61,8 @@ public:
|
|||||||
void execute_action(const std::string &api_path,
|
void execute_action(const std::string &api_path,
|
||||||
const execute_callback &execute);
|
const execute_callback &execute);
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory(std::uint64_t handle)
|
[[nodiscard]] auto
|
||||||
-> std::shared_ptr<directory_iterator>;
|
get_directory(std::uint64_t handle) -> std::shared_ptr<directory_iterator>;
|
||||||
|
|
||||||
[[nodiscard]] auto remove_directory(const std::string &api_path)
|
[[nodiscard]] auto remove_directory(const std::string &api_path)
|
||||||
-> std::shared_ptr<directory_iterator>;
|
-> std::shared_ptr<directory_iterator>;
|
||||||
@ -73,4 +74,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
|
#endif // INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_
|
#ifndef INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_
|
#define INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_
|
||||||
|
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -78,4 +78,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_
|
#endif // INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_EVICTION_HPP_
|
#ifndef INCLUDE_DRIVES_EVICTION_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_EVICTION_HPP_
|
#define INCLUDE_DRIVES_EVICTION_HPP_
|
||||||
|
|
||||||
#include "utils/single_thread_service_base.hpp"
|
#include "utils/single_thread_service_base.hpp"
|
||||||
|
|
||||||
@ -31,19 +31,18 @@ class i_provider;
|
|||||||
|
|
||||||
class eviction final : public single_thread_service_base {
|
class eviction final : public single_thread_service_base {
|
||||||
public:
|
public:
|
||||||
eviction(i_provider &provider, const app_config &config,
|
eviction(i_provider &provider, const app_config &config, i_file_manager &fm)
|
||||||
i_file_manager &file_mgr)
|
|
||||||
: single_thread_service_base("eviction"),
|
: single_thread_service_base("eviction"),
|
||||||
|
provider_(provider),
|
||||||
config_(config),
|
config_(config),
|
||||||
file_mgr_(file_mgr),
|
fm_(fm) {}
|
||||||
provider_(provider) {}
|
|
||||||
|
|
||||||
~eviction() override = default;
|
~eviction() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const app_config &config_;
|
|
||||||
i_file_manager &file_mgr_;
|
|
||||||
i_provider &provider_;
|
i_provider &provider_;
|
||||||
|
const app_config &config_;
|
||||||
|
i_file_manager &fm_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto check_minimum_requirements(const std::string &file_path)
|
[[nodiscard]] auto check_minimum_requirements(const std::string &file_path)
|
||||||
@ -56,4 +55,4 @@ protected:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_EVICTION_HPP_
|
#endif // INCLUDE_DRIVES_EVICTION_HPP_
|
||||||
|
@ -19,23 +19,23 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
#define INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
||||||
|
|
||||||
#include "events/event_system.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
E_SIMPLE3(fuse_event, debug, true,
|
E_SIMPLE3(fuse_event, debug, true,
|
||||||
std::string, function, func, E_FROM_STRING,
|
std::string, function, func, E_STRING,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
int, result, res, E_FROM_INT32
|
int, result, res, E_FROM_INT32
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(fuse_args_parsed, info, true,
|
E_SIMPLE1(fuse_args_parsed, info, true,
|
||||||
std::string, arguments, args, E_FROM_STRING
|
std::string, arguments, args, E_STRING
|
||||||
);
|
);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
#define INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "events/event_system.hpp"
|
#include "events/event_system.hpp"
|
||||||
@ -604,4 +604,4 @@ public:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
#define INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "drives/fuse/fuse_drive_base.hpp"
|
#include "drives/fuse/fuse_drive_base.hpp"
|
||||||
@ -103,7 +103,7 @@ protected:
|
|||||||
struct fuse_file_info *file_info) -> api_error override;
|
struct fuse_file_info *file_info) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fgetattr_impl(std::string api_path, struct stat *unix_st,
|
fgetattr_impl(std::string api_path, struct stat *st,
|
||||||
struct fuse_file_info *file_info) -> api_error override;
|
struct fuse_file_info *file_info) -> api_error override;
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
@ -124,11 +124,11 @@ protected:
|
|||||||
|
|
||||||
#if FUSE_USE_VERSION >= 30
|
#if FUSE_USE_VERSION >= 30
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
getattr_impl(std::string api_path, struct stat *unix_st,
|
getattr_impl(std::string api_path, struct stat *st,
|
||||||
struct fuse_file_info *file_info) -> api_error override;
|
struct fuse_file_info *file_info) -> api_error override;
|
||||||
#else
|
#else
|
||||||
[[nodiscard]] auto getattr_impl(std::string api_path,
|
[[nodiscard]] auto getattr_impl(std::string api_path,
|
||||||
struct stat *unix_st) -> api_error override;
|
struct stat *st) -> api_error override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
@ -323,4 +323,4 @@ public:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
#define INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "drives/fuse/fuse_base.hpp"
|
#include "drives/fuse/fuse_base.hpp"
|
||||||
@ -134,4 +134,4 @@ public:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
#define INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -81,4 +81,4 @@ public:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
||||||
|
|
||||||
#include "drives/remote/i_remote_json.hpp"
|
#include "drives/remote/i_remote_json.hpp"
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
@ -30,25 +30,26 @@ class i_remote_instance : public virtual i_remote_json {
|
|||||||
INTERFACE_SETUP(i_remote_instance);
|
INTERFACE_SETUP(i_remote_instance);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_access(const char *path,
|
||||||
fuse_access(const char *path,
|
const std::int32_t &mask)
|
||||||
const std::int32_t &mask) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_chflags(const char *path, std::uint32_t flags)
|
||||||
fuse_chflags(const char *path, std::uint32_t flags) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_chmod(const char *path,
|
||||||
fuse_chmod(const char *path,
|
const remote::file_mode &mode)
|
||||||
const remote::file_mode &mode) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_chown(const char *path,
|
||||||
fuse_chown(const char *path, const remote::user_id &uid,
|
const remote::user_id &uid,
|
||||||
const remote::group_id &gid) -> packet::error_type = 0;
|
const remote::group_id &gid)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
fuse_create(const char *path, const remote::file_mode &mode,
|
fuse_create(const char *path, const remote::file_mode &mode,
|
||||||
const remote::open_flags &flags,
|
const remote::open_flags &flags, remote::file_handle &handle)
|
||||||
remote::file_handle &handle) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
[[nodiscard]] virtual auto fuse_destroy() -> packet::error_type = 0;
|
[[nodiscard]] virtual auto fuse_destroy() -> packet::error_type = 0;
|
||||||
|
|
||||||
/*[[nodiscard]] virtual packet::error_type fuse_fallocate(const char *path,
|
/*[[nodiscard]] virtual packet::error_type fuse_fallocate(const char *path,
|
||||||
@ -60,21 +61,24 @@ public:
|
|||||||
fuse_fgetattr(const char *path, remote::stat &r_stat, bool &directory,
|
fuse_fgetattr(const char *path, remote::stat &r_stat, bool &directory,
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
const remote::file_handle &handle) -> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_fsetattr_x(const char *path,
|
||||||
fuse_fsetattr_x(const char *path, const remote::setattr_x &attr,
|
const remote::setattr_x &attr,
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_fsync(const char *path,
|
||||||
fuse_fsync(const char *path, const std::int32_t &datasync,
|
const std::int32_t &datasync,
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_ftruncate(const char *path,
|
||||||
fuse_ftruncate(const char *path, const remote::file_offset &size,
|
const remote::file_offset &size,
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_getattr(const char *path,
|
||||||
fuse_getattr(const char *path, remote::stat &r_stat,
|
remote::stat &r_stat, bool &directory)
|
||||||
bool &directory) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
/*[[nodiscard]] virtual packet::error_type fuse_getxattr(const char *path,
|
/*[[nodiscard]] virtual packet::error_type fuse_getxattr(const char *path,
|
||||||
const char *name, char *value, const remote::file_size &size) = 0;
|
const char *name, char *value, const remote::file_size &size) = 0;
|
||||||
@ -83,9 +87,10 @@ public:
|
|||||||
const char *name, char *value, const remote::file_size &size, std::uint32_t
|
const char *name, char *value, const remote::file_size &size, std::uint32_t
|
||||||
position) = 0;*/
|
position) = 0;*/
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_getxtimes(const char *path,
|
||||||
fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
remote::file_time &bkuptime,
|
||||||
remote::file_time &crtime) -> packet::error_type = 0;
|
remote::file_time &crtime)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto fuse_init() -> packet::error_type = 0;
|
[[nodiscard]] virtual auto fuse_init() -> packet::error_type = 0;
|
||||||
|
|
||||||
@ -93,63 +98,65 @@ public:
|
|||||||
char *buffer, const remote::file_size &size) = 0;*/
|
char *buffer, const remote::file_size &size) = 0;*/
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
fuse_mkdir(const char *path,
|
fuse_mkdir(const char *path, const remote::file_mode &mode)
|
||||||
const remote::file_mode &mode) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_open(const char *path,
|
||||||
fuse_open(const char *path, const remote::open_flags &flags,
|
const remote::open_flags &flags,
|
||||||
remote::file_handle &handle) -> packet::error_type = 0;
|
remote::file_handle &handle)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_opendir(const char *path,
|
||||||
fuse_opendir(const char *path,
|
remote::file_handle &handle)
|
||||||
remote::file_handle &handle) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_read(const char *path, char *buffer,
|
||||||
fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
const remote::file_size &read_size,
|
||||||
const remote::file_offset &read_offset,
|
const remote::file_offset &read_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||||
const remote::file_handle &handle,
|
const remote::file_handle &handle, std::string &item_path)
|
||||||
std::string &item_path) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_release(const char *path,
|
||||||
fuse_release(const char *path,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_releasedir(const char *path,
|
||||||
fuse_releasedir(const char *path,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
//[[nodiscard]] virtual packet::error_type fuse_removexattr(const char *path,
|
//[[nodiscard]] virtual packet::error_type fuse_removexattr(const char *path,
|
||||||
// const char *name) =
|
// const char *name) =
|
||||||
// 0;
|
// 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_rename(const char *from, const char *to)
|
||||||
fuse_rename(const char *from, const char *to) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_rmdir(const char *path)
|
||||||
fuse_rmdir(const char *path) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_setattr_x(const char *path,
|
||||||
fuse_setattr_x(const char *path,
|
remote::setattr_x &attr)
|
||||||
remote::setattr_x &attr) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_setbkuptime(const char *path,
|
||||||
fuse_setbkuptime(const char *path,
|
const remote::file_time &bkuptime)
|
||||||
const remote::file_time &bkuptime) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_setchgtime(const char *path,
|
||||||
fuse_setchgtime(const char *path,
|
const remote::file_time &chgtime)
|
||||||
const remote::file_time &chgtime) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_setcrtime(const char *path,
|
||||||
fuse_setcrtime(const char *path,
|
const remote::file_time &crtime)
|
||||||
const remote::file_time &crtime) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_setvolname(const char *volname)
|
||||||
fuse_setvolname(const char *volname) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
/*[[nodiscard]] virtual packet::error_type fuse_setxattr(const char *path,
|
/*[[nodiscard]] virtual packet::error_type fuse_setxattr(const char *path,
|
||||||
const char *name, const char *value, const remote::file_size &size, const
|
const char *name, const char *value, const remote::file_size &size, const
|
||||||
@ -158,35 +165,36 @@ public:
|
|||||||
const char *name, const char *value, const remote::file_size &size, const
|
const char *name, const char *value, const remote::file_size &size, const
|
||||||
std::int32_t &flags, std::uint32_t position) = 0;*/
|
std::int32_t &flags, std::uint32_t position) = 0;*/
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_statfs(const char *path, std::uint64_t frsize,
|
||||||
fuse_statfs(const char *path, std::uint64_t frsize,
|
remote::statfs &r_stat)
|
||||||
remote::statfs &r_stat) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
fuse_statfs_x(const char *path, std::uint64_t bsize,
|
fuse_statfs_x(const char *path, std::uint64_t bsize, remote::statfs_x &r_stat)
|
||||||
remote::statfs_x &r_stat) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_truncate(const char *path,
|
||||||
fuse_truncate(const char *path,
|
const remote::file_offset &size)
|
||||||
const remote::file_offset &size) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_unlink(const char *path)
|
||||||
fuse_unlink(const char *path) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_utimens(const char *path,
|
||||||
fuse_utimens(const char *path, const remote::file_time *tv, std::uint64_t op0,
|
const remote::file_time *tv,
|
||||||
std::uint64_t op1) -> packet::error_type = 0;
|
std::uint64_t op0, std::uint64_t op1)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto fuse_write(const char *path, const char *buffer,
|
||||||
fuse_write(const char *path, const char *buffer,
|
const remote::file_size &writeSize,
|
||||||
const remote::file_size &writeSize,
|
const remote::file_offset &writeOffset,
|
||||||
const remote::file_offset &writeOffset,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto fuse_write_base64(
|
[[nodiscard]] virtual auto fuse_write_base64(
|
||||||
const char *path, const char *buffer, const remote::file_size &writeSize,
|
const char *path, const char *buffer, const remote::file_size &writeSize,
|
||||||
const remote::file_offset &writeOffset,
|
const remote::file_offset &writeOffset, const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual void set_fuse_uid_gid(const remote::user_id &uid,
|
virtual void set_fuse_uid_gid(const remote::user_id &uid,
|
||||||
const remote::group_id &gid) = 0;
|
const remote::group_id &gid) = 0;
|
||||||
@ -196,4 +204,4 @@ using remote_instance_factory =
|
|||||||
std::function<std::unique_ptr<i_remote_instance>()>;
|
std::function<std::unique_ptr<i_remote_instance>()>;
|
||||||
} // namespace repertory::remote_fuse
|
} // namespace repertory::remote_fuse
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
|
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
|
||||||
|
|
||||||
#include "comm/packet/packet_client.hpp"
|
#include "comm/packet/packet_client.hpp"
|
||||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||||
@ -51,9 +51,9 @@ public:
|
|||||||
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||||
fuse_chown(const char *path, const remote::user_id &uid,
|
const remote::group_id &gid)
|
||||||
const remote::group_id &gid) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
||||||
|
|
||||||
@ -67,21 +67,23 @@ public:
|
|||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_fsetattr_x(
|
[[nodiscard]] auto fuse_fsetattr_x(const char *path,
|
||||||
const char *path, const remote::setattr_x &attr,
|
const remote::setattr_x &attr,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||||
fuse_fsync(const char *path, const std::int32_t &datasync,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_ftruncate(
|
[[nodiscard]] auto fuse_ftruncate(const char *path,
|
||||||
const char *path, const remote::file_offset &size,
|
const remote::file_offset &size,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_getattr(const char *path, remote::stat &st,
|
||||||
fuse_getattr(const char *path, remote::stat &st,
|
bool &directory)
|
||||||
bool &directory) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
||||||
*name, char *value, const remote::file_size &size) override ;
|
*name, char *value, const remote::file_size &size) override ;
|
||||||
@ -90,9 +92,10 @@ public:
|
|||||||
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
||||||
override ;*/
|
override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_getxtimes(const char *path,
|
||||||
fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
remote::file_time &bkuptime,
|
||||||
remote::file_time &crtime) -> packet::error_type override;
|
remote::file_time &crtime)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
||||||
|
|
||||||
@ -107,25 +110,27 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_create(const char *path, const remote::file_mode &mode,
|
fuse_create(const char *path, const remote::file_mode &mode,
|
||||||
const remote::open_flags &flags,
|
const remote::open_flags &flags, remote::file_handle &handle)
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_open(const char *path,
|
||||||
fuse_open(const char *path, const remote::open_flags &flags,
|
const remote::open_flags &flags,
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_read(const char *path, char *buffer,
|
||||||
fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
const remote::file_size &read_size,
|
||||||
const remote::file_offset &read_offset,
|
const remote::file_offset &read_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_rename(const char *from,
|
[[nodiscard]] auto fuse_rename(const char *from, const char *to)
|
||||||
const char *to) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||||
const remote::file_handle &handle,
|
const remote::file_handle &handle, std::string &item_path)
|
||||||
std::string &item_path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_release(const char *path,
|
[[nodiscard]] auto fuse_release(const char *path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
@ -139,8 +144,8 @@ public:
|
|||||||
* char *name) override
|
* char *name) override
|
||||||
* ;*/
|
* ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_rmdir(const char *path)
|
||||||
fuse_rmdir(const char *path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
@ -157,8 +162,8 @@ public:
|
|||||||
const remote::file_time &crtime)
|
const remote::file_time &crtime)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_setvolname(const char *volname)
|
||||||
fuse_setvolname(const char *volname) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] /*packet::error_type fuse_setxattr(const char *path, const char
|
[[nodiscard]] /*packet::error_type fuse_setxattr(const char *path, const char
|
||||||
*name, const char *value, const remote::file_size &size, const std::int32_t
|
*name, const char *value, const remote::file_size &size, const std::int32_t
|
||||||
@ -169,45 +174,48 @@ public:
|
|||||||
std::int32_t &flags, std::uint32_t position) override ;*/
|
std::int32_t &flags, std::uint32_t position) override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_statfs(const char *path, std::uint64_t frsize,
|
fuse_statfs(const char *path, std::uint64_t frsize, remote::statfs &st)
|
||||||
remote::statfs &st) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||||
fuse_statfs_x(const char *path, std::uint64_t bsize,
|
remote::statfs_x &st)
|
||||||
remote::statfs_x &st) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_truncate(const char *path,
|
||||||
fuse_truncate(const char *path,
|
const remote::file_offset &size)
|
||||||
const remote::file_offset &size) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_unlink(const char *path)
|
||||||
fuse_unlink(const char *path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||||
fuse_utimens(const char *path, const remote::file_time *tv, std::uint64_t op0,
|
std::uint64_t op0, std::uint64_t op1)
|
||||||
std::uint64_t op1) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_write(const char *path, const char *buffer,
|
||||||
fuse_write(const char *path, const char *buffer,
|
const remote::file_size &write_size,
|
||||||
const remote::file_size &write_size,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_write_base64(
|
[[nodiscard]] auto fuse_write_base64(const char *path, const char *buffer,
|
||||||
const char *path, const char *buffer, const remote::file_size &write_size,
|
const remote::file_size &write_size,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto json_create_directory_snapshot(
|
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
|
||||||
const std::string &path, json &json_data) -> packet::error_type override;
|
json &json_data)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto json_read_directory_snapshot(
|
[[nodiscard]] auto json_read_directory_snapshot(
|
||||||
const std::string &path, const remote::file_handle &handle,
|
const std::string &path, const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto json_release_directory_snapshot(
|
[[nodiscard]] auto
|
||||||
const std::string &path,
|
json_release_directory_snapshot(const std::string &path,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
void set_fuse_uid_gid(const remote::user_id &uid,
|
void set_fuse_uid_gid(const remote::user_id &uid,
|
||||||
const remote::group_id &gid) override;
|
const remote::group_id &gid) override;
|
||||||
@ -215,4 +223,4 @@ public:
|
|||||||
} // namespace remote_fuse
|
} // namespace remote_fuse
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "drives/fuse/fuse_base.hpp"
|
#include "drives/fuse/fuse_base.hpp"
|
||||||
@ -238,4 +238,4 @@ protected:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "drives/directory_cache.hpp"
|
#include "drives/directory_cache.hpp"
|
||||||
@ -49,9 +49,9 @@ private:
|
|||||||
|
|
||||||
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
||||||
|
|
||||||
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
remote::file_info &file_info)
|
populate_file_info(const std::string &api_path,
|
||||||
-> packet::error_type;
|
remote::file_info &file_info) -> packet::error_type;
|
||||||
|
|
||||||
void populate_file_info(const std::string &api_path, const UINT64 &file_size,
|
void populate_file_info(const std::string &api_path, const UINT64 &file_size,
|
||||||
const UINT32 &attributes,
|
const UINT32 &attributes,
|
||||||
@ -72,14 +72,14 @@ public:
|
|||||||
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_chown(const char *path, const remote::user_id &uid,
|
[[nodiscard]] auto
|
||||||
const remote::group_id &gid)
|
fuse_chown(const char *path, const remote::user_id &uid,
|
||||||
-> packet::error_type override;
|
const remote::group_id &gid) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_create(const char *path, const remote::file_mode &mode,
|
fuse_create(const char *path, const remote::file_mode &mode,
|
||||||
const remote::open_flags &flags, remote::file_handle &handle)
|
const remote::open_flags &flags,
|
||||||
-> packet::error_type override;
|
remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
||||||
|
|
||||||
@ -88,28 +88,25 @@ public:
|
|||||||
remote::file_offset &length, const remote::file_handle &handle) override
|
remote::file_offset &length, const remote::file_handle &handle) override
|
||||||
;*/
|
;*/
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_fgetattr(const char *path, remote::stat &r_stat,
|
[[nodiscard]] auto fuse_fgetattr(
|
||||||
bool &directory,
|
const char *path, remote::stat &r_stat, bool &directory,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_fsetattr_x(const char *path,
|
[[nodiscard]] auto fuse_fsetattr_x(
|
||||||
const remote::setattr_x &attr,
|
const char *path, const remote::setattr_x &attr,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
[[nodiscard]] auto
|
||||||
const remote::file_handle &handle)
|
fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||||
-> packet::error_type override;
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_ftruncate(const char *path,
|
[[nodiscard]] auto fuse_ftruncate(
|
||||||
const remote::file_offset &size,
|
const char *path, const remote::file_offset &size,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_getattr(const char *path, remote::stat &r_stat,
|
[[nodiscard]] auto
|
||||||
bool &directory)
|
fuse_getattr(const char *path, remote::stat &r_stat,
|
||||||
-> packet::error_type override;
|
bool &directory) -> packet::error_type override;
|
||||||
|
|
||||||
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
||||||
*name, char *value, const remote::file_size &size) override ;
|
*name, char *value, const remote::file_size &size) override ;
|
||||||
@ -118,10 +115,9 @@ public:
|
|||||||
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
||||||
override ;*/
|
override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_getxtimes(const char *path,
|
[[nodiscard]] auto
|
||||||
remote::file_time &bkuptime,
|
fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
||||||
remote::file_time &crtime)
|
remote::file_time &crtime) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
||||||
|
|
||||||
@ -129,30 +125,28 @@ public:
|
|||||||
*buffer, const remote::file_size &size) override ;*/
|
*buffer, const remote::file_size &size) override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_mkdir(const char *path, const remote::file_mode &mode)
|
fuse_mkdir(const char *path,
|
||||||
-> packet::error_type override;
|
const remote::file_mode &mode) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_open(const char *path,
|
[[nodiscard]] auto
|
||||||
const remote::open_flags &flags,
|
fuse_open(const char *path, const remote::open_flags &flags,
|
||||||
remote::file_handle &handle)
|
remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_opendir(const char *path, remote::file_handle &handle)
|
[[nodiscard]] auto fuse_opendir(const char *path, remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_read(const char *path, char *buffer,
|
[[nodiscard]] auto
|
||||||
const remote::file_size &read_size,
|
fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
||||||
const remote::file_offset &read_offset,
|
const remote::file_offset &read_offset,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_rename(const char *from, const char *to)
|
[[nodiscard]] auto fuse_rename(const char *from,
|
||||||
-> packet::error_type override;
|
const char *to) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||||
const remote::file_handle &handle, std::string &item_path)
|
const remote::file_handle &handle,
|
||||||
-> packet::error_type override;
|
std::string &item_path) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_release(const char *path,
|
[[nodiscard]] auto fuse_release(const char *path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
@ -166,8 +160,8 @@ public:
|
|||||||
* char *name) override
|
* char *name) override
|
||||||
* ;*/
|
* ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_rmdir(const char *path)
|
[[nodiscard]] auto
|
||||||
-> packet::error_type override;
|
fuse_rmdir(const char *path) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
@ -184,8 +178,8 @@ public:
|
|||||||
const remote::file_time &crtime)
|
const remote::file_time &crtime)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_setvolname(const char *volname)
|
[[nodiscard]] auto
|
||||||
-> packet::error_type override;
|
fuse_setvolname(const char *volname) -> packet::error_type override;
|
||||||
|
|
||||||
/*[[nodiscard]] packet::error_type fuse_setxattr(const char *path, const char
|
/*[[nodiscard]] packet::error_type fuse_setxattr(const char *path, const char
|
||||||
*name, const char *value, const remote::file_size &size, const std::int32_t
|
*name, const char *value, const remote::file_size &size, const std::int32_t
|
||||||
@ -195,70 +189,67 @@ public:
|
|||||||
char *name, const char *value, const remote::file_size &size, const
|
char *name, const char *value, const remote::file_size &size, const
|
||||||
std::int32_t &flags, std::uint32_t position) override ;*/
|
std::int32_t &flags, std::uint32_t position) override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_statfs(const char *path, std::uint64_t frsize,
|
[[nodiscard]] auto
|
||||||
remote::statfs &r_stat)
|
fuse_statfs(const char *path, std::uint64_t frsize,
|
||||||
-> packet::error_type override;
|
remote::statfs &r_stat) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_statfs_x(const char *path, std::uint64_t bsize,
|
[[nodiscard]] auto
|
||||||
remote::statfs_x &r_stat)
|
fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||||
-> packet::error_type override;
|
remote::statfs_x &r_stat) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_truncate(const char *path,
|
[[nodiscard]] auto
|
||||||
const remote::file_offset &size)
|
fuse_truncate(const char *path,
|
||||||
-> packet::error_type override;
|
const remote::file_offset &size) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_unlink(const char *path)
|
[[nodiscard]] auto
|
||||||
-> packet::error_type override;
|
fuse_unlink(const char *path) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_utimens(const char *path, const remote::file_time *tv,
|
[[nodiscard]] auto
|
||||||
std::uint64_t op0, std::uint64_t op1)
|
fuse_utimens(const char *path, const remote::file_time *tv, std::uint64_t op0,
|
||||||
-> packet::error_type override;
|
std::uint64_t op1) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_write(const char *path, const char *buffer,
|
[[nodiscard]] auto
|
||||||
const remote::file_size &write_size,
|
fuse_write(const char *path, const char *buffer,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_size &write_size,
|
||||||
const remote::file_handle &handle)
|
const remote::file_offset &write_offset,
|
||||||
-> packet::error_type override;
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_write_base64(const char *path, const char *buffer,
|
[[nodiscard]] auto fuse_write_base64(
|
||||||
const remote::file_size &write_size,
|
const char *path, const char *buffer, const remote::file_size &write_size,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
void set_fuse_uid_gid(const remote::user_id &,
|
void set_fuse_uid_gid(const remote::user_id &,
|
||||||
const remote::group_id &) override {}
|
const remote::group_id &) override {}
|
||||||
|
|
||||||
// JSON Layer
|
// JSON Layer
|
||||||
[[nodiscard]] auto winfsp_get_dir_buffer(PVOID /*file_desc*/,
|
[[nodiscard]] auto
|
||||||
PVOID *& /*ptr*/)
|
winfsp_get_dir_buffer(PVOID /*file_desc*/,
|
||||||
-> packet::error_type override {
|
PVOID *& /*ptr*/) -> packet::error_type override {
|
||||||
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
|
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
|
[[nodiscard]] auto json_create_directory_snapshot(
|
||||||
json &json_data)
|
const std::string &path, json &json_data) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto json_read_directory_snapshot(
|
[[nodiscard]] auto json_read_directory_snapshot(
|
||||||
const std::string &path, const remote::file_handle &handle,
|
const std::string &path, const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto json_release_directory_snapshot(
|
||||||
json_release_directory_snapshot(const std::string &path,
|
const std::string &path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
// WinFSP Layer
|
// WinFSP Layer
|
||||||
[[nodiscard]] auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
[[nodiscard]] auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
[[nodiscard]] auto
|
||||||
UINT32 flags, BOOLEAN &was_deleted)
|
winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||||
-> packet::error_type override;
|
BOOLEAN &was_closed) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_close(PVOID file_desc)
|
[[nodiscard]] auto
|
||||||
-> packet::error_type override;
|
winfsp_close(PVOID file_desc) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
winfsp_create(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
winfsp_create(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||||
@ -273,66 +264,60 @@ public:
|
|||||||
remote::file_info *file_info)
|
remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto winfsp_get_security_by_name(
|
||||||
|
PWSTR file_name, PUINT32 attributes,
|
||||||
|
std::uint64_t * /*security_descriptor_size*/,
|
||||||
|
std::wstring & /*str_descriptor*/) -> packet::error_type override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto winfsp_get_volume_info(
|
||||||
|
UINT64 &total_size, UINT64 &free_size,
|
||||||
|
std::string &volume_label) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
||||||
std::uint64_t * /*security_descriptor_size*/,
|
|
||||||
std::wstring & /*str_descriptor*/)
|
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_get_volume_info(UINT64 &total_size,
|
[[nodiscard]] auto
|
||||||
UINT64 &free_size,
|
winfsp_open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||||
std::string &volume_label)
|
PVOID *file_desc, remote::file_info *file_info,
|
||||||
-> packet::error_type override;
|
std::string &normalized_name) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_mounted(const std::wstring &location)
|
[[nodiscard]] auto
|
||||||
-> packet::error_type override;
|
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||||
|
BOOLEAN replace_attributes, UINT64 /*allocation_size*/,
|
||||||
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
[[nodiscard]] auto
|
||||||
UINT32 granted_access, PVOID *file_desc,
|
winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
remote::file_info *file_info,
|
PUINT32 bytes_transferred) -> packet::error_type override;
|
||||||
std::string &normalized_name)
|
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
[[nodiscard]] auto
|
||||||
BOOLEAN replace_attributes,
|
winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, PWSTR marker,
|
||||||
UINT64 /*allocation_size*/,
|
json &itemList) -> packet::error_type override;
|
||||||
remote::file_info *file_info)
|
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
[[nodiscard]] auto
|
||||||
UINT32 length, PUINT32 bytes_transferred)
|
winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
|
||||||
-> packet::error_type override;
|
BOOLEAN replace_if_exists) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
|
|
||||||
PWSTR marker, json &itemList)
|
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
|
|
||||||
PWSTR new_file_name,
|
|
||||||
BOOLEAN replace_if_exists)
|
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_set_basic_info(
|
[[nodiscard]] auto winfsp_set_basic_info(
|
||||||
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
||||||
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
[[nodiscard]] auto winfsp_set_file_size(
|
||||||
BOOLEAN set_allocation_size,
|
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||||
remote::file_info *file_info)
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_unmounted(const std::wstring &location)
|
[[nodiscard]] auto
|
||||||
-> packet::error_type override;
|
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||||
PUINT32 bytes_transferred, remote::file_info *file_info)
|
PUINT32 bytes_transferred,
|
||||||
-> packet::error_type override;
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
};
|
};
|
||||||
} // namespace remote_fuse
|
} // namespace remote_fuse
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_
|
#ifndef INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_
|
#define INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_
|
||||||
|
|
||||||
#include "comm/packet/packet.hpp"
|
#include "comm/packet/packet.hpp"
|
||||||
|
|
||||||
@ -30,17 +30,18 @@ class i_remote_json {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
json_create_directory_snapshot(const std::string &path,
|
json_create_directory_snapshot(const std::string &path, json &json_data)
|
||||||
json &json_data) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto json_read_directory_snapshot(
|
[[nodiscard]] virtual auto json_read_directory_snapshot(
|
||||||
const std::string &path, const remote::file_handle &handle,
|
const std::string &path, const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data) -> packet::error_type = 0;
|
std::uint32_t page, json &json_data) -> packet::error_type = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto json_release_directory_snapshot(
|
[[nodiscard]] virtual auto
|
||||||
const std::string &path,
|
json_release_directory_snapshot(const std::string &path,
|
||||||
const remote::file_handle &handle) -> packet::error_type = 0;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type = 0;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_
|
#endif // INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_
|
#ifndef INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_
|
#define INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_
|
||||||
|
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -33,32 +33,25 @@ protected:
|
|||||||
virtual ~remote_open_file_table() = default;
|
virtual ~remote_open_file_table() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct compat_open_info final {
|
struct compat_open_info {
|
||||||
std::string client_id;
|
std::size_t count = 0u;
|
||||||
std::vector<remote::file_handle> handles;
|
std::string client_id = "";
|
||||||
std::string path;
|
std::string path;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct open_info final {
|
struct open_info {
|
||||||
std::string client_id;
|
std::size_t count = 0u;
|
||||||
PVOID directory_buffer{nullptr};
|
std::string client_id = "";
|
||||||
std::vector<native_handle> handles;
|
PVOID directory_buffer = nullptr;
|
||||||
std::string path;
|
std::string path;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<std::string, std::unique_ptr<compat_open_info>>
|
std::unordered_map<remote::file_handle, compat_open_info> compat_lookup_;
|
||||||
compat_file_lookup_;
|
std::recursive_mutex compat_mutex_;
|
||||||
std::unordered_map<remote::file_handle, std::string> compat_handle_lookup_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unordered_map<std::string, std::vector<std::uint64_t>> directory_lookup_;
|
std::unordered_map<std::string, std::vector<std::uint64_t>> directory_lookup_;
|
||||||
|
std::recursive_mutex directory_mutex_;
|
||||||
private:
|
std::unordered_map<native_handle, open_info> file_lookup_;
|
||||||
std::unordered_map<std::string, std::unique_ptr<open_info>> file_lookup_;
|
|
||||||
std::unordered_map<native_handle, std::string> handle_lookup_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
mutable std::recursive_mutex file_mutex_;
|
mutable std::recursive_mutex file_mutex_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -71,11 +64,11 @@ protected:
|
|||||||
PVOID *&buffer) -> bool;
|
PVOID *&buffer) -> bool;
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
[[nodiscard]] auto get_open_file_path(const native_handle &handle)
|
[[nodiscard]] auto
|
||||||
-> std::string;
|
get_open_file_path(const native_handle &handle) -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] auto get_open_info(const native_handle &handle, open_info &oi)
|
[[nodiscard]] auto get_open_info(const native_handle &handle,
|
||||||
-> bool;
|
open_info &oi) -> bool;
|
||||||
|
|
||||||
[[nodiscard]] auto has_open_directory(const std::string &client_id,
|
[[nodiscard]] auto has_open_directory(const std::string &client_id,
|
||||||
std::uint64_t handle) -> bool;
|
std::uint64_t handle) -> bool;
|
||||||
@ -84,21 +77,20 @@ protected:
|
|||||||
int error_return) -> int;
|
int error_return) -> int;
|
||||||
|
|
||||||
template <typename error_type>
|
template <typename error_type>
|
||||||
[[nodiscard]] auto has_open_info(const native_handle &handle,
|
[[nodiscard]] auto
|
||||||
const error_type &error_return)
|
has_open_info(const native_handle &handle,
|
||||||
-> error_type {
|
const error_type &error_return) -> error_type {
|
||||||
recur_mutex_lock file_lock(file_mutex_);
|
recur_mutex_lock file_lock(file_mutex_);
|
||||||
return handle_lookup_.contains(handle) ? 0 : error_return;
|
return ((file_lookup_.find(handle) == file_lookup_.end()) ? error_return
|
||||||
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_all(const std::string &file_path);
|
void remove_all(const std::string &file_path);
|
||||||
|
|
||||||
void remove_and_close_all(const native_handle &handle);
|
|
||||||
|
|
||||||
void remove_compat_open_info(const remote::file_handle &handle);
|
void remove_compat_open_info(const remote::file_handle &handle);
|
||||||
|
|
||||||
auto remove_directory(const std::string &client_id, std::uint64_t handle)
|
auto remove_directory(const std::string &client_id,
|
||||||
-> bool;
|
std::uint64_t handle) -> bool;
|
||||||
|
|
||||||
void remove_open_info(const native_handle &handle);
|
void remove_open_info(const native_handle &handle);
|
||||||
|
|
||||||
@ -110,12 +102,12 @@ protected:
|
|||||||
void set_compat_open_info(const remote::file_handle &handle,
|
void set_compat_open_info(const remote::file_handle &handle,
|
||||||
const std::string &file_path);
|
const std::string &file_path);
|
||||||
|
|
||||||
void set_open_info(const native_handle &handle, open_info op_info);
|
void set_open_info(const native_handle &handle, open_info oi);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] auto get_open_file_count(const std::string &file_path) const
|
[[nodiscard]] auto
|
||||||
-> std::size_t;
|
get_open_file_count(const std::string &file_path) const -> std::size_t;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_
|
#endif // INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_
|
#ifndef INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_
|
#define INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "comm/packet/client_pool.hpp"
|
#include "comm/packet/client_pool.hpp"
|
||||||
@ -29,8 +29,6 @@
|
|||||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||||
#include "drives/remote/remote_open_file_table.hpp"
|
#include "drives/remote/remote_open_file_table.hpp"
|
||||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||||
#include "events/event_system.hpp"
|
|
||||||
#include "events/events.hpp"
|
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
#include "utils/base64.hpp"
|
#include "utils/base64.hpp"
|
||||||
@ -54,7 +52,7 @@ public:
|
|||||||
: config_(config),
|
: config_(config),
|
||||||
drive_(drv),
|
drive_(drv),
|
||||||
mount_location_(std::move(mount_location)),
|
mount_location_(std::move(mount_location)),
|
||||||
client_pool_(config.get_remote_mount().client_pool_size) {
|
client_pool_(config.get_remote_client_pool_size()) {
|
||||||
event_system::instance().raise<service_started>("remote_server_base");
|
event_system::instance().raise<service_started>("remote_server_base");
|
||||||
handler_lookup_.insert(
|
handler_lookup_.insert(
|
||||||
{"::winfsp_can_delete",
|
{"::winfsp_can_delete",
|
||||||
@ -87,10 +85,10 @@ public:
|
|||||||
UINT32 flags{};
|
UINT32 flags{};
|
||||||
DECODE_OR_RETURN(request, flags);
|
DECODE_OR_RETURN(request, flags);
|
||||||
|
|
||||||
BOOLEAN was_deleted{};
|
BOOLEAN was_closed{};
|
||||||
ret = this->winfsp_cleanup(file_desc, file_name.data(), flags,
|
ret = this->winfsp_cleanup(file_desc, file_name.data(), flags,
|
||||||
was_deleted);
|
was_closed);
|
||||||
response.encode(was_deleted);
|
response.encode(was_closed);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}});
|
}});
|
||||||
@ -139,12 +137,12 @@ public:
|
|||||||
if (ret == STATUS_SUCCESS) {
|
if (ret == STATUS_SUCCESS) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
this->set_client_id(file_desc, client_id);
|
this->set_client_id(file_desc, client_id);
|
||||||
#else // !defined(_WIN32)
|
#else
|
||||||
this->set_client_id(
|
this->set_client_id(
|
||||||
static_cast<native_handle>(
|
static_cast<native_handle>(
|
||||||
reinterpret_cast<std::uintptr_t>(file_desc)),
|
reinterpret_cast<std::uintptr_t>(file_desc)),
|
||||||
client_id);
|
client_id);
|
||||||
#endif // defined(_WIN32)
|
#endif
|
||||||
response.encode(file_desc);
|
response.encode(file_desc);
|
||||||
response.encode(file_info);
|
response.encode(file_info);
|
||||||
response.encode(normalized_name);
|
response.encode(normalized_name);
|
||||||
@ -279,12 +277,12 @@ public:
|
|||||||
if (ret == STATUS_SUCCESS) {
|
if (ret == STATUS_SUCCESS) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
this->set_client_id(file_desc, client_id);
|
this->set_client_id(file_desc, client_id);
|
||||||
#else // !defined(_WIN32)
|
#else
|
||||||
this->set_client_id(
|
this->set_client_id(
|
||||||
static_cast<native_handle>(
|
static_cast<native_handle>(
|
||||||
reinterpret_cast<std::uintptr_t>(file_desc)),
|
reinterpret_cast<std::uintptr_t>(file_desc)),
|
||||||
client_id);
|
client_id);
|
||||||
#endif // defined(_WIN32)
|
#endif
|
||||||
response.encode(file_desc);
|
response.encode(file_desc);
|
||||||
response.encode(file_info);
|
response.encode(file_info);
|
||||||
response.encode(normalized_name);
|
response.encode(normalized_name);
|
||||||
@ -587,9 +585,9 @@ public:
|
|||||||
0) {
|
0) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
this->set_compat_client_id(handle, client_id);
|
this->set_compat_client_id(handle, client_id);
|
||||||
#else // !defined(_WIN32)
|
#else
|
||||||
this->set_client_id(static_cast<native_handle>(handle), client_id);
|
this->set_client_id(static_cast<native_handle>(handle), client_id);
|
||||||
#endif // defined(_WIN32)
|
#endif
|
||||||
response.encode(handle);
|
response.encode(handle);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -843,9 +841,9 @@ public:
|
|||||||
if ((ret = this->fuse_open(path.c_str(), flags, handle)) >= 0) {
|
if ((ret = this->fuse_open(path.c_str(), flags, handle)) >= 0) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
this->set_compat_client_id(handle, client_id);
|
this->set_compat_client_id(handle, client_id);
|
||||||
#else // !defined(_WIN32)
|
#else
|
||||||
this->set_client_id(static_cast<native_handle>(handle), client_id);
|
this->set_client_id(static_cast<native_handle>(handle), client_id);
|
||||||
#endif // defined(_WIN32)
|
#endif
|
||||||
response.encode(handle);
|
response.encode(handle);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -1359,8 +1357,7 @@ public:
|
|||||||
}});
|
}});
|
||||||
|
|
||||||
packet_server_ = std::make_unique<packet_server>(
|
packet_server_ = std::make_unique<packet_server>(
|
||||||
config_.get_remote_mount().api_port,
|
config_.get_remote_port(), config_.get_remote_token(), 10,
|
||||||
config_.get_remote_mount().encryption_token, 10,
|
|
||||||
[this](const std::string &client_id) {
|
[this](const std::string &client_id) {
|
||||||
return this->closed_handler(client_id);
|
return this->closed_handler(client_id);
|
||||||
},
|
},
|
||||||
@ -1433,4 +1430,4 @@ protected:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_
|
#endif // INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
|
#ifndef INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
|
#define INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
@ -31,25 +31,22 @@ class i_winfsp_drive {
|
|||||||
INTERFACE_SETUP(i_winfsp_drive);
|
INTERFACE_SETUP(i_winfsp_drive);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto get_directory_item_count(
|
||||||
get_directory_item_count(const std::string &api_path) const
|
const std::string &api_path) const -> std::uint64_t = 0;
|
||||||
-> std::uint64_t = 0;
|
|
||||||
|
[[nodiscard]] virtual auto get_directory_items(
|
||||||
|
const std::string &api_path) const -> directory_item_list = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
get_directory_items(const std::string &api_path) const
|
get_file_size(const std::string &api_path) const -> std::uint64_t = 0;
|
||||||
-> directory_item_list = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_file_size(const std::string &api_path) const
|
[[nodiscard]] virtual auto
|
||||||
-> std::uint64_t = 0;
|
get_item_meta(const std::string &api_path, const std::string &name,
|
||||||
|
std::string &value) const -> api_error = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
|
[[nodiscard]] virtual auto
|
||||||
const std::string &name,
|
get_item_meta(const std::string &api_path,
|
||||||
std::string &value) const
|
api_meta_map &meta) const -> api_error = 0;
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
|
|
||||||
api_meta_map &meta) const
|
|
||||||
-> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||||
@ -65,11 +62,11 @@ public:
|
|||||||
virtual void get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
virtual void get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||||
std::string &volume_label) const = 0;
|
std::string &volume_label) const = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto populate_file_info(const std::string &api_path,
|
[[nodiscard]] virtual auto
|
||||||
remote::file_info &fi) const
|
populate_file_info(const std::string &api_path,
|
||||||
-> api_error = 0;
|
remote::file_info &fi) -> api_error = 0;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
|
#endif // INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_
|
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_
|
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_
|
||||||
|
|
||||||
#include "drives/remote/i_remote_json.hpp"
|
#include "drives/remote/i_remote_json.hpp"
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ public:
|
|||||||
-> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
virtual auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||||
BOOLEAN &was_deleted) -> packet::error_type = 0;
|
BOOLEAN &was_closed) -> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_close(PVOID file_desc) -> packet::error_type = 0;
|
virtual auto winfsp_close(PVOID file_desc) -> packet::error_type = 0;
|
||||||
|
|
||||||
@ -50,8 +50,7 @@ public:
|
|||||||
virtual auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
virtual auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
||||||
-> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_get_file_info(PVOID file_desc,
|
virtual auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
||||||
remote::file_info *file_info)
|
|
||||||
-> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto
|
virtual auto
|
||||||
@ -87,13 +86,11 @@ public:
|
|||||||
PWSTR marker, json &itemList)
|
PWSTR marker, json &itemList)
|
||||||
-> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_rename(PVOID file_desc, PWSTR file_name,
|
virtual auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
||||||
PWSTR new_file_name, BOOLEAN replace_if_exists)
|
BOOLEAN replace_if_exists) -> packet::error_type = 0;
|
||||||
-> packet::error_type = 0;
|
|
||||||
|
|
||||||
virtual auto winfsp_set_basic_info(PVOID file_desc, UINT32 file_attributes,
|
virtual auto winfsp_set_basic_info(PVOID file_desc, UINT32 file_attributes,
|
||||||
UINT64 creation_time,
|
UINT64 creation_time, UINT64 last_access_time,
|
||||||
UINT64 last_access_time,
|
|
||||||
UINT64 last_write_time, UINT64 change_time,
|
UINT64 last_write_time, UINT64 change_time,
|
||||||
remote::file_info *file_info)
|
remote::file_info *file_info)
|
||||||
-> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
@ -117,4 +114,4 @@ using remote_instance_factory =
|
|||||||
std::function<std::unique_ptr<i_remote_instance>()>;
|
std::function<std::unique_ptr<i_remote_instance>()>;
|
||||||
} // namespace repertory::remote_winfsp
|
} // namespace repertory::remote_winfsp
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_
|
#endif // INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_
|
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_
|
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_
|
||||||
|
|
||||||
#include "comm/packet/packet.hpp"
|
#include "comm/packet/packet.hpp"
|
||||||
#include "comm/packet/packet_client.hpp"
|
#include "comm/packet/packet_client.hpp"
|
||||||
@ -50,20 +50,19 @@ public:
|
|||||||
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto json_read_directory_snapshot(const std::string &path,
|
auto json_read_directory_snapshot(
|
||||||
const remote::file_handle &handle,
|
const std::string &path, const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data)
|
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto json_release_directory_snapshot(const std::string &path,
|
auto json_release_directory_snapshot(const std::string &path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
auto winfsp_can_delete(PVOID file_desc,
|
||||||
-> packet::error_type override;
|
PWSTR file_name) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||||
BOOLEAN &was_deleted) -> packet::error_type override;
|
BOOLEAN &was_closed) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_close(PVOID file_desc) -> packet::error_type override;
|
auto winfsp_close(PVOID file_desc) -> packet::error_type override;
|
||||||
|
|
||||||
@ -76,33 +75,32 @@ public:
|
|||||||
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
auto winfsp_get_dir_buffer(PVOID file_desc,
|
||||||
-> packet::error_type override;
|
PVOID *&ptr) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
auto winfsp_get_security_by_name(
|
||||||
std::uint64_t *descriptor_size,
|
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
|
||||||
std::wstring &string_descriptor)
|
std::wstring &string_descriptor) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||||
std::string &volume_label)
|
std::string &volume_label)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_mounted(const std::wstring &location)
|
auto
|
||||||
-> packet::error_type override;
|
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||||
UINT32 granted_access, PVOID *file_desc,
|
UINT32 granted_access, PVOID *file_desc,
|
||||||
remote::file_info *file_info, std::string &normalized_name)
|
remote::file_info *file_info,
|
||||||
-> packet::error_type override;
|
std::string &normalized_name) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
auto
|
||||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||||
remote::file_info *file_info)
|
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||||
-> packet::error_type override;
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
PUINT32 bytes_transferred) -> packet::error_type override;
|
PUINT32 bytes_transferred) -> packet::error_type override;
|
||||||
@ -113,26 +111,25 @@ public:
|
|||||||
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
||||||
BOOLEAN replace_if_exists) -> packet::error_type override;
|
BOOLEAN replace_if_exists) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_set_basic_info(PVOID file_desc, UINT32 attributes,
|
auto winfsp_set_basic_info(
|
||||||
UINT64 creation_time, UINT64 last_access_time,
|
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
||||||
UINT64 last_write_time, UINT64 change_time,
|
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
||||||
remote::file_info *file_info)
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
auto winfsp_set_file_size(
|
||||||
BOOLEAN set_allocation_size,
|
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||||
remote::file_info *file_info)
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto winfsp_unmounted(const std::wstring &location)
|
auto
|
||||||
-> packet::error_type override;
|
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
auto
|
||||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
PUINT32 bytes_transferred, remote::file_info *file_info)
|
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||||
-> packet::error_type override;
|
PUINT32 bytes_transferred,
|
||||||
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
};
|
};
|
||||||
} // namespace remote_winfsp
|
} // namespace remote_winfsp
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_
|
#endif // INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
*/
|
*/
|
||||||
// NOTE: Most of the WinFSP pass-through code has been modified from:
|
// NOTE: Most of the WinFSP pass-through code has been modified from:
|
||||||
// https://github.com/billziss-gh/winfsp/blob/master/tst/passthrough-cpp/passthrough-cpp.cpp
|
// https://github.com/billziss-gh/winfsp/blob/master/tst/passthrough-cpp/passthrough-cpp.cpp
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
|
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
|
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include "comm/packet/packet.hpp"
|
#include "comm/packet/packet.hpp"
|
||||||
@ -49,23 +49,23 @@ private:
|
|||||||
|
|
||||||
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
||||||
|
|
||||||
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
remote::file_info &file_info)
|
populate_file_info(const std::string &api_path,
|
||||||
-> packet::error_type;
|
remote::file_info &file_info) -> packet::error_type;
|
||||||
|
|
||||||
void populate_stat(const char *path, bool directory, remote::stat &r_stat,
|
void populate_stat(const char *path, bool directory, remote::stat &r_stat,
|
||||||
const struct _stat64 &unix_st);
|
const struct _stat64 &unix_st);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// FUSE Layer
|
// FUSE Layer
|
||||||
auto fuse_access(const char *path, const std::int32_t &mask)
|
auto fuse_access(const char *path,
|
||||||
-> packet::error_type override;
|
const std::int32_t &mask) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_chflags(const char *path, std::uint32_t flags)
|
auto fuse_chflags(const char *path,
|
||||||
-> packet::error_type override;
|
std::uint32_t flags) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
auto fuse_chmod(const char *path,
|
||||||
-> packet::error_type override;
|
const remote::file_mode &mode) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_chown(const char *path, const remote::user_id &uid,
|
auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||||
const remote::group_id &gid) -> packet::error_type override;
|
const remote::group_id &gid) -> packet::error_type override;
|
||||||
@ -84,16 +84,16 @@ public:
|
|||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
auto
|
||||||
const remote::file_handle &handle)
|
fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||||
-> packet::error_type override;
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_ftruncate(const char *path, const remote::file_offset &size,
|
auto fuse_ftruncate(const char *path, const remote::file_offset &size,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_getattr(const char *path, remote::stat &r_stat, bool &directory)
|
auto fuse_getattr(const char *path, remote::stat &r_stat,
|
||||||
-> packet::error_type override;
|
bool &directory) -> packet::error_type override;
|
||||||
|
|
||||||
/*packet::error_type fuse_getxattr(const char *path, const char *name, char
|
/*packet::error_type fuse_getxattr(const char *path, const char *name, char
|
||||||
*value, const remote::file_size &size) override ;
|
*value, const remote::file_size &size) override ;
|
||||||
@ -110,43 +110,41 @@ public:
|
|||||||
const remote::file_size &size) override
|
const remote::file_size &size) override
|
||||||
;*/
|
;*/
|
||||||
|
|
||||||
auto fuse_mkdir(const char *path, const remote::file_mode &mode)
|
auto fuse_mkdir(const char *path,
|
||||||
-> packet::error_type override;
|
const remote::file_mode &mode) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_opendir(const char *path, remote::file_handle &handle)
|
auto fuse_opendir(const char *path,
|
||||||
-> packet::error_type override;
|
remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_create(const char *path, const remote::file_mode &mode,
|
auto fuse_create(const char *path, const remote::file_mode &mode,
|
||||||
const remote::open_flags &flags, remote::file_handle &handle)
|
const remote::open_flags &flags,
|
||||||
-> packet::error_type override;
|
remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_open(const char *path, const remote::open_flags &flags,
|
auto fuse_open(const char *path, const remote::open_flags &flags,
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_read(const char *path, char *buffer,
|
auto
|
||||||
const remote::file_size &read_size,
|
fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
||||||
const remote::file_offset &read_offset,
|
const remote::file_offset &read_offset,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto fuse_rename(const char *from, const char *to)
|
auto fuse_rename(const char *from,
|
||||||
-> packet::error_type override;
|
const char *to) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_write(const char *path, const char *buffer,
|
auto
|
||||||
const remote::file_size &write_size,
|
fuse_write(const char *path, const char *buffer,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_size &write_size,
|
||||||
const remote::file_handle &handle)
|
const remote::file_offset &write_offset,
|
||||||
-> packet::error_type override;
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_write_base64(const char *path, const char *buffer,
|
auto fuse_write_base64(
|
||||||
const remote::file_size &write_size,
|
const char *path, const char *buffer, const remote::file_size &write_size,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto fuse_readdir(const char *path, const remote::file_offset &offset,
|
auto fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||||
const remote::file_handle &handle, std::string &item_path)
|
const remote::file_handle &handle,
|
||||||
-> packet::error_type override;
|
std::string &item_path) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_release(const char *path, const remote::file_handle &handle)
|
auto fuse_release(const char *path, const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
@ -159,8 +157,8 @@ public:
|
|||||||
|
|
||||||
auto fuse_rmdir(const char *path) -> packet::error_type override;
|
auto fuse_rmdir(const char *path) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
auto fuse_setattr_x(const char *path,
|
||||||
-> packet::error_type override;
|
remote::setattr_x &attr) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_setbkuptime(const char *path, const remote::file_time &bkuptime)
|
auto fuse_setbkuptime(const char *path, const remote::file_time &bkuptime)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
@ -193,8 +191,8 @@ public:
|
|||||||
auto fuse_unlink(const char *path) -> packet::error_type override;
|
auto fuse_unlink(const char *path) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_utimens(const char *path, const remote::file_time *tv,
|
auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||||
std::uint64_t op0, std::uint64_t op1)
|
std::uint64_t op0,
|
||||||
-> packet::error_type override;
|
std::uint64_t op1) -> packet::error_type override;
|
||||||
|
|
||||||
void set_fuse_uid_gid(const remote::user_id & /* uid */,
|
void set_fuse_uid_gid(const remote::user_id & /* uid */,
|
||||||
const remote::group_id & /* gid */) override {}
|
const remote::group_id & /* gid */) override {}
|
||||||
@ -203,21 +201,20 @@ public:
|
|||||||
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto json_read_directory_snapshot(const std::string &path,
|
auto json_read_directory_snapshot(
|
||||||
const remote::file_handle &handle,
|
const std::string &path, const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data)
|
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto json_release_directory_snapshot(const std::string &path,
|
auto json_release_directory_snapshot(const std::string &path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
// WinFSP Layer
|
// WinFSP Layer
|
||||||
auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
auto winfsp_can_delete(PVOID file_desc,
|
||||||
-> packet::error_type override;
|
PWSTR file_name) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||||
BOOLEAN &was_deleted) -> packet::error_type override;
|
BOOLEAN &was_closed) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_close(PVOID file_desc) -> packet::error_type override;
|
auto winfsp_close(PVOID file_desc) -> packet::error_type override;
|
||||||
|
|
||||||
@ -230,33 +227,32 @@ public:
|
|||||||
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
auto winfsp_get_dir_buffer(PVOID file_desc,
|
||||||
-> packet::error_type override;
|
PVOID *&ptr) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
auto winfsp_get_security_by_name(
|
||||||
std::uint64_t *descriptor_size,
|
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
|
||||||
std::wstring &string_descriptor)
|
std::wstring &string_descriptor) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||||
std::string &volume_label)
|
std::string &volume_label)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_mounted(const std::wstring &location)
|
auto
|
||||||
-> packet::error_type override;
|
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||||
UINT32 granted_access, PVOID *file_desc,
|
UINT32 granted_access, PVOID *file_desc,
|
||||||
remote::file_info *file_info, std::string &normalized_name)
|
remote::file_info *file_info,
|
||||||
-> packet::error_type override;
|
std::string &normalized_name) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
auto
|
||||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||||
remote::file_info *file_info)
|
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||||
-> packet::error_type override;
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
PUINT32 bytes_transferred) -> packet::error_type override;
|
PUINT32 bytes_transferred) -> packet::error_type override;
|
||||||
@ -267,27 +263,26 @@ public:
|
|||||||
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
||||||
BOOLEAN replace_if_exists) -> packet::error_type override;
|
BOOLEAN replace_if_exists) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_set_basic_info(PVOID file_desc, UINT32 attributes,
|
auto winfsp_set_basic_info(
|
||||||
UINT64 creation_time, UINT64 last_access_time,
|
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
||||||
UINT64 last_write_time, UINT64 change_time,
|
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
||||||
remote::file_info *file_info)
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
auto winfsp_set_file_size(
|
||||||
BOOLEAN set_allocation_size,
|
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||||
remote::file_info *file_info)
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
-> packet::error_type override;
|
|
||||||
|
|
||||||
auto winfsp_unmounted(const std::wstring &location)
|
auto
|
||||||
-> packet::error_type override;
|
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
auto
|
||||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
PUINT32 bytes_transferred, remote::file_info *file_info)
|
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||||
-> packet::error_type override;
|
PUINT32 bytes_transferred,
|
||||||
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
};
|
};
|
||||||
} // namespace remote_winfsp
|
} // namespace remote_winfsp
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
|
#endif // INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
|
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
|
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||||
@ -50,10 +50,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
app_config &config_;
|
app_config &config_;
|
||||||
|
lock_data &lock_;
|
||||||
remote_winfsp_drive &drive_;
|
remote_winfsp_drive &drive_;
|
||||||
const std::vector<std::string> drive_args_;
|
const std::vector<std::string> drive_args_;
|
||||||
FileSystemHost host_;
|
FileSystemHost host_;
|
||||||
lock_data &lock_;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
auto OnStart(ULONG, PWSTR *) -> NTSTATUS override;
|
auto OnStart(ULONG, PWSTR *) -> NTSTATUS override;
|
||||||
@ -75,8 +75,8 @@ private:
|
|||||||
static void set_file_info(FileInfo &dest, const remote::file_info &src);
|
static void set_file_info(FileInfo &dest, const remote::file_info &src);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
auto CanDelete(PVOID file_node, PVOID file_desc, PWSTR file_name)
|
auto CanDelete(PVOID file_node, PVOID file_desc,
|
||||||
-> NTSTATUS override;
|
PWSTR file_name) -> NTSTATUS override;
|
||||||
|
|
||||||
VOID Cleanup(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
VOID Cleanup(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
||||||
ULONG flags) override;
|
ULONG flags) override;
|
||||||
@ -88,11 +88,11 @@ public:
|
|||||||
UINT64 allocation_size, PVOID *file_node, PVOID *file_desc,
|
UINT64 allocation_size, PVOID *file_node, PVOID *file_desc,
|
||||||
OpenFileInfo *ofi) -> NTSTATUS override;
|
OpenFileInfo *ofi) -> NTSTATUS override;
|
||||||
|
|
||||||
auto Flush(PVOID file_node, PVOID file_desc, FileInfo *file_info)
|
auto Flush(PVOID file_node, PVOID file_desc,
|
||||||
-> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
auto GetFileInfo(PVOID file_node, PVOID file_desc, FileInfo *file_info)
|
auto GetFileInfo(PVOID file_node, PVOID file_desc,
|
||||||
-> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
auto GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
auto GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
||||||
PSECURITY_DESCRIPTOR descriptor,
|
PSECURITY_DESCRIPTOR descriptor,
|
||||||
@ -107,8 +107,8 @@ public:
|
|||||||
auto Mounted(PVOID host) -> NTSTATUS override;
|
auto Mounted(PVOID host) -> NTSTATUS override;
|
||||||
|
|
||||||
auto Open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
auto Open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||||
PVOID *file_node, PVOID *file_desc, OpenFileInfo *ofi)
|
PVOID *file_node, PVOID *file_desc,
|
||||||
-> NTSTATUS override;
|
OpenFileInfo *ofi) -> NTSTATUS override;
|
||||||
|
|
||||||
auto Overwrite(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
auto Overwrite(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
||||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||||
@ -122,8 +122,8 @@ public:
|
|||||||
PULONG bytes_transferred) -> NTSTATUS override;
|
PULONG bytes_transferred) -> NTSTATUS override;
|
||||||
|
|
||||||
auto Rename(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
auto Rename(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
||||||
PWSTR new_file_name, BOOLEAN replace_if_exists)
|
PWSTR new_file_name,
|
||||||
-> NTSTATUS override;
|
BOOLEAN replace_if_exists) -> NTSTATUS override;
|
||||||
|
|
||||||
auto SetBasicInfo(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
auto SetBasicInfo(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
||||||
UINT64 creation_time, UINT64 last_access_time,
|
UINT64 creation_time, UINT64 last_access_time,
|
||||||
@ -131,15 +131,15 @@ public:
|
|||||||
FileInfo *file_info) -> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
auto SetFileSize(PVOID file_node, PVOID file_desc, UINT64 new_size,
|
auto SetFileSize(PVOID file_node, PVOID file_desc, UINT64 new_size,
|
||||||
BOOLEAN set_allocation_size, FileInfo *file_info)
|
BOOLEAN set_allocation_size,
|
||||||
-> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
VOID Unmounted(PVOID host) override;
|
VOID Unmounted(PVOID host) override;
|
||||||
|
|
||||||
auto Write(PVOID file_node, PVOID file_desc, PVOID buffer, UINT64 offset,
|
auto Write(PVOID file_node, PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||||
ULONG length, BOOLEAN write_to_end, BOOLEAN constrained_io,
|
ULONG length, BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||||
PULONG bytes_transferred, FileInfo *file_info)
|
PULONG bytes_transferred,
|
||||||
-> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
void shutdown() { ::GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); }
|
void shutdown() { ::GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); }
|
||||||
|
|
||||||
@ -152,4 +152,4 @@ public:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
|
#endif // INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
|
#ifndef INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
|
||||||
#define REPERTORY_INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
|
#define INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include "drives/eviction.hpp"
|
#include "drives/eviction.hpp"
|
||||||
@ -53,11 +53,11 @@ private:
|
|||||||
~winfsp_service() override = default;
|
~winfsp_service() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
app_config &config_;
|
|
||||||
winfsp_drive &drive_;
|
|
||||||
std::vector<std::string> drive_args_;
|
|
||||||
FileSystemHost host_;
|
|
||||||
lock_data &lock_;
|
lock_data &lock_;
|
||||||
|
winfsp_drive &drive_;
|
||||||
|
const std::vector<std::string> drive_args_;
|
||||||
|
FileSystemHost host_;
|
||||||
|
app_config &config_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
auto OnStart(ULONG, PWSTR *) -> NTSTATUS override;
|
auto OnStart(ULONG, PWSTR *) -> NTSTATUS override;
|
||||||
@ -75,28 +75,22 @@ private:
|
|||||||
std::unique_ptr<remote_winfsp::remote_server> remote_server_;
|
std::unique_ptr<remote_winfsp::remote_server> remote_server_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto handle_error(std::string_view function_name,
|
static auto
|
||||||
const std::string &api_path, api_error error,
|
parse_mount_location(const std::wstring &mount_location) -> std::string;
|
||||||
FileInfo *file_info, std::uint64_t file_size,
|
|
||||||
bool raise_on_failure_only = false) const
|
|
||||||
-> NTSTATUS;
|
|
||||||
|
|
||||||
static auto parse_mount_location(const std::wstring &mount_location)
|
|
||||||
-> std::string;
|
|
||||||
|
|
||||||
void populate_file_info(const std::string &api_path, std::uint64_t file_size,
|
void populate_file_info(const std::string &api_path, std::uint64_t file_size,
|
||||||
const api_meta_map &meta,
|
const api_meta_map &meta,
|
||||||
FSP_FSCTL_OPEN_FILE_INFO &ofi) const;
|
FSP_FSCTL_OPEN_FILE_INFO &ofi);
|
||||||
|
|
||||||
void populate_file_info(std::uint64_t file_size, api_meta_map meta,
|
void populate_file_info(std::uint64_t file_size, api_meta_map meta,
|
||||||
FSP_FSCTL_FILE_INFO &fi) const;
|
FSP_FSCTL_FILE_INFO &fi);
|
||||||
|
|
||||||
static void set_file_info(remote::file_info &dest,
|
static void set_file_info(remote::file_info &dest,
|
||||||
const FSP_FSCTL_FILE_INFO &src);
|
const FSP_FSCTL_FILE_INFO &src);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
auto CanDelete(PVOID file_node, PVOID file_desc, PWSTR file_name)
|
auto CanDelete(PVOID file_node, PVOID file_desc,
|
||||||
-> NTSTATUS override;
|
PWSTR file_name) -> NTSTATUS override;
|
||||||
|
|
||||||
VOID Cleanup(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
VOID Cleanup(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
||||||
ULONG flags) override;
|
ULONG flags) override;
|
||||||
@ -108,8 +102,8 @@ public:
|
|||||||
UINT64 allocation_size, PVOID *file_node, PVOID *file_desc,
|
UINT64 allocation_size, PVOID *file_node, PVOID *file_desc,
|
||||||
OpenFileInfo *ofi) -> NTSTATUS override;
|
OpenFileInfo *ofi) -> NTSTATUS override;
|
||||||
|
|
||||||
auto Flush(PVOID file_node, PVOID file_desc, FileInfo *file_info)
|
auto Flush(PVOID file_node, PVOID file_desc,
|
||||||
-> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
||||||
-> std::uint64_t override;
|
-> std::uint64_t override;
|
||||||
@ -117,25 +111,24 @@ public:
|
|||||||
[[nodiscard]] auto get_directory_items(const std::string &api_path) const
|
[[nodiscard]] auto get_directory_items(const std::string &api_path) const
|
||||||
-> directory_item_list override;
|
-> directory_item_list override;
|
||||||
|
|
||||||
auto GetFileInfo(PVOID file_node, PVOID file_desc, FileInfo *file_info)
|
auto GetFileInfo(PVOID file_node, PVOID file_desc,
|
||||||
-> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_size(const std::string &api_path) const
|
[[nodiscard]] auto
|
||||||
-> std::uint64_t override;
|
get_file_size(const std::string &api_path) const -> std::uint64_t override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
api_meta_map &meta) const
|
get_item_meta(const std::string &api_path,
|
||||||
-> api_error override;
|
api_meta_map &meta) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
const std::string &name,
|
get_item_meta(const std::string &api_path, const std::string &name,
|
||||||
std::string &value) const
|
std::string &value) const -> api_error override;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
[[nodiscard]] auto
|
||||||
PSECURITY_DESCRIPTOR descriptor,
|
get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||||
std::uint64_t *descriptor_size)
|
PSECURITY_DESCRIPTOR descriptor,
|
||||||
-> NTSTATUS override;
|
std::uint64_t *descriptor_size) -> NTSTATUS override;
|
||||||
|
|
||||||
auto GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
auto GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
||||||
PSECURITY_DESCRIPTOR descriptor,
|
PSECURITY_DESCRIPTOR descriptor,
|
||||||
@ -159,16 +152,16 @@ public:
|
|||||||
auto Mounted(PVOID host) -> NTSTATUS override;
|
auto Mounted(PVOID host) -> NTSTATUS override;
|
||||||
|
|
||||||
auto Open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
auto Open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||||
PVOID *file_node, PVOID *file_desc, OpenFileInfo *ofi)
|
PVOID *file_node, PVOID *file_desc,
|
||||||
-> NTSTATUS override;
|
OpenFileInfo *ofi) -> NTSTATUS override;
|
||||||
|
|
||||||
auto Overwrite(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
auto Overwrite(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
||||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||||
FileInfo *file_info) -> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
remote::file_info &file_info) const
|
populate_file_info(const std::string &api_path,
|
||||||
-> api_error override;
|
remote::file_info &file_info) -> api_error override;
|
||||||
|
|
||||||
auto Read(PVOID file_node, PVOID file_desc, PVOID buffer, UINT64 offset,
|
auto Read(PVOID file_node, PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||||
ULONG length, PULONG bytes_transferred) -> NTSTATUS override;
|
ULONG length, PULONG bytes_transferred) -> NTSTATUS override;
|
||||||
@ -178,8 +171,8 @@ public:
|
|||||||
PULONG bytes_transferred) -> NTSTATUS override;
|
PULONG bytes_transferred) -> NTSTATUS override;
|
||||||
|
|
||||||
auto Rename(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
auto Rename(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
||||||
PWSTR new_file_name, BOOLEAN replace_if_exists)
|
PWSTR new_file_name,
|
||||||
-> NTSTATUS override;
|
BOOLEAN replace_if_exists) -> NTSTATUS override;
|
||||||
|
|
||||||
auto SetBasicInfo(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
auto SetBasicInfo(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
||||||
UINT64 creation_time, UINT64 last_access_time,
|
UINT64 creation_time, UINT64 last_access_time,
|
||||||
@ -187,15 +180,15 @@ public:
|
|||||||
FileInfo *file_info) -> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
auto SetFileSize(PVOID file_node, PVOID file_desc, UINT64 new_size,
|
auto SetFileSize(PVOID file_node, PVOID file_desc, UINT64 new_size,
|
||||||
BOOLEAN set_allocation_size, FileInfo *file_info)
|
BOOLEAN set_allocation_size,
|
||||||
-> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
VOID Unmounted(PVOID host) override;
|
VOID Unmounted(PVOID host) override;
|
||||||
|
|
||||||
auto Write(PVOID file_node, PVOID file_desc, PVOID buffer, UINT64 offset,
|
auto Write(PVOID file_node, PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||||
ULONG length, BOOLEAN write_to_end, BOOLEAN constrained_io,
|
ULONG length, BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||||
PULONG bytes_transferred, FileInfo *file_info)
|
PULONG bytes_transferred,
|
||||||
-> NTSTATUS override;
|
FileInfo *file_info) -> NTSTATUS override;
|
||||||
|
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
@ -207,4 +200,4 @@ public:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
|
#endif // INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
#ifndef INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
#define INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
||||||
|
|
||||||
#include "events/event_system.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
@ -40,4 +40,4 @@ private:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
#endif // INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
#ifndef INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
#define INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
||||||
|
|
||||||
#include "events/event_system.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
@ -43,4 +43,4 @@ private:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
#endif // INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
#ifndef INCLUDE_EVENTS_EVENT_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
#define INCLUDE_EVENTS_EVENT_HPP_
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
enum class event_level {
|
enum class event_level {
|
||||||
@ -32,12 +32,9 @@ enum class event_level {
|
|||||||
trace,
|
trace,
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] auto
|
auto event_level_from_string(std::string level) -> event_level;
|
||||||
event_level_from_string(std::string level,
|
|
||||||
event_level default_level = event_level::info)
|
|
||||||
-> event_level;
|
|
||||||
|
|
||||||
[[nodiscard]] auto event_level_to_string(event_level level) -> std::string;
|
auto event_level_to_string(event_level level) -> std::string;
|
||||||
|
|
||||||
class event {
|
class event {
|
||||||
protected:
|
protected:
|
||||||
@ -75,18 +72,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
#endif // INCLUDE_EVENTS_EVENT_HPP_
|
||||||
template <> struct adl_serializer<std::atomic<repertory::event_level>> {
|
|
||||||
static void to_json(json &data,
|
|
||||||
const std::atomic<repertory::event_level> &value) {
|
|
||||||
data = repertory::event_level_to_string(value.load());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void from_json(const json &data,
|
|
||||||
std::atomic<repertory::event_level> &value) {
|
|
||||||
value.store(repertory::event_level_from_string(data.get<std::string>()));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
NLOHMANN_JSON_NAMESPACE_END
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
|
||||||
|
@ -19,32 +19,53 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
#ifndef INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
#define INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||||
|
|
||||||
#include "events/event.hpp"
|
#include "events/event.hpp"
|
||||||
#include "events/t_event_system.hpp"
|
#include "events/t_event_system.hpp"
|
||||||
|
#include "utils/string.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
using event_system = t_event_system<event>;
|
using event_system = t_event_system<event>;
|
||||||
using event_consumer = event_system::event_consumer;
|
using event_consumer = event_system::event_consumer;
|
||||||
|
|
||||||
#define E_FROM_API_FILE_ERROR(e) api_error_to_string(e)
|
#define E_CAST(t) ((std::string)t)
|
||||||
#define E_FROM_BOOL(t) std::to_string(t)
|
#define E_DOUBLE(d) std::to_string(d)
|
||||||
#define E_FROM_CURL_CODE(t) std::string(curl_easy_strerror(t))
|
#define E_DOUBLE_PRECISE(dbl_val) \
|
||||||
#define E_FROM_DOUBLE(d) std::to_string(d)
|
|
||||||
#define E_FROM_DOUBLE_PRECISE(dbl_val) \
|
|
||||||
([](const double &d) -> std::string { \
|
([](const double &d) -> std::string { \
|
||||||
std::stringstream ss; \
|
std::stringstream ss; \
|
||||||
ss << std::fixed << std::setprecision(2) << d; \
|
ss << std::fixed << std::setprecision(2) << d; \
|
||||||
return ss.str(); \
|
return ss.str(); \
|
||||||
})(dbl_val)
|
})(dbl_val)
|
||||||
|
#define E_FROM_BOOL(t) std::to_string(t)
|
||||||
|
#define E_FROM_EXCEPTION(e) std::string(e.what() ? e.what() : "")
|
||||||
#define E_FROM_INT32(t) std::to_string(t)
|
#define E_FROM_INT32(t) std::to_string(t)
|
||||||
#define E_FROM_SIZE_T(t) std::to_string(t)
|
#define E_FROM_INT64(t) std::to_string(t)
|
||||||
#define E_FROM_STRING(t) t
|
|
||||||
#define E_FROM_UINT16(t) std::to_string(t)
|
#define E_FROM_UINT16(t) std::to_string(t)
|
||||||
|
#define E_FROM_STRING_ARRAY(a) \
|
||||||
|
([](const auto &array) -> std::string { \
|
||||||
|
std::stringstream ret; \
|
||||||
|
for (const auto &item : array) { \
|
||||||
|
ret << (std::string(item) + " "); \
|
||||||
|
} \
|
||||||
|
return std::string(ret).TrimRight(); \
|
||||||
|
})(a)
|
||||||
|
|
||||||
|
#define E_PERCENT(d) \
|
||||||
|
([](const double &d) -> std::string { \
|
||||||
|
std::stringstream ss; \
|
||||||
|
ss << std::fixed << std::setprecision(2) << d; \
|
||||||
|
ss << "%"; \
|
||||||
|
return ss; \
|
||||||
|
})(d)
|
||||||
|
#define E_STRING(t) t
|
||||||
|
#define E_FROM_CURL_CODE(t) std::string(curl_easy_strerror(t))
|
||||||
|
#define E_FROM_UINT8(t) std::to_string(t)
|
||||||
|
#define E_FROM_UINT32(t) std::to_string(t)
|
||||||
#define E_FROM_UINT64(t) std::to_string(t)
|
#define E_FROM_UINT64(t) std::to_string(t)
|
||||||
#define E_FROM_DOWNLOAD_TYPE(t) download_type_to_string(t)
|
#define E_FROM_SIZE_T(t) std::to_string(t)
|
||||||
|
#define E_FROM_API_FILE_ERROR(e) api_error_to_string(e)
|
||||||
|
|
||||||
#define E_PROP(type, name, short_name, ts) \
|
#define E_PROP(type, name, short_name, ts) \
|
||||||
private: \
|
private: \
|
||||||
@ -238,4 +259,4 @@ private: \
|
|||||||
[this](const event &evt) { callback(evt); }))
|
[this](const event &evt) { callback(evt); }))
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
#endif // INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
|
#ifndef INCLUDE_EVENTS_EVENTS_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
|
#define INCLUDE_EVENTS_EVENTS_HPP_
|
||||||
|
|
||||||
#include "events/event_system.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -28,268 +28,274 @@
|
|||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
E_SIMPLE2(curl_error, error, true,
|
E_SIMPLE2(curl_error, info, true,
|
||||||
std::string, url, url, E_FROM_STRING,
|
std::string, url, url, E_STRING,
|
||||||
CURLcode, res, res, E_FROM_CURL_CODE
|
CURLcode, res, res, E_FROM_CURL_CODE
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(debug_log, debug, true,
|
E_SIMPLE3(debug_log, debug, true,
|
||||||
std::string, function, func, E_FROM_STRING,
|
std::string, function, func, E_STRING,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, data, data, E_FROM_STRING
|
std::string, data, data, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(directory_removed, info, true,
|
E_SIMPLE1(directory_removed, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(directory_removed_externally, warn, true,
|
E_SIMPLE2(directory_removed_externally, warn, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(directory_remove_failed, error, true,
|
E_SIMPLE2(directory_remove_failed, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, error, err, E_FROM_STRING
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(drive_mount_failed, error, true,
|
E_SIMPLE2(drive_mount_failed, error, true,
|
||||||
std::string, location, loc, E_FROM_STRING,
|
std::string, location, loc, E_STRING,
|
||||||
std::string, result, res, E_FROM_STRING
|
std::string, result, res, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(drive_mounted, info, true,
|
E_SIMPLE1(drive_mounted, info, true,
|
||||||
std::string, location, loc, E_FROM_STRING
|
std::string, location, loc, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(drive_mount_result, info, true,
|
E_SIMPLE1(drive_mount_result, info, true,
|
||||||
std::string, result, res, E_FROM_STRING
|
std::string, result, res, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(drive_unmount_pending, info, true,
|
E_SIMPLE1(drive_unmount_pending, info, true,
|
||||||
std::string, location, loc, E_FROM_STRING
|
std::string, location, loc, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(drive_unmounted, info, true,
|
E_SIMPLE1(drive_unmounted, info, true,
|
||||||
std::string, location, loc, E_FROM_STRING
|
std::string, location, loc, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(event_level_changed, info, true,
|
E_SIMPLE1(event_level_changed, info, true,
|
||||||
std::string, new_event_level, level, E_FROM_STRING
|
std::string, new_event_level, level, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(failed_upload_queued, error, true,
|
E_SIMPLE1(failed_upload_queued, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(failed_upload_removed, warn, true,
|
E_SIMPLE1(failed_upload_removed, warn, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(failed_upload_retry, info, true,
|
E_SIMPLE1(failed_upload_retry, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(file_get_failed, error, true,
|
E_SIMPLE2(file_get_failed, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, error, err, E_FROM_STRING
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(file_get_api_list_failed, error, true,
|
E_SIMPLE1(file_get_api_list_failed, error, true,
|
||||||
std::string, error, err, E_FROM_STRING
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(file_pinned, info, true,
|
E_SIMPLE1(file_pinned, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(file_read_bytes_failed, error, true,
|
E_SIMPLE3(file_read_bytes_failed, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, error, err, E_FROM_STRING,
|
std::string, error, err, E_STRING,
|
||||||
std::size_t, retry, retry, E_FROM_SIZE_T
|
std::size_t, retry, retry, E_FROM_SIZE_T
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(file_removed, debug, true,
|
E_SIMPLE1(file_removed, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(file_removed_externally, warn, true,
|
E_SIMPLE2(file_removed_externally, warn, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(file_remove_failed, error, true,
|
E_SIMPLE2(file_remove_failed, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, error, err, E_FROM_STRING
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(file_rename_failed, error, true,
|
E_SIMPLE3(file_rename_failed, error, true,
|
||||||
std::string, from_api_path, FROM, E_FROM_STRING,
|
std::string, from_api_path, FROM, E_STRING,
|
||||||
std::string, to_api_path, TO, E_FROM_STRING,
|
std::string, to_api_path, TO, E_STRING,
|
||||||
std::string, error, err, E_FROM_STRING
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(file_get_size_failed, error, true,
|
E_SIMPLE2(file_get_size_failed, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, error, err, E_FROM_STRING
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(filesystem_item_added, debug, true,
|
E_SIMPLE3(filesystem_item_added, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, parent, parent, E_FROM_STRING,
|
std::string, parent, parent, E_STRING,
|
||||||
bool, directory, dir, E_FROM_BOOL
|
bool, directory, dir, E_FROM_BOOL
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE4(filesystem_item_closed, trace, true,
|
E_SIMPLE4(filesystem_item_closed, trace, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
bool, directory, dir, E_FROM_BOOL,
|
bool, directory, dir, E_FROM_BOOL,
|
||||||
bool, changed, changed, E_FROM_BOOL
|
bool, changed, changed, E_FROM_BOOL
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE5(filesystem_item_handle_closed, trace, true,
|
E_SIMPLE5(filesystem_item_handle_closed, trace, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::uint64_t, handle, handle, E_FROM_UINT64,
|
std::uint64_t, handle, handle, E_FROM_UINT64,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
bool, directory, dir, E_FROM_BOOL,
|
bool, directory, dir, E_FROM_BOOL,
|
||||||
bool, changed, changed, E_FROM_BOOL
|
bool, changed, changed, E_FROM_BOOL
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE4(filesystem_item_handle_opened, trace, true,
|
E_SIMPLE4(filesystem_item_handle_opened, trace, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::uint64_t, handle, handle, E_FROM_UINT64,
|
std::uint64_t, handle, handle, E_FROM_UINT64,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
bool, directory, dir, E_FROM_BOOL
|
bool, directory, dir, E_FROM_BOOL
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(filesystem_item_evicted, info, true,
|
E_SIMPLE2(filesystem_item_evicted, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
|
);
|
||||||
|
|
||||||
|
E_SIMPLE2(filesystem_item_get_failed, error, true,
|
||||||
|
std::string, api_path, ap, E_STRING,
|
||||||
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(filesystem_item_opened, trace, true,
|
E_SIMPLE3(filesystem_item_opened, trace, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
bool, directory, dir, E_FROM_BOOL
|
bool, directory, dir, E_FROM_BOOL
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(file_unpinned, info, true,
|
E_SIMPLE1(file_unpinned, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE4(file_upload_completed, info, true,
|
E_SIMPLE4(file_upload_completed, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
api_error, result, res, E_FROM_API_FILE_ERROR,
|
api_error, result, res, E_FROM_API_FILE_ERROR,
|
||||||
bool, cancelled, cancel, E_FROM_BOOL
|
bool, cancelled, cancel, E_FROM_BOOL
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(file_upload_failed, error, true,
|
E_SIMPLE3(file_upload_failed, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
std::string, error, err, E_FROM_STRING
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(file_upload_not_found, warn, true,
|
E_SIMPLE2(file_upload_not_found, warn, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(file_upload_queued, info, true,
|
E_SIMPLE2(file_upload_queued, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(file_upload_removed, debug, true,
|
E_SIMPLE1(file_upload_removed, debug, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(file_upload_retry, info, true,
|
E_SIMPLE3(file_upload_retry, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
api_error, result, res, E_FROM_API_FILE_ERROR
|
api_error, result, res, E_FROM_API_FILE_ERROR
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(file_upload_started, info, true,
|
E_SIMPLE2(file_upload_started, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
|
E_SIMPLE(item_scan_begin, info, true);
|
||||||
|
|
||||||
|
E_SIMPLE(item_scan_end, info, true);
|
||||||
|
|
||||||
E_SIMPLE1(orphaned_file_deleted, warn, true,
|
E_SIMPLE1(orphaned_file_deleted, warn, true,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(orphaned_file_detected, warn, true,
|
E_SIMPLE1(orphaned_file_detected, warn, true,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
|
);
|
||||||
|
|
||||||
|
E_SIMPLE2(orphaned_file_processed, warn, true,
|
||||||
|
std::string, source, src, E_STRING,
|
||||||
|
std::string, dest, dest, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(orphaned_file_processing_failed, error, true,
|
E_SIMPLE3(orphaned_file_processing_failed, error, true,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
std::string, dest, dest, E_FROM_STRING,
|
std::string, dest, dest, E_STRING,
|
||||||
std::string, result, res, E_FROM_STRING
|
std::string, result, res, E_STRING
|
||||||
);
|
|
||||||
|
|
||||||
E_SIMPLE1(orphaned_source_file_detected, info, true,
|
|
||||||
std::string, source, src, E_FROM_STRING
|
|
||||||
);
|
|
||||||
|
|
||||||
E_SIMPLE1(orphaned_source_file_removed, info, true,
|
|
||||||
std::string, source, src, E_FROM_STRING
|
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(polling_item_begin, debug, true,
|
E_SIMPLE1(polling_item_begin, debug, true,
|
||||||
std::string, item_name, item, E_FROM_STRING
|
std::string, item_name, item, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(polling_item_end, debug, true,
|
E_SIMPLE1(polling_item_end, debug, true,
|
||||||
std::string, item_name, item, E_FROM_STRING
|
std::string, item_name, item, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(provider_offline, error, true,
|
E_SIMPLE2(provider_offline, error, true,
|
||||||
std::string, host_name_or_ip, host, E_FROM_STRING,
|
std::string, host_name_or_ip, host, E_STRING,
|
||||||
std::uint16_t, port, port, E_FROM_UINT16
|
std::uint16_t, port, port, E_FROM_UINT16
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(provider_upload_begin, info, true,
|
E_SIMPLE2(provider_upload_begin, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING
|
std::string, source, src, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(provider_upload_end, info, true,
|
E_SIMPLE3(provider_upload_end, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, source, src, E_FROM_STRING,
|
std::string, source, src, E_STRING,
|
||||||
api_error, result, res, E_FROM_API_FILE_ERROR
|
api_error, result, res, E_FROM_API_FILE_ERROR
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(repertory_exception, error, true,
|
E_SIMPLE2(repertory_exception, error, true,
|
||||||
std::string, function, func, E_FROM_STRING,
|
std::string, function, func, E_STRING,
|
||||||
std::string, message, msg, E_FROM_STRING
|
std::string, message, msg, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(rpc_server_exception, error, true,
|
E_SIMPLE1(rpc_server_exception, error, true,
|
||||||
std::string, exception, exception, E_FROM_STRING
|
std::string, exception, exception, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(service_shutdown_begin, debug, true,
|
E_SIMPLE1(service_shutdown_begin, debug, true,
|
||||||
std::string, service, svc, E_FROM_STRING
|
std::string, service, svc, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(service_shutdown_end, debug, true,
|
E_SIMPLE1(service_shutdown_end, debug, true,
|
||||||
std::string, service, svc, E_FROM_STRING
|
std::string, service, svc, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(service_started, debug, true,
|
E_SIMPLE1(service_started, debug, true,
|
||||||
std::string, service, svc, E_FROM_STRING
|
std::string, service, svc, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE(unmount_requested, info, true);
|
E_SIMPLE(unmount_requested, info, true);
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
E_SIMPLE2(unmount_result, info, true,
|
E_SIMPLE2(unmount_result, info, true,
|
||||||
std::string, location, loc, E_FROM_STRING,
|
std::string, location, loc, E_STRING,
|
||||||
std::string, result, res, E_FROM_STRING
|
std::string, result, res, E_STRING
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
// clang-format on
|
// clang-format on
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
|
#endif // INCLUDE_EVENTS_EVENTS_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
#ifndef INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
#define INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
||||||
|
|
||||||
#include "events/event.hpp"
|
#include "events/event.hpp"
|
||||||
#include "utils/collection.hpp"
|
#include "utils/collection.hpp"
|
||||||
@ -190,4 +190,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
#endif // INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_CACHE_SIZE_MGR_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_CACHE_SIZE_MGR_HPP_
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class app_config;
|
|
||||||
|
|
||||||
class cache_size_mgr final {
|
|
||||||
public:
|
|
||||||
cache_size_mgr(const cache_size_mgr &) = delete;
|
|
||||||
cache_size_mgr(cache_size_mgr &&) = delete;
|
|
||||||
auto operator=(const cache_size_mgr &) -> cache_size_mgr & = delete;
|
|
||||||
auto operator=(cache_size_mgr &&) -> cache_size_mgr & = delete;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
cache_size_mgr() = default;
|
|
||||||
|
|
||||||
~cache_size_mgr() { stop(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
static cache_size_mgr instance_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
app_config *cfg_{nullptr};
|
|
||||||
std::uint64_t cache_size_{0U};
|
|
||||||
mutable std::mutex mtx_;
|
|
||||||
std::condition_variable notify_;
|
|
||||||
stop_type stop_requested_{false};
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] auto expand(std::uint64_t size) -> api_error;
|
|
||||||
|
|
||||||
void initialize(app_config *cfg);
|
|
||||||
|
|
||||||
[[nodiscard]] static auto instance() -> cache_size_mgr & { return instance_; }
|
|
||||||
|
|
||||||
[[nodiscard]] auto shrink(std::uint64_t size) -> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto size() const -> std::uint64_t;
|
|
||||||
|
|
||||||
void stop();
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_CACHE_SIZE_MGR_HPP_
|
|
@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_DIRECT_OPEN_FILE_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_DIRECT_OPEN_FILE_HPP_
|
|
||||||
|
|
||||||
#include "file_manager/ring_buffer_base.hpp"
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_provider;
|
|
||||||
class i_upload_manager;
|
|
||||||
|
|
||||||
class direct_open_file final : public ring_buffer_base {
|
|
||||||
public:
|
|
||||||
direct_open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
|
||||||
filesystem_item fsi, i_provider &provider);
|
|
||||||
|
|
||||||
~direct_open_file() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
direct_open_file() = delete;
|
|
||||||
direct_open_file(const direct_open_file &) noexcept = delete;
|
|
||||||
direct_open_file(direct_open_file &&) noexcept = delete;
|
|
||||||
auto operator=(direct_open_file &&) noexcept -> direct_open_file & = delete;
|
|
||||||
auto
|
|
||||||
operator=(const direct_open_file &) noexcept -> direct_open_file & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::array<data_buffer, min_ring_size> ring_data_;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
[[nodiscard]] auto on_check_start() -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
on_chunk_downloaded(std::size_t /* chunk */,
|
|
||||||
const data_buffer & /* buffer */) -> api_error override {
|
|
||||||
return api_error::success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
on_read_chunk(std::size_t chunk, std::size_t read_size,
|
|
||||||
std::uint64_t read_offset, data_buffer &data,
|
|
||||||
std::size_t &bytes_read) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto use_buffer(std::size_t chunk,
|
|
||||||
std::function<api_error(data_buffer &)> func)
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] auto native_operation(native_operation_callback /* callback */)
|
|
||||||
-> api_error override {
|
|
||||||
return api_error::not_supported;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto native_operation(std::uint64_t /* new_file_size */,
|
|
||||||
native_operation_callback /* callback */)
|
|
||||||
-> api_error override {
|
|
||||||
return api_error::not_supported;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_DIRECT_OPEN_FILE_HPP_
|
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_
|
#ifndef INCLUDE_FILE_MANAGER_EVENTS_HPP_
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_
|
#define INCLUDE_FILE_MANAGER_EVENTS_HPP_
|
||||||
|
|
||||||
#include "events/events.hpp"
|
#include "events/events.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -28,59 +28,75 @@
|
|||||||
namespace repertory {
|
namespace repertory {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
E_SIMPLE2(download_begin, info, true,
|
E_SIMPLE2(download_begin, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, dest_path, dest, E_FROM_STRING
|
std::string, dest_path, dest, E_STRING
|
||||||
|
);
|
||||||
|
|
||||||
|
E_SIMPLE5(download_chunk_begin, debug, true,
|
||||||
|
std::string, api_path, ap, E_STRING,
|
||||||
|
std::string, dest_path, dest, E_STRING,
|
||||||
|
std::size_t, chunk, chunk, E_FROM_SIZE_T,
|
||||||
|
std::size_t, total, total, E_FROM_SIZE_T,
|
||||||
|
std::size_t, complete, complete, E_FROM_SIZE_T
|
||||||
|
);
|
||||||
|
|
||||||
|
E_SIMPLE6(download_chunk_end, debug, true,
|
||||||
|
std::string, api_path, ap, E_STRING,
|
||||||
|
std::string, dest_path, dest, E_STRING,
|
||||||
|
std::size_t, chunk, chunk, E_FROM_SIZE_T,
|
||||||
|
std::size_t, total, total, E_FROM_SIZE_T,
|
||||||
|
std::size_t, complete, complete, E_FROM_SIZE_T,
|
||||||
|
api_error, result, result, E_FROM_API_FILE_ERROR
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(download_end, info, true,
|
E_SIMPLE3(download_end, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, dest_path, dest, E_FROM_STRING,
|
std::string, dest_path, dest, E_STRING,
|
||||||
api_error, result, result, E_FROM_API_FILE_ERROR
|
api_error, result, result, E_FROM_API_FILE_ERROR
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(download_progress, info, true,
|
E_SIMPLE3(download_progress, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, dest_path, dest, E_FROM_STRING,
|
std::string, dest_path, dest, E_STRING,
|
||||||
double, progress, prog, E_FROM_DOUBLE_PRECISE
|
double, progress, prog, E_DOUBLE_PRECISE
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(download_restored, info, true,
|
E_SIMPLE2(download_restored, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, dest_path, dest, E_FROM_STRING
|
std::string, dest_path, dest, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(download_restore_failed, error, true,
|
E_SIMPLE3(download_restore_failed, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, dest_path, dest, E_FROM_STRING,
|
std::string, dest_path, dest, E_STRING,
|
||||||
std::string, error, err, E_FROM_STRING
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(download_resume_add_failed, error, true,
|
E_SIMPLE2(download_resumed, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, dest_path, dest, E_FROM_STRING,
|
std::string, dest_path, dest, E_STRING
|
||||||
std::string, error, err, E_FROM_STRING
|
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(download_resume_added, debug, true,
|
E_SIMPLE2(download_stored, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, dest_path, dest, E_FROM_STRING
|
std::string, dest_path, dest, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE2(download_resume_removed, debug, true,
|
E_SIMPLE2(download_stored_removed, info, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING,
|
||||||
std::string, dest_path, dest, E_FROM_STRING
|
std::string, dest_path, dest, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE1(item_timeout, trace, true,
|
E_SIMPLE3(download_stored_failed, error, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING
|
std::string, api_path, ap, E_STRING,
|
||||||
|
std::string, dest_path, dest, E_STRING,
|
||||||
|
std::string, error, err, E_STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
E_SIMPLE3(download_type_selected, debug, true,
|
E_SIMPLE1(item_timeout, debug, true,
|
||||||
std::string, api_path, ap, E_FROM_STRING,
|
std::string, api_path, ap, E_STRING
|
||||||
std::string, source, src, E_FROM_STRING,
|
|
||||||
download_type, download_type, type, E_FROM_DOWNLOAD_TYPE
|
|
||||||
);
|
);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_
|
#endif // INCLUDE_FILE_MANAGER_EVENTS_HPP_
|
||||||
|
@ -19,16 +19,16 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
#ifndef INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
#define INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
||||||
|
|
||||||
#include "db/i_file_mgr_db.hpp"
|
#include "database/db_common.hpp"
|
||||||
#include "events/event_system.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/events.hpp"
|
#include "events/events.hpp"
|
||||||
#include "file_manager/i_file_manager.hpp"
|
#include "file_manager/i_file_manager.hpp"
|
||||||
#include "file_manager/i_open_file.hpp"
|
#include "file_manager/i_open_file.hpp"
|
||||||
#include "file_manager/i_upload_manager.hpp"
|
#include "file_manager/i_upload_manager.hpp"
|
||||||
#include "file_manager/upload.hpp"
|
#include "platform/platform.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
#include "utils/file.hpp"
|
#include "utils/file.hpp"
|
||||||
|
|
||||||
@ -39,6 +39,402 @@ class i_provider;
|
|||||||
class file_manager final : public i_file_manager, public i_upload_manager {
|
class file_manager final : public i_file_manager, public i_upload_manager {
|
||||||
E_CONSUMER();
|
E_CONSUMER();
|
||||||
|
|
||||||
|
public:
|
||||||
|
class open_file_base : public i_closeable_open_file {
|
||||||
|
public:
|
||||||
|
open_file_base(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
||||||
|
filesystem_item fsi, i_provider &provider);
|
||||||
|
|
||||||
|
open_file_base(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
||||||
|
filesystem_item fsi,
|
||||||
|
std::map<std::uint64_t, open_file_data> open_data,
|
||||||
|
i_provider &provider);
|
||||||
|
|
||||||
|
~open_file_base() override = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
open_file_base() = delete;
|
||||||
|
open_file_base(const open_file_base &) noexcept = delete;
|
||||||
|
open_file_base(open_file_base &&) noexcept = delete;
|
||||||
|
auto operator=(open_file_base &&) noexcept -> open_file_base & = delete;
|
||||||
|
auto
|
||||||
|
operator=(const open_file_base &) noexcept -> open_file_base & = delete;
|
||||||
|
|
||||||
|
public:
|
||||||
|
class download final {
|
||||||
|
public:
|
||||||
|
download() = default;
|
||||||
|
|
||||||
|
~download() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
download(const download &) noexcept = delete;
|
||||||
|
download(download &&) noexcept = delete;
|
||||||
|
auto operator=(download &&) noexcept -> download & = delete;
|
||||||
|
auto operator=(const download &) noexcept -> download & = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool complete_{false};
|
||||||
|
api_error error_{api_error::success};
|
||||||
|
std::mutex mtx_;
|
||||||
|
std::condition_variable notify_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void notify(const api_error &err);
|
||||||
|
|
||||||
|
auto wait() -> api_error;
|
||||||
|
};
|
||||||
|
|
||||||
|
class io_item final {
|
||||||
|
public:
|
||||||
|
io_item(std::function<api_error()> action) : action_(std::move(action)) {}
|
||||||
|
|
||||||
|
~io_item() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
io_item() = delete;
|
||||||
|
io_item(const io_item &) noexcept = delete;
|
||||||
|
io_item(io_item &&) noexcept = delete;
|
||||||
|
auto operator=(io_item &&) noexcept -> io_item & = delete;
|
||||||
|
auto operator=(const io_item &) noexcept -> io_item & = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::function<api_error()> action_;
|
||||||
|
std::mutex mtx_;
|
||||||
|
std::condition_variable notify_;
|
||||||
|
std::optional<api_error> result_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void action();
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_result() -> api_error;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::uint64_t chunk_size_;
|
||||||
|
std::uint8_t chunk_timeout_;
|
||||||
|
filesystem_item fsi_;
|
||||||
|
std::size_t last_chunk_size_;
|
||||||
|
std::map<std::uint64_t, open_file_data> open_data_;
|
||||||
|
i_provider &provider_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
api_error error_{api_error::success};
|
||||||
|
mutable std::mutex error_mtx_;
|
||||||
|
stop_type io_stop_requested_{false};
|
||||||
|
std::unique_ptr<std::thread> io_thread_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::unordered_map<std::size_t, std::shared_ptr<download>>
|
||||||
|
active_downloads_;
|
||||||
|
mutable std::recursive_mutex file_mtx_;
|
||||||
|
std::atomic<std::chrono::system_clock::time_point> last_access_{
|
||||||
|
std::chrono::system_clock::now()};
|
||||||
|
bool modified_{false};
|
||||||
|
std::unique_ptr<utils::file::i_file> nf_;
|
||||||
|
mutable std::mutex io_thread_mtx_;
|
||||||
|
std::condition_variable io_thread_notify_;
|
||||||
|
std::deque<std::shared_ptr<io_item>> io_thread_queue_;
|
||||||
|
bool removed_{false};
|
||||||
|
|
||||||
|
private:
|
||||||
|
void file_io_thread();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
[[nodiscard]] auto do_io(std::function<api_error()> action) -> api_error;
|
||||||
|
|
||||||
|
virtual auto is_download_complete() const -> bool = 0;
|
||||||
|
|
||||||
|
void reset_timeout();
|
||||||
|
|
||||||
|
auto set_api_error(const api_error &e) -> api_error;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void add(std::uint64_t handle, open_file_data ofd) override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto can_close() const -> bool override;
|
||||||
|
|
||||||
|
auto close() -> bool override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_api_error() const -> api_error;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_api_path() const -> std::string override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_chunk_size() const -> std::size_t override {
|
||||||
|
return chunk_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_file_size() const -> std::uint64_t override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_filesystem_item() const -> filesystem_item override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_handles() const -> std::vector<std::uint64_t> override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_open_data() const -> std::map<std::uint64_t, open_file_data> override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_open_data(std::uint64_t handle) const -> open_file_data override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_open_file_count() const -> std::size_t override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_source_path() const -> std::string override {
|
||||||
|
return fsi_.source_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto has_handle(std::uint64_t handle) const -> bool override {
|
||||||
|
return open_data_.find(handle) != open_data_.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto is_directory() const -> bool override {
|
||||||
|
return fsi_.directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto is_modified() const -> bool override;
|
||||||
|
|
||||||
|
void remove(std::uint64_t handle) override;
|
||||||
|
|
||||||
|
void set_api_path(const std::string &api_path) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class open_file final : public open_file_base {
|
||||||
|
public:
|
||||||
|
open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
||||||
|
filesystem_item fsi, i_provider &provider, i_upload_manager &mgr);
|
||||||
|
|
||||||
|
open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
||||||
|
filesystem_item fsi,
|
||||||
|
std::map<std::uint64_t, open_file_data> open_data,
|
||||||
|
i_provider &provider, i_upload_manager &mgr);
|
||||||
|
|
||||||
|
open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
||||||
|
filesystem_item fsi, i_provider &provider,
|
||||||
|
std::optional<boost::dynamic_bitset<>> read_state,
|
||||||
|
i_upload_manager &mgr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
||||||
|
filesystem_item fsi,
|
||||||
|
std::map<std::uint64_t, open_file_data> open_data,
|
||||||
|
i_provider &provider,
|
||||||
|
std::optional<boost::dynamic_bitset<>> read_state,
|
||||||
|
i_upload_manager &mgr);
|
||||||
|
|
||||||
|
public:
|
||||||
|
open_file() = delete;
|
||||||
|
open_file(const open_file &) noexcept = delete;
|
||||||
|
open_file(open_file &&) noexcept = delete;
|
||||||
|
auto operator=(open_file &&) noexcept -> open_file & = delete;
|
||||||
|
auto operator=(const open_file &) noexcept -> open_file & = delete;
|
||||||
|
|
||||||
|
public:
|
||||||
|
~open_file() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
i_upload_manager &mgr_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool notified_ = false;
|
||||||
|
std::size_t read_chunk_index_{};
|
||||||
|
boost::dynamic_bitset<> read_state_;
|
||||||
|
std::unique_ptr<std::thread> reader_thread_;
|
||||||
|
std::unique_ptr<std::thread> download_thread_;
|
||||||
|
stop_type stop_requested_ = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void download_chunk(std::size_t chunk, bool skip_active, bool should_reset);
|
||||||
|
|
||||||
|
void download_range(std::size_t start_chunk_index,
|
||||||
|
std::size_t end_chunk_index_inclusive,
|
||||||
|
bool should_reset);
|
||||||
|
|
||||||
|
void set_modified();
|
||||||
|
|
||||||
|
void update_background_reader(std::size_t read_chunk);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
auto is_download_complete() const -> bool override {
|
||||||
|
return read_state_.all();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
auto close() -> bool override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_read_state() const -> boost::dynamic_bitset<> override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_read_state(std::size_t chunk) const -> bool override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto is_complete() const -> bool override;
|
||||||
|
|
||||||
|
auto is_write_supported() const -> bool override { return true; }
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
native_operation(native_operation_callback callback) -> api_error override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
native_operation(std::uint64_t new_file_size,
|
||||||
|
native_operation_callback callback) -> api_error override;
|
||||||
|
|
||||||
|
void remove(std::uint64_t handle) override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto read(std::size_t read_size, std::uint64_t read_offset,
|
||||||
|
data_buffer &data) -> api_error override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
resize(std::uint64_t new_file_size) -> api_error override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto write(std::uint64_t write_offset,
|
||||||
|
const data_buffer &data,
|
||||||
|
std::size_t &bytes_written) -> api_error override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ring_buffer_open_file final : public open_file_base {
|
||||||
|
public:
|
||||||
|
ring_buffer_open_file(std::string buffer_directory,
|
||||||
|
std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
||||||
|
filesystem_item fsi, i_provider &provider);
|
||||||
|
|
||||||
|
ring_buffer_open_file(std::string buffer_directory,
|
||||||
|
std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
||||||
|
filesystem_item fsi, i_provider &provider,
|
||||||
|
std::size_t ring_size);
|
||||||
|
|
||||||
|
~ring_buffer_open_file() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ring_buffer_open_file() = delete;
|
||||||
|
ring_buffer_open_file(const ring_buffer_open_file &) noexcept = delete;
|
||||||
|
ring_buffer_open_file(ring_buffer_open_file &&) noexcept = delete;
|
||||||
|
auto operator=(ring_buffer_open_file &&) noexcept
|
||||||
|
-> ring_buffer_open_file & = delete;
|
||||||
|
auto operator=(const ring_buffer_open_file &) noexcept
|
||||||
|
-> ring_buffer_open_file & = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::dynamic_bitset<> ring_state_;
|
||||||
|
std::size_t total_chunks_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<std::thread> chunk_forward_thread_;
|
||||||
|
std::unique_ptr<std::thread> chunk_reverse_thread_;
|
||||||
|
std::condition_variable chunk_notify_;
|
||||||
|
mutable std::mutex chunk_mtx_;
|
||||||
|
std::size_t current_chunk_{};
|
||||||
|
std::size_t first_chunk_{};
|
||||||
|
std::size_t last_chunk_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
auto download_chunk(std::size_t chunk) -> api_error;
|
||||||
|
|
||||||
|
void forward_reader_thread(std::size_t count);
|
||||||
|
|
||||||
|
void reverse_reader_thread(std::size_t count);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
auto is_download_complete() const -> bool override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void forward(std::size_t count);
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_current_chunk() const -> std::size_t {
|
||||||
|
return current_chunk_;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_first_chunk() const -> std::size_t {
|
||||||
|
return first_chunk_;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_last_chunk() const -> std::size_t {
|
||||||
|
return last_chunk_;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_read_state() const -> boost::dynamic_bitset<> override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_read_state(std::size_t chunk) const -> bool override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_total_chunks() const -> std::size_t {
|
||||||
|
return total_chunks_;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto is_complete() const -> bool override { return true; }
|
||||||
|
|
||||||
|
auto is_write_supported() const -> bool override { return false; }
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
native_operation(native_operation_callback callback) -> api_error override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
native_operation(std::uint64_t,
|
||||||
|
native_operation_callback) -> api_error override {
|
||||||
|
return api_error::not_supported;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto read(std::size_t read_size, std::uint64_t read_offset,
|
||||||
|
data_buffer &data) -> api_error override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto resize(std::uint64_t) -> api_error override {
|
||||||
|
return api_error::not_supported;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reverse(std::size_t count);
|
||||||
|
|
||||||
|
void set(std::size_t first_chunk, std::size_t current_chunk);
|
||||||
|
|
||||||
|
void set_api_path(const std::string &api_path) override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto write(std::uint64_t, const data_buffer &,
|
||||||
|
std::size_t &) -> api_error override {
|
||||||
|
return api_error::not_supported;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class upload final {
|
||||||
|
public:
|
||||||
|
upload(filesystem_item fsi, i_provider &provider);
|
||||||
|
|
||||||
|
~upload();
|
||||||
|
|
||||||
|
public:
|
||||||
|
upload() = delete;
|
||||||
|
upload(const upload &) noexcept = delete;
|
||||||
|
upload(upload &&) noexcept = delete;
|
||||||
|
auto operator=(upload &&) noexcept -> upload & = delete;
|
||||||
|
auto operator=(const upload &) noexcept -> upload & = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
filesystem_item fsi_;
|
||||||
|
i_provider &provider_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool cancelled_ = false;
|
||||||
|
api_error error_ = api_error::success;
|
||||||
|
std::unique_ptr<std::thread> thread_;
|
||||||
|
stop_type stop_requested_ = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void upload_thread();
|
||||||
|
|
||||||
|
public:
|
||||||
|
void cancel();
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_api_error() const -> api_error { return error_; }
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_api_path() const -> std::string {
|
||||||
|
return fsi_.api_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_source_path() const -> std::string {
|
||||||
|
return fsi_.source_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto is_cancelled() const -> bool { return cancelled_; }
|
||||||
|
|
||||||
|
void stop();
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
file_manager(app_config &config, i_provider &provider);
|
file_manager(app_config &config, i_provider &provider);
|
||||||
|
|
||||||
@ -56,8 +452,8 @@ private:
|
|||||||
i_provider &provider_;
|
i_provider &provider_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<i_file_mgr_db> mgr_db_;
|
db::db3_t db_{nullptr};
|
||||||
std::atomic<std::uint64_t> next_handle_{0U};
|
std::uint64_t next_handle_{0U};
|
||||||
mutable std::recursive_mutex open_file_mtx_;
|
mutable std::recursive_mutex open_file_mtx_;
|
||||||
std::unordered_map<std::string, std::shared_ptr<i_closeable_open_file>>
|
std::unordered_map<std::string, std::shared_ptr<i_closeable_open_file>>
|
||||||
open_file_lookup_;
|
open_file_lookup_;
|
||||||
@ -68,8 +464,6 @@ private:
|
|||||||
std::unique_ptr<std::thread> upload_thread_;
|
std::unique_ptr<std::thread> upload_thread_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto close_all(const std::string &api_path) -> bool;
|
|
||||||
|
|
||||||
void close_timed_out_files();
|
void close_timed_out_files();
|
||||||
|
|
||||||
auto get_open_file_by_handle(std::uint64_t handle) const
|
auto get_open_file_by_handle(std::uint64_t handle) const
|
||||||
@ -85,13 +479,9 @@ private:
|
|||||||
void queue_upload(const std::string &api_path, const std::string &source_path,
|
void queue_upload(const std::string &api_path, const std::string &source_path,
|
||||||
bool no_lock);
|
bool no_lock);
|
||||||
|
|
||||||
void remove_resume(const std::string &api_path,
|
|
||||||
const std::string &source_path, bool no_lock);
|
|
||||||
|
|
||||||
void remove_upload(const std::string &api_path, bool no_lock);
|
void remove_upload(const std::string &api_path, bool no_lock);
|
||||||
|
|
||||||
void swap_renamed_items(std::string from_api_path, std::string to_api_path,
|
void swap_renamed_items(std::string from_api_path, std::string to_api_path);
|
||||||
bool directory);
|
|
||||||
|
|
||||||
void upload_completed(const file_upload_completed &evt);
|
void upload_completed(const file_upload_completed &evt);
|
||||||
|
|
||||||
@ -108,11 +498,6 @@ public:
|
|||||||
void remove_resume(const std::string &api_path,
|
void remove_resume(const std::string &api_path,
|
||||||
const std::string &source_path) override;
|
const std::string &source_path) override;
|
||||||
|
|
||||||
static auto remove_source_and_shrink_cache(const std::string &api_path,
|
|
||||||
const std::string &source_path,
|
|
||||||
std::uint64_t file_size,
|
|
||||||
bool allocated) -> bool;
|
|
||||||
|
|
||||||
void remove_upload(const std::string &api_path) override;
|
void remove_upload(const std::string &api_path) override;
|
||||||
|
|
||||||
void store_resume(const i_open_file &file) override;
|
void store_resume(const i_open_file &file) override;
|
||||||
@ -120,6 +505,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
void close(std::uint64_t handle);
|
void close(std::uint64_t handle);
|
||||||
|
|
||||||
|
void close_all(const std::string &api_path);
|
||||||
|
|
||||||
[[nodiscard]] auto create(const std::string &api_path, api_meta_map &meta,
|
[[nodiscard]] auto create(const std::string &api_path, api_meta_map &meta,
|
||||||
open_file_data ofd, std::uint64_t &handle,
|
open_file_data ofd, std::uint64_t &handle,
|
||||||
std::shared_ptr<i_open_file> &file) -> api_error;
|
std::shared_ptr<i_open_file> &file) -> api_error;
|
||||||
@ -139,37 +526,38 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] auto get_open_handle_count() const -> std::size_t;
|
[[nodiscard]] auto get_open_handle_count() const -> std::size_t;
|
||||||
|
|
||||||
[[nodiscard]] auto get_stored_downloads() const
|
[[nodiscard]] auto get_stored_downloads() const -> std::vector<json>;
|
||||||
-> std::vector<i_file_mgr_db::resume_entry>;
|
|
||||||
|
|
||||||
[[nodiscard]] auto has_no_open_file_handles() const -> bool override;
|
[[nodiscard]] auto has_no_open_file_handles() const -> bool override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_processing(const std::string &api_path) const
|
[[nodiscard]] auto
|
||||||
-> bool override;
|
is_processing(const std::string &api_path) const -> bool override;
|
||||||
|
|
||||||
#if defined(PROJECT_TESTING)
|
#if defined(PROJECT_TESTING)
|
||||||
[[nodiscard]] auto open(std::shared_ptr<i_closeable_open_file> of,
|
[[nodiscard]] auto open(std::shared_ptr<i_closeable_open_file> of,
|
||||||
const open_file_data &ofd, std::uint64_t &handle,
|
const open_file_data &ofd, std::uint64_t &handle,
|
||||||
std::shared_ptr<i_open_file> &file) -> api_error;
|
std::shared_ptr<i_open_file> &file) -> api_error;
|
||||||
#endif // defined(PROJECT_TESTING)
|
#endif
|
||||||
[[nodiscard]] auto open(const std::string &api_path, bool directory,
|
[[nodiscard]] auto open(const std::string &api_path, bool directory,
|
||||||
const open_file_data &ofd, std::uint64_t &handle,
|
const open_file_data &ofd, std::uint64_t &handle,
|
||||||
std::shared_ptr<i_open_file> &file) -> api_error;
|
std::shared_ptr<i_open_file> &file) -> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto remove_file(const std::string &api_path) -> api_error;
|
[[nodiscard]] auto remove_file(const std::string &api_path) -> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto rename_directory(const std::string &from_api_path,
|
[[nodiscard]] auto
|
||||||
const std::string &to_api_path)
|
rename_directory(const std::string &from_api_path,
|
||||||
-> api_error;
|
const std::string &to_api_path) -> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto rename_file(const std::string &from_api_path,
|
[[nodiscard]] auto rename_file(const std::string &from_api_path,
|
||||||
const std::string &to_api_path, bool overwrite)
|
const std::string &to_api_path,
|
||||||
-> api_error;
|
bool overwrite) -> api_error;
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
|
void update_used_space(std::uint64_t &used_space) const override;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
#endif // INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_
|
#ifndef INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_
|
#define INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
@ -45,7 +45,9 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] virtual auto is_processing(const std::string &api_path) const
|
[[nodiscard]] virtual auto is_processing(const std::string &api_path) const
|
||||||
-> bool = 0;
|
-> bool = 0;
|
||||||
|
|
||||||
|
virtual void update_used_space(std::uint64_t &used_space) const = 0;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_
|
#endif // INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_
|
#ifndef INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_
|
#define INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
@ -40,17 +40,11 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] virtual auto get_filesystem_item() const -> filesystem_item = 0;
|
[[nodiscard]] virtual auto get_filesystem_item() const -> filesystem_item = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_open_data()
|
|
||||||
-> std::map<std::uint64_t, open_file_data> & = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_open_data() const
|
[[nodiscard]] virtual auto get_open_data() const
|
||||||
-> const std::map<std::uint64_t, open_file_data> & = 0;
|
-> std::map<std::uint64_t, open_file_data> = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_open_data(std::uint64_t handle)
|
|
||||||
-> open_file_data & = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_open_data(std::uint64_t handle) const
|
[[nodiscard]] virtual auto get_open_data(std::uint64_t handle) const
|
||||||
-> const open_file_data & = 0;
|
-> open_file_data = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_open_file_count() const -> std::size_t = 0;
|
[[nodiscard]] virtual auto get_open_file_count() const -> std::size_t = 0;
|
||||||
|
|
||||||
@ -62,12 +56,8 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] virtual auto get_source_path() const -> std::string = 0;
|
[[nodiscard]] virtual auto get_source_path() const -> std::string = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto is_complete() const -> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto is_directory() const -> bool = 0;
|
[[nodiscard]] virtual auto is_directory() const -> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto is_write_supported() const -> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto has_handle(std::uint64_t handle) const -> bool = 0;
|
[[nodiscard]] virtual auto has_handle(std::uint64_t handle) const -> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
@ -97,8 +87,6 @@ class i_closeable_open_file : public i_open_file {
|
|||||||
public:
|
public:
|
||||||
virtual void add(std::uint64_t handle, open_file_data ofd) = 0;
|
virtual void add(std::uint64_t handle, open_file_data ofd) = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_allocated() const -> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto can_close() const -> bool = 0;
|
[[nodiscard]] virtual auto can_close() const -> bool = 0;
|
||||||
|
|
||||||
virtual auto close() -> bool = 0;
|
virtual auto close() -> bool = 0;
|
||||||
@ -106,12 +94,14 @@ public:
|
|||||||
[[nodiscard]] virtual auto get_handles() const
|
[[nodiscard]] virtual auto get_handles() const
|
||||||
-> std::vector<std::uint64_t> = 0;
|
-> std::vector<std::uint64_t> = 0;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual auto is_complete() const -> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto is_modified() const -> bool = 0;
|
[[nodiscard]] virtual auto is_modified() const -> bool = 0;
|
||||||
|
|
||||||
virtual void remove(std::uint64_t handle) = 0;
|
[[nodiscard]] virtual auto is_write_supported() const -> bool = 0;
|
||||||
|
|
||||||
virtual void remove_all() = 0;
|
virtual void remove(std::uint64_t handle) = 0;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_
|
#endif // INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_
|
#ifndef INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_
|
#define INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
class i_open_file;
|
class i_open_file;
|
||||||
@ -29,15 +29,15 @@ class i_upload_manager {
|
|||||||
INTERFACE_SETUP(i_upload_manager);
|
INTERFACE_SETUP(i_upload_manager);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void queue_upload(const i_open_file &file) = 0;
|
virtual void queue_upload(const i_open_file &o) = 0;
|
||||||
|
|
||||||
virtual void remove_resume(const std::string &api_path,
|
virtual void remove_resume(const std::string &api_path,
|
||||||
const std::string &source_path) = 0;
|
const std::string &source_path) = 0;
|
||||||
|
|
||||||
virtual void remove_upload(const std::string &api_path) = 0;
|
virtual void remove_upload(const std::string &api_path) = 0;
|
||||||
|
|
||||||
virtual void store_resume(const i_open_file &file) = 0;
|
virtual void store_resume(const i_open_file &o) = 0;
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_
|
#endif // INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_
|
||||||
|
@ -1,135 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_OPEN_FILE_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_OPEN_FILE_HPP_
|
|
||||||
|
|
||||||
#include "file_manager/open_file_base.hpp"
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
#include "utils/types/file/i_file.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_provider;
|
|
||||||
class i_upload_manager;
|
|
||||||
|
|
||||||
class open_file final : public open_file_base {
|
|
||||||
public:
|
|
||||||
open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
|
||||||
filesystem_item fsi, i_provider &provider, i_upload_manager &mgr);
|
|
||||||
|
|
||||||
open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
|
||||||
filesystem_item fsi,
|
|
||||||
std::map<std::uint64_t, open_file_data> open_data,
|
|
||||||
i_provider &provider, i_upload_manager &mgr);
|
|
||||||
|
|
||||||
open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
|
||||||
filesystem_item fsi, i_provider &provider,
|
|
||||||
std::optional<boost::dynamic_bitset<>> read_state,
|
|
||||||
i_upload_manager &mgr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
open_file(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
|
||||||
filesystem_item fsi,
|
|
||||||
std::map<std::uint64_t, open_file_data> open_data,
|
|
||||||
i_provider &provider,
|
|
||||||
std::optional<boost::dynamic_bitset<>> read_state,
|
|
||||||
i_upload_manager &mgr);
|
|
||||||
|
|
||||||
public:
|
|
||||||
open_file() = delete;
|
|
||||||
open_file(const open_file &) noexcept = delete;
|
|
||||||
open_file(open_file &&) noexcept = delete;
|
|
||||||
auto operator=(open_file &&) noexcept -> open_file & = delete;
|
|
||||||
auto operator=(const open_file &) noexcept -> open_file & = delete;
|
|
||||||
|
|
||||||
public:
|
|
||||||
~open_file() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
i_upload_manager &mgr_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool allocated{false};
|
|
||||||
std::unique_ptr<utils::file::i_file> nf_;
|
|
||||||
bool notified_{false};
|
|
||||||
std::size_t read_chunk_{};
|
|
||||||
boost::dynamic_bitset<> read_state_;
|
|
||||||
std::unique_ptr<std::thread> reader_thread_;
|
|
||||||
mutable std::recursive_mutex rw_mtx_;
|
|
||||||
stop_type stop_requested_{false};
|
|
||||||
|
|
||||||
private:
|
|
||||||
[[nodiscard]] auto adjust_cache_size(std::uint64_t file_size,
|
|
||||||
bool shrink) -> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto check_start() -> api_error;
|
|
||||||
|
|
||||||
void download_chunk(std::size_t chunk, bool skip_active, bool should_reset);
|
|
||||||
|
|
||||||
void download_range(std::size_t begin_chunk, std::size_t end_chunk,
|
|
||||||
bool should_reset);
|
|
||||||
|
|
||||||
void set_modified();
|
|
||||||
|
|
||||||
void set_read_state(std::size_t chunk);
|
|
||||||
|
|
||||||
void set_read_state(boost::dynamic_bitset<> read_state);
|
|
||||||
|
|
||||||
void update_reader(std::size_t chunk);
|
|
||||||
|
|
||||||
public:
|
|
||||||
auto close() -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_allocated() const -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_read_state() const -> boost::dynamic_bitset<> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_read_state(std::size_t chunk) const -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto is_complete() const -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto is_write_supported() const -> bool override {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
native_operation(native_operation_callback callback) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
native_operation(std::uint64_t new_file_size,
|
|
||||||
native_operation_callback callback) -> api_error override;
|
|
||||||
|
|
||||||
void remove(std::uint64_t handle) override;
|
|
||||||
|
|
||||||
void remove_all() override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto read(std::size_t read_size, std::uint64_t read_offset,
|
|
||||||
data_buffer &data) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto resize(std::uint64_t new_file_size) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto write(std::uint64_t write_offset, const data_buffer &data,
|
|
||||||
std::size_t &bytes_written) -> api_error override;
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_OPEN_FILE_HPP_
|
|
@ -1,221 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_OPEN_FILE_BASE_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_OPEN_FILE_BASE_HPP_
|
|
||||||
|
|
||||||
#include "file_manager/i_open_file.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_provider;
|
|
||||||
|
|
||||||
class open_file_base : public i_closeable_open_file {
|
|
||||||
public:
|
|
||||||
open_file_base(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
|
||||||
filesystem_item fsi, i_provider &provider, bool disable_io);
|
|
||||||
|
|
||||||
open_file_base(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
|
||||||
filesystem_item fsi,
|
|
||||||
std::map<std::uint64_t, open_file_data> open_data,
|
|
||||||
i_provider &provider, bool disable_io);
|
|
||||||
|
|
||||||
~open_file_base() override = default;
|
|
||||||
|
|
||||||
public:
|
|
||||||
open_file_base() = delete;
|
|
||||||
open_file_base(const open_file_base &) noexcept = delete;
|
|
||||||
open_file_base(open_file_base &&) noexcept = delete;
|
|
||||||
auto operator=(open_file_base &&) noexcept -> open_file_base & = delete;
|
|
||||||
auto operator=(const open_file_base &) noexcept -> open_file_base & = delete;
|
|
||||||
|
|
||||||
public:
|
|
||||||
class download final {
|
|
||||||
public:
|
|
||||||
download() = default;
|
|
||||||
|
|
||||||
~download() = default;
|
|
||||||
|
|
||||||
public:
|
|
||||||
download(const download &) noexcept = delete;
|
|
||||||
download(download &&) noexcept = delete;
|
|
||||||
auto operator=(download &&) noexcept -> download & = delete;
|
|
||||||
auto operator=(const download &) noexcept -> download & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool complete_{false};
|
|
||||||
api_error error_{api_error::success};
|
|
||||||
std::mutex mtx_;
|
|
||||||
std::condition_variable notify_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void notify(const api_error &err);
|
|
||||||
|
|
||||||
auto wait() -> api_error;
|
|
||||||
};
|
|
||||||
|
|
||||||
class io_item final {
|
|
||||||
public:
|
|
||||||
io_item(std::function<api_error()> action) : action_(std::move(action)) {}
|
|
||||||
|
|
||||||
~io_item() = default;
|
|
||||||
|
|
||||||
public:
|
|
||||||
io_item() = delete;
|
|
||||||
io_item(const io_item &) noexcept = delete;
|
|
||||||
io_item(io_item &&) noexcept = delete;
|
|
||||||
auto operator=(io_item &&) noexcept -> io_item & = delete;
|
|
||||||
auto operator=(const io_item &) noexcept -> io_item & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::function<api_error()> action_;
|
|
||||||
std::mutex mtx_;
|
|
||||||
std::condition_variable notify_;
|
|
||||||
std::optional<api_error> result_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void action();
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_result() -> api_error;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::uint64_t chunk_size_;
|
|
||||||
std::uint8_t chunk_timeout_;
|
|
||||||
filesystem_item fsi_;
|
|
||||||
std::size_t last_chunk_size_;
|
|
||||||
std::map<std::uint64_t, open_file_data> open_data_;
|
|
||||||
i_provider &provider_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unordered_map<std::size_t, std::shared_ptr<download>> active_downloads_;
|
|
||||||
api_error error_{api_error::success};
|
|
||||||
mutable std::mutex error_mtx_;
|
|
||||||
mutable std::recursive_mutex file_mtx_;
|
|
||||||
stop_type io_stop_requested_{false};
|
|
||||||
std::unique_ptr<std::thread> io_thread_;
|
|
||||||
mutable std::mutex io_thread_mtx_;
|
|
||||||
std::condition_variable io_thread_notify_;
|
|
||||||
std::deque<std::shared_ptr<io_item>> io_thread_queue_;
|
|
||||||
std::atomic<std::chrono::system_clock::time_point> last_access_{
|
|
||||||
std::chrono::system_clock::now(),
|
|
||||||
};
|
|
||||||
bool modified_{false};
|
|
||||||
bool removed_{false};
|
|
||||||
|
|
||||||
private:
|
|
||||||
void file_io_thread();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
[[nodiscard]] auto do_io(std::function<api_error()> action) -> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_active_downloads()
|
|
||||||
-> std::unordered_map<std::size_t, std::shared_ptr<download>> & {
|
|
||||||
return active_downloads_;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_mutex() const -> std::recursive_mutex & {
|
|
||||||
return file_mtx_;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_last_chunk_size() const -> std::size_t;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_provider() -> i_provider & { return provider_; }
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_provider() const -> const i_provider & {
|
|
||||||
return provider_;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto is_removed() const -> bool;
|
|
||||||
|
|
||||||
void notify_io();
|
|
||||||
|
|
||||||
void reset_timeout();
|
|
||||||
|
|
||||||
auto set_api_error(const api_error &err) -> api_error;
|
|
||||||
|
|
||||||
void set_file_size(std::uint64_t size);
|
|
||||||
|
|
||||||
void set_last_chunk_size(std::size_t size);
|
|
||||||
|
|
||||||
void set_modified(bool modified);
|
|
||||||
|
|
||||||
void set_removed(bool removed);
|
|
||||||
|
|
||||||
void set_source_path(std::string source_path);
|
|
||||||
|
|
||||||
void wait_for_io(stop_type &stop_requested);
|
|
||||||
|
|
||||||
public:
|
|
||||||
void add(std::uint64_t handle, open_file_data ofd) override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto can_close() const -> bool override;
|
|
||||||
|
|
||||||
auto close() -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_allocated() const -> bool override { return false; }
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_error() const -> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_path() const -> std::string override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_chunk_size() const -> std::size_t override {
|
|
||||||
return chunk_size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_size() const -> std::uint64_t override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_filesystem_item() const -> filesystem_item override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_handles() const -> std::vector<std::uint64_t> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_open_data() -> std::map<std::uint64_t, open_file_data> & override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_open_data() const
|
|
||||||
-> const std::map<std::uint64_t, open_file_data> & override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_open_data(std::uint64_t handle) -> open_file_data & override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
get_open_data(std::uint64_t handle) const -> const open_file_data & override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_open_file_count() const -> std::size_t override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_source_path() const -> std::string override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto has_handle(std::uint64_t handle) const -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto is_directory() const -> bool override {
|
|
||||||
return fsi_.directory;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto is_modified() const -> bool override;
|
|
||||||
|
|
||||||
void remove(std::uint64_t handle) override;
|
|
||||||
|
|
||||||
void remove_all() override;
|
|
||||||
|
|
||||||
void set_api_path(const std::string &api_path) override;
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_OPEN_FILE_BASE_HPP_
|
|
@ -1,150 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_RING_BUFFER_BASE_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_RING_BUFFER_BASE_HPP_
|
|
||||||
|
|
||||||
#include "file_manager/open_file_base.hpp"
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
#include "utils/file.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_provider;
|
|
||||||
class i_upload_manager;
|
|
||||||
|
|
||||||
class ring_buffer_base : public open_file_base {
|
|
||||||
public:
|
|
||||||
ring_buffer_base(std::uint64_t chunk_size, std::uint8_t chunk_timeout,
|
|
||||||
filesystem_item fsi, i_provider &provider,
|
|
||||||
std::size_t ring_size, bool disable_io);
|
|
||||||
|
|
||||||
~ring_buffer_base() override = default;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ring_buffer_base() = delete;
|
|
||||||
ring_buffer_base(const ring_buffer_base &) noexcept = delete;
|
|
||||||
ring_buffer_base(ring_buffer_base &&) noexcept = delete;
|
|
||||||
auto operator=(ring_buffer_base &&) noexcept -> ring_buffer_base & = delete;
|
|
||||||
auto
|
|
||||||
operator=(const ring_buffer_base &) noexcept -> ring_buffer_base & = delete;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr const auto min_ring_size{5U};
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::dynamic_bitset<> read_state_;
|
|
||||||
std::size_t total_chunks_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::condition_variable chunk_notify_;
|
|
||||||
mutable std::mutex chunk_mtx_;
|
|
||||||
std::mutex read_mtx_;
|
|
||||||
std::unique_ptr<std::thread> reader_thread_;
|
|
||||||
std::size_t ring_begin_{};
|
|
||||||
std::size_t ring_end_{};
|
|
||||||
std::size_t ring_pos_{};
|
|
||||||
stop_type stop_requested_{false};
|
|
||||||
|
|
||||||
private:
|
|
||||||
[[nodiscard]] auto check_start() -> api_error;
|
|
||||||
|
|
||||||
auto download_chunk(std::size_t chunk, bool skip_active) -> api_error;
|
|
||||||
|
|
||||||
void reader_thread();
|
|
||||||
|
|
||||||
void update_position(std::size_t count, bool is_forward);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
[[nodiscard]] auto has_reader_thread() const -> bool {
|
|
||||||
return reader_thread_ != nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_ring_size() const -> std::size_t {
|
|
||||||
return read_state_.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto on_check_start() -> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
|
||||||
on_chunk_downloaded(std::size_t chunk,
|
|
||||||
const data_buffer &buffer) -> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
|
||||||
on_read_chunk(std::size_t chunk, std::size_t read_size,
|
|
||||||
std::uint64_t read_offset, data_buffer &data,
|
|
||||||
std::size_t &bytes_read) -> api_error = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
|
||||||
use_buffer(std::size_t chunk,
|
|
||||||
std::function<api_error(data_buffer &)> func) -> api_error = 0;
|
|
||||||
|
|
||||||
public:
|
|
||||||
auto close() -> bool override;
|
|
||||||
|
|
||||||
void forward(std::size_t count);
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_current_chunk() const -> std::size_t {
|
|
||||||
return ring_pos_;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_first_chunk() const -> std::size_t {
|
|
||||||
return ring_begin_;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_last_chunk() const -> std::size_t { return ring_end_; }
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_read_state() const -> boost::dynamic_bitset<> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_read_state(std::size_t chunk) const -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_total_chunks() const -> std::size_t {
|
|
||||||
return total_chunks_;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto is_complete() const -> bool override { return false; }
|
|
||||||
|
|
||||||
[[nodiscard]] auto is_write_supported() const -> bool override {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto read(std::size_t read_size, std::uint64_t read_offset,
|
|
||||||
data_buffer &data) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto resize(std::uint64_t /* size */) -> api_error override {
|
|
||||||
return api_error::not_supported;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reverse(std::size_t count);
|
|
||||||
|
|
||||||
void set(std::size_t first_chunk, std::size_t current_chunk);
|
|
||||||
|
|
||||||
void set_api_path(const std::string &api_path) override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
write(std::uint64_t /* write_offset */, const data_buffer & /* data */,
|
|
||||||
std::size_t & /* bytes_written */) -> api_error override {
|
|
||||||
return api_error::not_supported;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_RING_BUFFER_BASE_HPP_
|
|
@ -1,93 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_RING_BUFFER_OPEN_FILE_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_RING_BUFFER_OPEN_FILE_HPP_
|
|
||||||
|
|
||||||
#include "file_manager/ring_buffer_base.hpp"
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
#include "utils/file.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_provider;
|
|
||||||
class i_upload_manager;
|
|
||||||
|
|
||||||
class ring_buffer_open_file final : public ring_buffer_base {
|
|
||||||
public:
|
|
||||||
ring_buffer_open_file(std::string buffer_directory, std::uint64_t chunk_size,
|
|
||||||
std::uint8_t chunk_timeout, filesystem_item fsi,
|
|
||||||
i_provider &provider, std::size_t ring_size);
|
|
||||||
|
|
||||||
~ring_buffer_open_file() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ring_buffer_open_file() = delete;
|
|
||||||
ring_buffer_open_file(const ring_buffer_open_file &) noexcept = delete;
|
|
||||||
ring_buffer_open_file(ring_buffer_open_file &&) noexcept = delete;
|
|
||||||
auto operator=(ring_buffer_open_file &&) noexcept -> ring_buffer_open_file & =
|
|
||||||
delete;
|
|
||||||
auto operator=(const ring_buffer_open_file &) noexcept
|
|
||||||
-> ring_buffer_open_file & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string source_path_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<utils::file::i_file> nf_;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
[[nodiscard]] auto on_check_start() -> bool override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
on_chunk_downloaded(std::size_t chunk,
|
|
||||||
const data_buffer &buffer) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
on_read_chunk(std::size_t chunk, std::size_t read_size,
|
|
||||||
std::uint64_t read_offset, data_buffer &data,
|
|
||||||
std::size_t &bytes_read) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto use_buffer(std::size_t chunk,
|
|
||||||
std::function<api_error(data_buffer &)> func)
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
[[nodiscard]] static auto can_handle_file(std::uint64_t file_size,
|
|
||||||
std::size_t chunk_size,
|
|
||||||
std::size_t ring_size) -> bool;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
|
||||||
native_operation(native_operation_callback callback) -> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto native_operation(std::uint64_t /* new_file_size */,
|
|
||||||
native_operation_callback /* callback */)
|
|
||||||
-> api_error override {
|
|
||||||
return api_error::not_supported;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_source_path() const -> std::string override {
|
|
||||||
return source_path_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_RING_BUFFER_OPEN_FILE_HPP_
|
|
@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
#ifndef REPERTORY_INCLUDE_FILE_MANAGER_UPLOAD_HPP_
|
|
||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_UPLOAD_HPP_
|
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
|
||||||
class i_provider;
|
|
||||||
|
|
||||||
class upload final {
|
|
||||||
public:
|
|
||||||
upload(filesystem_item fsi, i_provider &provider);
|
|
||||||
|
|
||||||
~upload();
|
|
||||||
|
|
||||||
public:
|
|
||||||
upload() = delete;
|
|
||||||
upload(const upload &) noexcept = delete;
|
|
||||||
upload(upload &&) noexcept = delete;
|
|
||||||
auto operator=(upload &&) noexcept -> upload & = delete;
|
|
||||||
auto operator=(const upload &) noexcept -> upload & = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
filesystem_item fsi_;
|
|
||||||
i_provider &provider_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool cancelled_{false};
|
|
||||||
api_error error_{api_error::success};
|
|
||||||
std::unique_ptr<std::thread> thread_;
|
|
||||||
stop_type stop_requested_{false};
|
|
||||||
|
|
||||||
private:
|
|
||||||
void upload_thread();
|
|
||||||
|
|
||||||
public:
|
|
||||||
void cancel();
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_error() const -> api_error { return error_; }
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_path() const -> std::string {
|
|
||||||
return fsi_.api_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_source_path() const -> std::string {
|
|
||||||
return fsi_.source_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto is_cancelled() const -> bool { return cancelled_; }
|
|
||||||
|
|
||||||
void stop();
|
|
||||||
};
|
|
||||||
} // namespace repertory
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_UPLOAD_HPP_
|
|
@ -19,17 +19,14 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PLATFORM_PLATFORM_HPP_
|
#ifndef INCLUDE_PLATFORM_PLATFORM_HPP_
|
||||||
#define REPERTORY_INCLUDE_PLATFORM_PLATFORM_HPP_
|
#define INCLUDE_PLATFORM_PLATFORM_HPP_
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
#include "platform/win32_platform.hpp"
|
|
||||||
#include "utils/windows.hpp"
|
|
||||||
#include "utils/windows/windows_utils.hpp"
|
|
||||||
#else // !defined(_WIN32)
|
|
||||||
#include "platform/unix_platform.hpp"
|
#include "platform/unix_platform.hpp"
|
||||||
|
#include "platform/win32_platform.hpp"
|
||||||
#include "utils/unix.hpp"
|
#include "utils/unix.hpp"
|
||||||
#include "utils/unix/unix_utils.hpp"
|
#include "utils/unix/unix_utils.hpp"
|
||||||
#endif // defined(_WIN32)
|
#include "utils/windows.hpp"
|
||||||
|
#include "utils/windows/windows_utils.hpp"
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_PLATFORM_PLATFORM_HPP_
|
#endif // INCLUDE_PLATFORM_PLATFORM_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
#ifndef INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
||||||
#define REPERTORY_INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
#define INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -77,4 +77,4 @@ public:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
#endif // INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
#ifndef INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
||||||
#define REPERTORY_INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
#define INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
@ -83,4 +83,4 @@ public:
|
|||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // REPERTORY_INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
#endif // INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_
|
#ifndef INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_
|
||||||
#define REPERTORY_INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_
|
#define INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_
|
||||||
|
|
||||||
#include "db/i_meta_db.hpp"
|
|
||||||
#include "providers/i_provider.hpp"
|
#include "providers/i_provider.hpp"
|
||||||
|
#include "providers/meta_db.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
@ -32,13 +32,6 @@ class i_file_manager;
|
|||||||
class i_http_comm;
|
class i_http_comm;
|
||||||
|
|
||||||
class base_provider : public i_provider {
|
class base_provider : public i_provider {
|
||||||
private:
|
|
||||||
struct removed_item final {
|
|
||||||
std::string api_path;
|
|
||||||
bool directory{};
|
|
||||||
std::string source_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
base_provider(app_config &config, i_http_comm &comm)
|
base_provider(app_config &config, i_http_comm &comm)
|
||||||
: config_(config), comm_(comm) {}
|
: config_(config), comm_(comm) {}
|
||||||
@ -49,29 +42,15 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
api_item_added_callback api_item_added_;
|
api_item_added_callback api_item_added_;
|
||||||
std::unique_ptr<i_meta_db> db3_;
|
std::unique_ptr<meta_db> db3_;
|
||||||
i_file_manager *fm_{};
|
i_file_manager *fm_{};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void add_all_items(const stop_type &stop_requested);
|
void remove_deleted_files();
|
||||||
|
|
||||||
void process_removed_directories(std::deque<removed_item> removed_list,
|
|
||||||
const stop_type &stop_requested);
|
|
||||||
|
|
||||||
void process_removed_files(std::deque<removed_item> removed_list,
|
|
||||||
const stop_type &stop_requested);
|
|
||||||
|
|
||||||
void process_removed_items(const stop_type &stop_requested);
|
|
||||||
|
|
||||||
void remove_deleted_items(const stop_type &stop_requested);
|
|
||||||
|
|
||||||
void remove_unmatched_source_files(const stop_type &stop_requested);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
[[nodiscard]] static auto create_api_file(std::string path, std::string key,
|
[[nodiscard]] static auto create_api_file(std::string path, std::string key,
|
||||||
std::uint64_t size,
|
std::uint64_t size) -> api_file;
|
||||||
std::uint64_t file_time)
|
|
||||||
-> api_file;
|
|
||||||
|
|
||||||
[[nodiscard]] static auto create_api_file(std::string path,
|
[[nodiscard]] static auto create_api_file(std::string path,
|
||||||
std::uint64_t size,
|
std::uint64_t size,
|
||||||
@ -96,9 +75,7 @@ protected:
|
|||||||
return api_item_added_;
|
return api_item_added_;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_comm() -> i_http_comm & { return comm_; }
|
[[nodiscard]] auto get_comm() const -> i_http_comm & { return comm_; }
|
||||||
|
|
||||||
[[nodiscard]] auto get_comm() const -> const i_http_comm & { return comm_; }
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_config() -> app_config & { return config_; }
|
[[nodiscard]] auto get_config() -> app_config & { return config_; }
|
||||||
|
|
||||||
@ -106,9 +83,7 @@ protected:
|
|||||||
return config_;
|
return config_;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_db() -> i_meta_db & { return *db3_; }
|
[[nodiscard]] auto get_db() -> meta_db & { return *db3_; }
|
||||||
|
|
||||||
[[nodiscard]] auto get_db() const -> const i_meta_db & { return *db3_; }
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
get_directory_items_impl(const std::string &api_path,
|
get_directory_items_impl(const std::string &api_path,
|
||||||
@ -120,6 +95,9 @@ protected:
|
|||||||
return fm_;
|
return fm_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] virtual auto get_used_drive_space_impl() const
|
||||||
|
-> std::uint64_t = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto remove_directory_impl(const std::string &api_path)
|
[[nodiscard]] virtual auto remove_directory_impl(const std::string &api_path)
|
||||||
-> api_error = 0;
|
-> api_error = 0;
|
||||||
|
|
||||||
@ -189,8 +167,6 @@ public:
|
|||||||
[[nodiscard]] auto is_file_writeable(const std::string &api_path) const
|
[[nodiscard]] auto is_file_writeable(const std::string &api_path) const
|
||||||
-> bool override;
|
-> bool override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_read_only() const -> bool override { return false; }
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_directory(const std::string &api_path)
|
[[nodiscard]] auto remove_directory(const std::string &api_path)
|
||||||
-> api_error override;
|
-> api_error override;
|
||||||
|
|
||||||
@ -222,4 +198,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_
|
#endif // INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
|
#ifndef INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
|
||||||
#define REPERTORY_INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
|
#define INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "db/i_file_db.hpp"
|
#include "database/db_common.hpp"
|
||||||
#include "providers/i_provider.hpp"
|
#include "providers/i_provider.hpp"
|
||||||
#include "utils/encrypting_reader.hpp"
|
#include "utils/encrypting_reader.hpp"
|
||||||
|
|
||||||
@ -45,22 +45,21 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct reader_info final {
|
struct reader_info final {
|
||||||
std::chrono::system_clock::time_point last_access_time{
|
std::chrono::system_clock::time_point last_access_time =
|
||||||
std::chrono::system_clock::now(),
|
std::chrono::system_clock::now();
|
||||||
};
|
std::unique_ptr<utils::encryption::encrypting_reader> reader{};
|
||||||
std::unique_ptr<utils::encryption::encrypting_reader> reader;
|
|
||||||
std::mutex reader_mtx;
|
std::mutex reader_mtx;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
app_config &config_;
|
app_config &config_;
|
||||||
encrypt_config encrypt_config_;
|
db::db3_t db_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<i_file_db> db_{nullptr};
|
i_file_manager *fm_ = nullptr;
|
||||||
i_file_manager *fm_{nullptr};
|
std::unordered_map<std::string, std::shared_ptr<reader_info>>
|
||||||
std::unordered_map<std::string, std::shared_ptr<reader_info>> reader_lookup_;
|
reader_lookup_{};
|
||||||
std::recursive_mutex reader_lookup_mtx_;
|
std::recursive_mutex reader_lookup_mtx_{};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static auto create_api_file(const std::string &api_path, bool directory,
|
static auto create_api_file(const std::string &api_path, bool directory,
|
||||||
@ -74,82 +73,71 @@ private:
|
|||||||
const std::string &source_path)>
|
const std::string &source_path)>
|
||||||
callback) const -> api_error;
|
callback) const -> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto get_encrypt_config() const -> const encrypt_config & {
|
|
||||||
return encrypt_config_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto process_directory_entry(const utils::file::i_fs_item &dir_entry,
|
auto process_directory_entry(const utils::file::i_fs_item &dir_entry,
|
||||||
const encrypt_config &cfg,
|
const encrypt_config &cfg,
|
||||||
std::string &api_path) const -> bool;
|
std::string &api_path) const -> bool;
|
||||||
|
|
||||||
void remove_deleted_files(const stop_type &stop_requested);
|
void remove_deleted_files();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] auto create_directory(const std::string &api_path,
|
[[nodiscard]] auto create_directory(const std::string &api_path,
|
||||||
api_meta_map &meta) -> api_error override;
|
api_meta_map &meta) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto create_directory_clone_source_meta(
|
||||||
create_directory_clone_source_meta(const std::string & /*source_api_path*/,
|
const std::string & /*source_api_path*/,
|
||||||
const std::string & /*api_path*/)
|
const std::string & /*api_path*/) -> api_error override {
|
||||||
-> api_error override {
|
|
||||||
return api_error::not_implemented;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto create_file(const std::string & /*api_path*/,
|
|
||||||
api_meta_map & /*meta*/)
|
|
||||||
-> api_error override {
|
|
||||||
return api_error::not_implemented;
|
return api_error::not_implemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
get_api_path_from_source(const std::string & /*source_path*/,
|
create_file(const std::string & /*api_path*/,
|
||||||
std::string & /*api_path*/) const
|
api_meta_map & /*meta*/) -> api_error override {
|
||||||
-> api_error override;
|
return api_error::not_implemented;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto get_api_path_from_source(
|
||||||
|
const std::string & /*source_path*/,
|
||||||
|
std::string & /*api_path*/) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
||||||
-> std::uint64_t override;
|
-> std::uint64_t override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_items(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
directory_item_list &list) const
|
get_directory_items(const std::string &api_path,
|
||||||
-> api_error override;
|
directory_item_list &list) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_file(const std::string &api_path, api_file &file) const
|
[[nodiscard]] auto get_file(const std::string &api_path,
|
||||||
-> api_error override;
|
api_file &file) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_list(api_file_list &list,
|
|
||||||
std::string &marker) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_size(const std::string &api_path,
|
|
||||||
std::uint64_t &file_size) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_filesystem_item(const std::string &api_path,
|
|
||||||
bool directory,
|
|
||||||
filesystem_item &fsi) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_filesystem_item_and_file(const std::string &api_path,
|
|
||||||
api_file &file,
|
|
||||||
filesystem_item &fsi) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
get_filesystem_item_from_source_path(const std::string &source_path,
|
get_file_list(api_file_list &list) const -> api_error override;
|
||||||
filesystem_item &fsi) const
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_pinned_files() const
|
[[nodiscard]] auto
|
||||||
-> std::vector<std::string> override;
|
get_file_size(const std::string &api_path,
|
||||||
|
std::uint64_t &file_size) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
api_meta_map &meta) const
|
get_filesystem_item(const std::string &api_path, bool directory,
|
||||||
-> api_error override;
|
filesystem_item &fsi) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
[[nodiscard]] auto get_filesystem_item_and_file(
|
||||||
const std::string &key,
|
const std::string &api_path, api_file &file,
|
||||||
std::string &value) const
|
filesystem_item &fsi) const -> api_error override;
|
||||||
-> api_error override;
|
|
||||||
|
[[nodiscard]] auto get_filesystem_item_from_source_path(
|
||||||
|
const std::string &source_path,
|
||||||
|
filesystem_item &fsi) const -> api_error override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_pinned_files() const -> std::vector<std::string> override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_item_meta(const std::string &api_path,
|
||||||
|
api_meta_map &meta) const -> api_error override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
get_item_meta(const std::string &api_path, const std::string &key,
|
||||||
|
std::string &value) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_total_drive_space() const -> std::uint64_t override;
|
[[nodiscard]] auto get_total_drive_space() const -> std::uint64_t override;
|
||||||
|
|
||||||
@ -161,61 +149,57 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] auto get_used_drive_space() const -> std::uint64_t override;
|
[[nodiscard]] auto get_used_drive_space() const -> std::uint64_t override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto is_direct_only() const -> bool override { return true; }
|
||||||
|
|
||||||
[[nodiscard]] auto is_directory(const std::string &api_path,
|
[[nodiscard]] auto is_directory(const std::string &api_path,
|
||||||
bool &exists) const -> api_error override;
|
bool &exists) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_file(const std::string &api_path, bool &exists) const
|
[[nodiscard]] auto is_file(const std::string &api_path,
|
||||||
-> api_error override;
|
bool &exists) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_file_writeable(const std::string &api_path) const
|
[[nodiscard]] auto
|
||||||
-> bool override;
|
is_file_writeable(const std::string &api_path) const -> bool override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_online() const -> bool override;
|
[[nodiscard]] auto is_online() const -> bool override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_read_only() const -> bool override { return true; }
|
[[nodiscard]] auto is_rename_supported() const -> bool override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_rename_supported() const -> bool override {
|
[[nodiscard]] auto
|
||||||
return false;
|
read_file_bytes(const std::string &api_path, std::size_t size,
|
||||||
}
|
std::uint64_t offset, data_buffer &data,
|
||||||
|
stop_type &stop_requested) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto read_file_bytes(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
std::size_t size, std::uint64_t offset,
|
remove_directory(const std::string & /*api_path*/) -> api_error override {
|
||||||
data_buffer &data,
|
|
||||||
stop_type &stop_requested)
|
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_directory(const std::string & /*api_path*/)
|
|
||||||
-> api_error override {
|
|
||||||
return api_error::not_implemented;
|
return api_error::not_implemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto remove_file(const std::string & /*api_path*/)
|
[[nodiscard]] auto
|
||||||
-> api_error override {
|
remove_file(const std::string & /*api_path*/) -> api_error override {
|
||||||
return api_error::not_implemented;
|
return api_error::not_implemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto remove_item_meta(const std::string & /*api_path*/,
|
[[nodiscard]] auto
|
||||||
const std::string & /*key*/)
|
remove_item_meta(const std::string & /*api_path*/,
|
||||||
-> api_error override {
|
const std::string & /*key*/) -> api_error override {
|
||||||
return api_error::success;
|
return api_error::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto rename_file(const std::string & /*from_api_path*/,
|
[[nodiscard]] auto
|
||||||
const std::string & /*to_api_path*/)
|
rename_file(const std::string & /*from_api_path*/,
|
||||||
-> api_error override {
|
const std::string & /*to_api_path*/) -> api_error override {
|
||||||
return api_error::not_implemented;
|
return api_error::not_implemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto set_item_meta(const std::string & /*api_path*/,
|
[[nodiscard]] auto
|
||||||
const std::string & /*key*/,
|
set_item_meta(const std::string & /*api_path*/, const std::string & /*key*/,
|
||||||
const std::string & /*value*/)
|
const std::string & /*value*/) -> api_error override {
|
||||||
-> api_error override {
|
|
||||||
return api_error::success;
|
return api_error::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto set_item_meta(const std::string & /*api_path*/,
|
[[nodiscard]] auto
|
||||||
const api_meta_map & /*meta*/)
|
set_item_meta(const std::string & /*api_path*/,
|
||||||
-> api_error override {
|
const api_meta_map & /*meta*/) -> api_error override {
|
||||||
return api_error::success;
|
return api_error::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,13 +208,13 @@ public:
|
|||||||
|
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
[[nodiscard]] auto upload_file(const std::string & /*api_path*/,
|
[[nodiscard]] auto
|
||||||
const std::string & /*source_path*/,
|
upload_file(const std::string & /*api_path*/,
|
||||||
stop_type & /*stop_requested*/)
|
const std::string & /*source_path*/,
|
||||||
-> api_error override {
|
stop_type & /*stop_requested*/) -> api_error override {
|
||||||
return api_error::not_implemented;
|
return api_error::not_implemented;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
|
#endif // INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PROVIDERS_I_PROVIDER_HPP_
|
#ifndef INCLUDE_PROVIDERS_I_PROVIDER_HPP_
|
||||||
#define REPERTORY_INCLUDE_PROVIDERS_I_PROVIDER_HPP_
|
#define INCLUDE_PROVIDERS_I_PROVIDER_HPP_
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
@ -58,8 +58,7 @@ public:
|
|||||||
[[nodiscard]] virtual auto get_file(const std::string &api_path,
|
[[nodiscard]] virtual auto get_file(const std::string &api_path,
|
||||||
api_file &file) const -> api_error = 0;
|
api_file &file) const -> api_error = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_file_list(api_file_list &list,
|
[[nodiscard]] virtual auto get_file_list(api_file_list &list) const
|
||||||
std::string &marker) const
|
|
||||||
-> api_error = 0;
|
-> api_error = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto get_file_size(const std::string &api_path,
|
[[nodiscard]] virtual auto get_file_size(const std::string &api_path,
|
||||||
@ -100,6 +99,8 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] virtual auto get_used_drive_space() const -> std::uint64_t = 0;
|
[[nodiscard]] virtual auto get_used_drive_space() const -> std::uint64_t = 0;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual auto is_direct_only() const -> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto is_directory(const std::string &api_path,
|
[[nodiscard]] virtual auto is_directory(const std::string &api_path,
|
||||||
bool &exists) const -> api_error = 0;
|
bool &exists) const -> api_error = 0;
|
||||||
|
|
||||||
@ -111,8 +112,6 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] virtual auto is_online() const -> bool = 0;
|
[[nodiscard]] virtual auto is_online() const -> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto is_read_only() const -> bool = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual auto is_rename_supported() const -> bool = 0;
|
[[nodiscard]] virtual auto is_rename_supported() const -> bool = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual auto
|
[[nodiscard]] virtual auto
|
||||||
@ -155,4 +154,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_PROVIDERS_I_PROVIDER_HPP_
|
#endif // INCLUDE_PROVIDERS_I_PROVIDER_HPP_
|
||||||
|
@ -19,28 +19,27 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_
|
#ifndef INCLUDE_PROVIDERS_META_DB_HPP_
|
||||||
#define REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_
|
#define INCLUDE_PROVIDERS_META_DB_HPP_
|
||||||
|
|
||||||
#include "db/i_meta_db.hpp"
|
#include "database/db_common.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
#include "utils/db/sqlite/db_common.hpp"
|
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
class app_config;
|
class app_config;
|
||||||
|
|
||||||
class sqlite_meta_db final : public i_meta_db {
|
class meta_db final {
|
||||||
public:
|
public:
|
||||||
sqlite_meta_db(const app_config &cfg);
|
meta_db(const app_config &cfg);
|
||||||
~sqlite_meta_db() override;
|
~meta_db();
|
||||||
|
|
||||||
sqlite_meta_db(const sqlite_meta_db &) = delete;
|
meta_db(const meta_db &) = delete;
|
||||||
sqlite_meta_db(sqlite_meta_db &&) = delete;
|
meta_db(meta_db &&) = delete;
|
||||||
auto operator=(const sqlite_meta_db &) -> sqlite_meta_db & = delete;
|
auto operator=(const meta_db &) -> meta_db & = delete;
|
||||||
auto operator=(sqlite_meta_db &&) -> sqlite_meta_db & = delete;
|
auto operator=(meta_db &&) -> meta_db & = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
utils::db::sqlite::db3_t db_;
|
db::db3_t db_;
|
||||||
constexpr static const auto table_name = "meta";
|
constexpr static const auto table_name = "meta";
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -48,50 +47,38 @@ private:
|
|||||||
api_meta_map meta) -> api_error;
|
api_meta_map meta) -> api_error;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void clear() override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_path(const std::string &source_path,
|
[[nodiscard]] auto get_api_path(const std::string &source_path,
|
||||||
std::string &api_path) const
|
std::string &api_path) -> api_error;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_api_path_list() const
|
[[nodiscard]] auto get_api_path_list() -> std::vector<std::string>;
|
||||||
-> std::vector<std::string> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
||||||
api_meta_map &meta) const
|
api_meta_map &meta) -> api_error;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
||||||
const std::string &key,
|
const std::string &key,
|
||||||
std::string &value) const
|
std::string &value) const -> api_error;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_pinned_files() const
|
[[nodiscard]] auto get_pinned_files() const -> std::vector<std::string>;
|
||||||
-> std::vector<std::string> override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_total_item_count() const -> std::uint64_t override;
|
[[nodiscard]] auto get_total_item_count() const -> std::uint64_t;
|
||||||
|
|
||||||
[[nodiscard]] auto get_total_size() const -> std::uint64_t override;
|
void remove_api_path(const std::string &api_path);
|
||||||
|
|
||||||
void remove_api_path(const std::string &api_path) override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto remove_item_meta(const std::string &api_path,
|
[[nodiscard]] auto remove_item_meta(const std::string &api_path,
|
||||||
const std::string &key)
|
const std::string &key) -> api_error;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto rename_item_meta(const std::string &from_api_path,
|
[[nodiscard]] auto rename_item_meta(const std::string &from_api_path,
|
||||||
const std::string &to_api_path)
|
const std::string &to_api_path)
|
||||||
-> api_error override;
|
-> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto set_item_meta(const std::string &api_path,
|
[[nodiscard]] auto set_item_meta(const std::string &api_path,
|
||||||
const std::string &key,
|
const std::string &key,
|
||||||
const std::string &value)
|
const std::string &value) -> api_error;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto set_item_meta(const std::string &api_path,
|
[[nodiscard]] auto set_item_meta(const std::string &api_path,
|
||||||
const api_meta_map &meta)
|
const api_meta_map &meta) -> api_error;
|
||||||
-> api_error override;
|
|
||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_
|
#endif // INCLUDE_PROVIDERS_META_DB_HPP_
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PROVIDERS_PROVIDER_HPP_
|
#ifndef INCLUDE_PROVIDERS_PROVIDER_HPP_
|
||||||
#define REPERTORY_INCLUDE_PROVIDERS_PROVIDER_HPP_
|
#define INCLUDE_PROVIDERS_PROVIDER_HPP_
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
@ -28,9 +28,9 @@ namespace repertory {
|
|||||||
class app_config;
|
class app_config;
|
||||||
class i_provider;
|
class i_provider;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto create_provider(const provider_type &prov,
|
||||||
create_provider(const provider_type &prov,
|
app_config &config)
|
||||||
app_config &config) -> std::unique_ptr<i_provider>;
|
-> std::unique_ptr<i_provider>;
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_PROVIDERS_PROVIDER_HPP_
|
#endif // INCLUDE_PROVIDERS_PROVIDER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_
|
#ifndef INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_
|
||||||
#define REPERTORY_INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_
|
#define INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_
|
||||||
|
|
||||||
#include "providers/base_provider.hpp"
|
#include "providers/base_provider.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -47,77 +47,65 @@ public:
|
|||||||
auto operator=(s3_provider &&) -> s3_provider & = delete;
|
auto operator=(s3_provider &&) -> s3_provider & = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
s3_config s3_config_;
|
[[nodiscard]] auto
|
||||||
|
add_if_not_found(api_file &file,
|
||||||
|
const std::string &object_name) const -> api_error;
|
||||||
|
|
||||||
private:
|
[[nodiscard]] auto
|
||||||
[[nodiscard]] auto add_if_not_found(api_file &file,
|
create_file_extra(const std::string &api_path,
|
||||||
const std::string &object_name) const
|
api_meta_map &meta) -> api_error override;
|
||||||
-> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto create_file_extra(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
api_meta_map &meta)
|
create_path_directories(const std::string &api_path,
|
||||||
-> api_error override;
|
const std::string &key) const -> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto create_path_directories(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
const std::string &key) const
|
decrypt_object_name(std::string &object_name) const -> api_error;
|
||||||
-> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto decrypt_object_name(std::string &object_name) const
|
|
||||||
-> api_error;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_last_modified(bool directory,
|
|
||||||
const std::string &api_path) const
|
|
||||||
-> std::uint64_t;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
get_object_info(bool directory, const std::string &api_path,
|
get_object_info(bool directory, const std::string &api_path,
|
||||||
bool &is_encrypted, std::string &object_name,
|
bool &is_encrypted, std::string &object_name,
|
||||||
head_object_result &result) const -> api_error;
|
head_object_result &result) const -> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto get_object_list(
|
||||||
get_object_list(std::string &response_data, long &response_code,
|
std::string &response_data, long &response_code,
|
||||||
std::optional<std::string> delimiter = std::nullopt,
|
std::optional<std::string> delimiter = std::nullopt,
|
||||||
std::optional<std::string> prefix = std::nullopt,
|
std::optional<std::string> prefix = std::nullopt) const -> bool;
|
||||||
std::optional<std::string> token = std::nullopt) const
|
|
||||||
-> bool;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_s3_config() const -> const s3_config & {
|
|
||||||
return s3_config_;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
[[nodiscard]] auto create_directory_impl(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
api_meta_map &meta)
|
create_directory_impl(const std::string &api_path,
|
||||||
-> api_error override;
|
api_meta_map &meta) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_items_impl(const std::string &api_path,
|
[[nodiscard]] auto get_directory_items_impl(const std::string &api_path,
|
||||||
directory_item_list &list) const
|
directory_item_list &list) const
|
||||||
-> api_error override;
|
-> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto remove_directory_impl(const std::string &api_path)
|
[[nodiscard]] auto
|
||||||
-> api_error override;
|
get_used_drive_space_impl() const -> std::uint64_t override;
|
||||||
|
|
||||||
[[nodiscard]] auto remove_file_impl(const std::string &api_path)
|
[[nodiscard]] auto
|
||||||
-> api_error override;
|
remove_directory_impl(const std::string &api_path) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto upload_file_impl(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
const std::string &source_path,
|
remove_file_impl(const std::string &api_path) -> api_error override;
|
||||||
stop_type &stop_requested)
|
|
||||||
-> api_error override;
|
[[nodiscard]] auto
|
||||||
|
upload_file_impl(const std::string &api_path, const std::string &source_path,
|
||||||
|
stop_type &stop_requested) -> api_error override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] static auto convert_api_date(std::string_view date)
|
[[nodiscard]] static auto
|
||||||
-> std::uint64_t;
|
convert_api_date(std::string_view date) -> std::uint64_t;
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
||||||
-> std::uint64_t override;
|
-> std::uint64_t override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_file(const std::string &api_path, api_file &file) const
|
[[nodiscard]] auto get_file(const std::string &api_path,
|
||||||
-> api_error override;
|
api_file &file) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_list(api_file_list &list,
|
[[nodiscard]] auto
|
||||||
std::string &marker) const
|
get_file_list(api_file_list &list) const -> api_error override;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_total_drive_space() const -> std::uint64_t override;
|
[[nodiscard]] auto get_total_drive_space() const -> std::uint64_t override;
|
||||||
|
|
||||||
@ -125,11 +113,13 @@ public:
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto is_direct_only() const -> bool override { return false; }
|
||||||
|
|
||||||
[[nodiscard]] auto is_directory(const std::string &api_path,
|
[[nodiscard]] auto is_directory(const std::string &api_path,
|
||||||
bool &exists) const -> api_error override;
|
bool &exists) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_file(const std::string &api_path, bool &exists) const
|
[[nodiscard]] auto is_file(const std::string &api_path,
|
||||||
-> api_error override;
|
bool &exists) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_online() const -> bool override;
|
[[nodiscard]] auto is_online() const -> bool override;
|
||||||
|
|
||||||
@ -137,15 +127,14 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] auto read_file_bytes(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
std::size_t size, std::uint64_t offset,
|
read_file_bytes(const std::string &api_path, std::size_t size,
|
||||||
data_buffer &data,
|
std::uint64_t offset, data_buffer &data,
|
||||||
stop_type &stop_requested)
|
stop_type &stop_requested) -> api_error override;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto rename_file(const std::string &from_api_path,
|
[[nodiscard]] auto
|
||||||
const std::string &to_api_path)
|
rename_file(const std::string &from_api_path,
|
||||||
-> api_error override;
|
const std::string &to_api_path) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto start(api_item_added_callback api_item_added,
|
[[nodiscard]] auto start(api_item_added_callback api_item_added,
|
||||||
i_file_manager *mgr) -> bool override;
|
i_file_manager *mgr) -> bool override;
|
||||||
@ -154,4 +143,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_
|
#endif // INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_
|
#ifndef INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_
|
||||||
#define REPERTORY_INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_
|
#define INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_
|
||||||
|
|
||||||
#include "providers/base_provider.hpp"
|
#include "providers/base_provider.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -45,9 +45,6 @@ public:
|
|||||||
auto operator=(const sia_provider &) -> sia_provider & = delete;
|
auto operator=(const sia_provider &) -> sia_provider & = delete;
|
||||||
auto operator=(sia_provider &&) -> sia_provider & = delete;
|
auto operator=(sia_provider &&) -> sia_provider & = delete;
|
||||||
|
|
||||||
private:
|
|
||||||
sia_config sia_config_;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto get_object_info(const std::string &api_path,
|
[[nodiscard]] auto get_object_info(const std::string &api_path,
|
||||||
json &object_info) const -> api_error;
|
json &object_info) const -> api_error;
|
||||||
@ -55,40 +52,37 @@ private:
|
|||||||
[[nodiscard]] auto get_object_list(const std::string &api_path,
|
[[nodiscard]] auto get_object_list(const std::string &api_path,
|
||||||
nlohmann::json &object_list) const -> bool;
|
nlohmann::json &object_list) const -> bool;
|
||||||
|
|
||||||
[[nodiscard]] auto get_sia_config() const -> const auto & {
|
|
||||||
return sia_config_;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
[[nodiscard]] auto create_directory_impl(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
api_meta_map &meta)
|
create_directory_impl(const std::string &api_path,
|
||||||
-> api_error override;
|
api_meta_map &meta) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_directory_items_impl(const std::string &api_path,
|
[[nodiscard]] auto get_directory_items_impl(const std::string &api_path,
|
||||||
directory_item_list &list) const
|
directory_item_list &list) const
|
||||||
-> api_error override;
|
-> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto remove_directory_impl(const std::string &api_path)
|
[[nodiscard]] auto
|
||||||
-> api_error override;
|
get_used_drive_space_impl() const -> std::uint64_t override;
|
||||||
|
|
||||||
[[nodiscard]] auto remove_file_impl(const std::string &api_path)
|
[[nodiscard]] auto
|
||||||
-> api_error override;
|
remove_directory_impl(const std::string &api_path) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto upload_file_impl(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
const std::string &source_path,
|
remove_file_impl(const std::string &api_path) -> api_error override;
|
||||||
stop_type &stop_requested)
|
|
||||||
-> api_error override;
|
[[nodiscard]] auto
|
||||||
|
upload_file_impl(const std::string &api_path, const std::string &source_path,
|
||||||
|
stop_type &stop_requested) -> api_error override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
||||||
-> std::uint64_t override;
|
-> std::uint64_t override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_file(const std::string &api_path, api_file &file) const
|
[[nodiscard]] auto get_file(const std::string &api_path,
|
||||||
-> api_error override;
|
api_file &file) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto get_file_list(api_file_list &list,
|
[[nodiscard]] auto
|
||||||
std::string &marker) const
|
get_file_list(api_file_list &list) const -> api_error override;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto get_provider_type() const -> provider_type override {
|
[[nodiscard]] auto get_provider_type() const -> provider_type override {
|
||||||
return type;
|
return type;
|
||||||
@ -96,11 +90,13 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] auto get_total_drive_space() const -> std::uint64_t override;
|
[[nodiscard]] auto get_total_drive_space() const -> std::uint64_t override;
|
||||||
|
|
||||||
|
[[nodiscard]] auto is_direct_only() const -> bool override { return false; }
|
||||||
|
|
||||||
[[nodiscard]] auto is_directory(const std::string &api_path,
|
[[nodiscard]] auto is_directory(const std::string &api_path,
|
||||||
bool &exists) const -> api_error override;
|
bool &exists) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_file(const std::string &api_path, bool &exists) const
|
[[nodiscard]] auto is_file(const std::string &api_path,
|
||||||
-> api_error override;
|
bool &exists) const -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto is_online() const -> bool override;
|
[[nodiscard]] auto is_online() const -> bool override;
|
||||||
|
|
||||||
@ -108,15 +104,14 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto read_file_bytes(const std::string &api_path,
|
[[nodiscard]] auto
|
||||||
std::size_t size, std::uint64_t offset,
|
read_file_bytes(const std::string &api_path, std::size_t size,
|
||||||
data_buffer &buffer,
|
std::uint64_t offset, data_buffer &buffer,
|
||||||
stop_type &stop_requested)
|
stop_type &stop_requested) -> api_error override;
|
||||||
-> api_error override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto rename_file(const std::string &from_api_path,
|
[[nodiscard]] auto
|
||||||
const std::string &to_api_path)
|
rename_file(const std::string &from_api_path,
|
||||||
-> api_error override;
|
const std::string &to_api_path) -> api_error override;
|
||||||
|
|
||||||
[[nodiscard]] auto start(api_item_added_callback api_item_added,
|
[[nodiscard]] auto start(api_item_added_callback api_item_added,
|
||||||
i_file_manager *mgr) -> bool override;
|
i_file_manager *mgr) -> bool override;
|
||||||
@ -125,4 +120,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_
|
#endif // INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_RPC_CLIENT_CLIENT_HPP_
|
#ifndef INCLUDE_RPC_CLIENT_CLIENT_HPP_
|
||||||
#define REPERTORY_INCLUDE_RPC_CLIENT_CLIENT_HPP_
|
#define INCLUDE_RPC_CLIENT_CLIENT_HPP_
|
||||||
|
|
||||||
#include "types/rpc.hpp"
|
#include "types/rpc.hpp"
|
||||||
|
|
||||||
@ -38,11 +38,11 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] auto get_config() -> rpc_response;
|
[[nodiscard]] auto get_config() -> rpc_response;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto get_config_value_by_name(const std::string &name)
|
||||||
get_config_value_by_name(const std::string &name) -> rpc_response;
|
-> rpc_response;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto get_directory_items(const std::string &api_path)
|
||||||
get_directory_items(const std::string &api_path) -> rpc_response;
|
-> rpc_response;
|
||||||
|
|
||||||
[[nodiscard]] auto get_open_files() -> rpc_response;
|
[[nodiscard]] auto get_open_files() -> rpc_response;
|
||||||
|
|
||||||
@ -52,9 +52,9 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] auto pinned_status(const std::string &api_file) -> rpc_response;
|
[[nodiscard]] auto pinned_status(const std::string &api_file) -> rpc_response;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto set_config_value_by_name(const std::string &name,
|
||||||
set_config_value_by_name(const std::string &name,
|
const std::string &value)
|
||||||
const std::string &value) -> rpc_response;
|
-> rpc_response;
|
||||||
|
|
||||||
[[nodiscard]] auto unmount() -> rpc_response;
|
[[nodiscard]] auto unmount() -> rpc_response;
|
||||||
|
|
||||||
@ -62,4 +62,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_RPC_CLIENT_CLIENT_HPP_
|
#endif // INCLUDE_RPC_CLIENT_CLIENT_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_RPC_SERVER_FULL_SERVER_HPP_
|
#ifndef INCLUDE_RPC_SERVER_FULL_SERVER_HPP_
|
||||||
#define REPERTORY_INCLUDE_RPC_SERVER_FULL_SERVER_HPP_
|
#define INCLUDE_RPC_SERVER_FULL_SERVER_HPP_
|
||||||
|
|
||||||
#include "rpc/server/server.hpp"
|
#include "rpc/server/server.hpp"
|
||||||
|
|
||||||
@ -64,4 +64,4 @@ protected:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_RPC_SERVER_FULL_SERVER_HPP_
|
#endif // INCLUDE_RPC_SERVER_FULL_SERVER_HPP_
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_RPC_SERVER_SERVER_HPP_
|
#ifndef INCLUDE_RPC_SERVER_SERVER_HPP_
|
||||||
#define REPERTORY_INCLUDE_RPC_SERVER_SERVER_HPP_
|
#define INCLUDE_RPC_SERVER_SERVER_HPP_
|
||||||
|
|
||||||
#include "types/rpc.hpp"
|
#include "types/rpc.hpp"
|
||||||
|
|
||||||
@ -72,4 +72,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_RPC_SERVER_SERVER_HPP_
|
#endif // INCLUDE_RPC_SERVER_SERVER_HPP_
|
||||||
|
@ -19,10 +19,8 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifndef REPERTORY_INCLUDE_TYPES_REMOTE_HPP_
|
#ifndef INCLUDE_TYPES_REMOTE_HPP_
|
||||||
#define REPERTORY_INCLUDE_TYPES_REMOTE_HPP_
|
#define INCLUDE_TYPES_REMOTE_HPP_
|
||||||
|
|
||||||
#include "types/repertory.hpp"
|
|
||||||
|
|
||||||
inline constexpr const auto PACKET_SERVICE_FUSE{1U};
|
inline constexpr const auto PACKET_SERVICE_FUSE{1U};
|
||||||
inline constexpr const auto PACKET_SERVICE_WINFSP{2U};
|
inline constexpr const auto PACKET_SERVICE_WINFSP{2U};
|
||||||
@ -33,67 +31,7 @@ inline constexpr const auto PACKET_SERVICE_FLAGS{PACKET_SERVICE_WINFSP};
|
|||||||
inline constexpr const auto PACKET_SERVICE_FLAGS{PACKET_SERVICE_FUSE};
|
inline constexpr const auto PACKET_SERVICE_FLAGS{PACKET_SERVICE_FUSE};
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
constexpr const auto default_remote_client_pool_size{20U};
|
|
||||||
constexpr const auto default_remote_max_connections{20U};
|
|
||||||
constexpr const auto default_remote_receive_timeout_ms{120U * 1000U};
|
|
||||||
constexpr const auto default_remote_send_timeout_ms{30U * 1000U};
|
|
||||||
|
|
||||||
namespace repertory::remote {
|
namespace repertory::remote {
|
||||||
struct remote_config final {
|
|
||||||
std::uint16_t api_port{};
|
|
||||||
std::string encryption_token;
|
|
||||||
std::string host_name_or_ip;
|
|
||||||
std::uint8_t max_connections{default_remote_max_connections};
|
|
||||||
std::uint32_t recv_timeout_ms{default_remote_receive_timeout_ms};
|
|
||||||
std::uint32_t send_timeout_ms{default_remote_send_timeout_ms};
|
|
||||||
|
|
||||||
auto operator==(const remote_config &cfg) const noexcept -> bool {
|
|
||||||
if (&cfg != this) {
|
|
||||||
return api_port == cfg.api_port &&
|
|
||||||
encryption_token == cfg.encryption_token &&
|
|
||||||
host_name_or_ip == cfg.host_name_or_ip &&
|
|
||||||
max_connections == cfg.max_connections &&
|
|
||||||
recv_timeout_ms == cfg.recv_timeout_ms &&
|
|
||||||
send_timeout_ms == cfg.send_timeout_ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto operator!=(const remote_config &cfg) const noexcept -> bool {
|
|
||||||
if (&cfg != this) {
|
|
||||||
return not(cfg == *this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct remote_mount final {
|
|
||||||
std::uint16_t api_port{};
|
|
||||||
std::uint8_t client_pool_size{default_remote_client_pool_size};
|
|
||||||
bool enable{false};
|
|
||||||
std::string encryption_token;
|
|
||||||
|
|
||||||
auto operator==(const remote_mount &cfg) const noexcept -> bool {
|
|
||||||
if (&cfg == this) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return api_port == cfg.api_port &&
|
|
||||||
client_pool_size == cfg.client_pool_size && enable == cfg.enable &&
|
|
||||||
encryption_token == cfg.encryption_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto operator!=(const remote_mount &cfg) const noexcept -> bool {
|
|
||||||
if (&cfg == this) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return not(cfg == *this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
using block_count = std::uint64_t;
|
using block_count = std::uint64_t;
|
||||||
using block_size = std::uint32_t;
|
using block_size = std::uint32_t;
|
||||||
using file_handle = std::uint64_t;
|
using file_handle = std::uint64_t;
|
||||||
@ -222,46 +160,4 @@ create_os_open_flags(const open_flags &flags) -> std::uint32_t;
|
|||||||
#endif // !defined(_WIN32)
|
#endif // !defined(_WIN32)
|
||||||
} // namespace repertory::remote
|
} // namespace repertory::remote
|
||||||
|
|
||||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
#endif // INCLUDE_TYPES_REMOTE_HPP_
|
||||||
template <> struct adl_serializer<repertory::remote::remote_config> {
|
|
||||||
static void to_json(json &data,
|
|
||||||
const repertory::remote::remote_config &value) {
|
|
||||||
data[repertory::JSON_API_PORT] = value.api_port;
|
|
||||||
data[repertory::JSON_ENCRYPTION_TOKEN] = value.encryption_token;
|
|
||||||
data[repertory::JSON_HOST_NAME_OR_IP] = value.host_name_or_ip;
|
|
||||||
data[repertory::JSON_MAX_CONNECTIONS] = value.max_connections;
|
|
||||||
data[repertory::JSON_RECV_TIMEOUT_MS] = value.recv_timeout_ms;
|
|
||||||
data[repertory::JSON_SEND_TIMEOUT_MS] = value.send_timeout_ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void from_json(const json &data,
|
|
||||||
repertory::remote::remote_config &value) {
|
|
||||||
data.at(repertory::JSON_API_PORT).get_to(value.api_port);
|
|
||||||
data.at(repertory::JSON_ENCRYPTION_TOKEN).get_to(value.encryption_token);
|
|
||||||
data.at(repertory::JSON_HOST_NAME_OR_IP).get_to(value.host_name_or_ip);
|
|
||||||
data.at(repertory::JSON_MAX_CONNECTIONS).get_to(value.max_connections);
|
|
||||||
data.at(repertory::JSON_RECV_TIMEOUT_MS).get_to(value.recv_timeout_ms);
|
|
||||||
data.at(repertory::JSON_SEND_TIMEOUT_MS).get_to(value.send_timeout_ms);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct adl_serializer<repertory::remote::remote_mount> {
|
|
||||||
static void to_json(json &data,
|
|
||||||
const repertory::remote::remote_mount &value) {
|
|
||||||
data[repertory::JSON_API_PORT] = value.api_port;
|
|
||||||
data[repertory::JSON_CLIENT_POOL_SIZE] = value.client_pool_size;
|
|
||||||
data[repertory::JSON_ENABLE_REMOTE_MOUNT] = value.enable;
|
|
||||||
data[repertory::JSON_ENCRYPTION_TOKEN] = value.encryption_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void from_json(const json &data,
|
|
||||||
repertory::remote::remote_mount &value) {
|
|
||||||
data.at(repertory::JSON_API_PORT).get_to(value.api_port);
|
|
||||||
data.at(repertory::JSON_CLIENT_POOL_SIZE).get_to(value.client_pool_size);
|
|
||||||
data.at(repertory::JSON_ENABLE_REMOTE_MOUNT).get_to(value.enable);
|
|
||||||
data.at(repertory::JSON_ENCRYPTION_TOKEN).get_to(value.encryption_token);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
NLOHMANN_JSON_NAMESPACE_END
|
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_TYPES_REMOTE_HPP_
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user