mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
Compare commits
1966
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba9b7b62d7 | ||
|
|
79168ab0bb | ||
|
|
308ac1d0d2 | ||
|
|
9123d799b8 | ||
|
|
319ab6d98f | ||
|
|
68eacc2226 | ||
|
|
1818e7d997 | ||
|
|
4b444d58ee | ||
|
|
13715fb851 | ||
|
|
68028ee876 | ||
|
|
260b038441 | ||
|
|
f84eb801ff | ||
|
|
c4b15a98c6 | ||
|
|
fe3805d1cb | ||
|
|
469afddc80 | ||
|
|
3cb2333679 | ||
|
|
2a19511ba8 | ||
|
|
d3660ffce8 | ||
|
|
069c641d7c | ||
|
|
3078cb96a9 | ||
|
|
cf67cf29a1 | ||
|
|
253f190f48 | ||
|
|
a508d56021 | ||
|
|
9eb2bee86a | ||
|
|
ba923e2864 | ||
|
|
332668a3fd | ||
|
|
c043fd17cb | ||
|
|
49f40cd145 | ||
|
|
852ee21835 | ||
|
|
be946c9e54 | ||
|
|
141d302492 | ||
|
|
d3839fe279 | ||
|
|
5333f2984a | ||
|
|
36d13355bb | ||
|
|
07fb21c7f0 | ||
|
|
eb6e448e7a | ||
|
|
ece1d38ea4 | ||
|
|
9546104961 | ||
|
|
2c72447078 | ||
|
|
e716ec9908 | ||
|
|
cab7fc7738 | ||
|
|
f64dc7465b | ||
|
|
16634235c1 | ||
|
|
d11cfdb356 | ||
|
|
52712782a2 | ||
|
|
2fb740a2b9 | ||
|
|
7b7f4215aa | ||
|
|
6071be104b | ||
|
|
3ac54792e1 | ||
|
|
39bf274a83 | ||
|
|
93d0ad09af | ||
|
|
13e79892d1 | ||
|
|
3e899bfc68 | ||
|
|
66d04cb83f | ||
|
|
42cb9b76c4 | ||
|
|
21315f709d | ||
|
|
42b8f1145a | ||
|
|
39ea8484c1 | ||
|
|
168f461761 | ||
|
|
8f78a069c6 | ||
|
|
4a490fe35a | ||
|
|
5741134ca0 | ||
|
|
d9189c857c | ||
|
|
df4b9df142 | ||
|
|
ec5a305624 | ||
|
|
9d3be33e5c | ||
|
|
2371770fe8 | ||
|
|
36d1e739e6 | ||
|
|
adf12c8825 | ||
|
|
1bfb96f34d | ||
|
|
29f1673d97 | ||
|
|
6946c51430 | ||
|
|
6b39effe7f | ||
|
|
c28e8a2397 | ||
|
|
ffa2827ab1 | ||
|
|
63619f8b8e | ||
|
|
52b24a9902 | ||
|
|
fb43a9d7b9 | ||
|
|
e2276b0626 | ||
|
|
09383860e9 | ||
|
|
093f8bb917 | ||
|
|
31038acccf | ||
|
|
060ce1d9a2 | ||
|
|
5f8c8caec6 | ||
|
|
d5197d6a50 | ||
|
|
650d1af978 | ||
|
|
091f6297c4 | ||
|
|
aea86cbf89 | ||
|
|
b0838db5a8 | ||
|
|
ce566f579e | ||
|
|
c85ee7c0fd | ||
|
|
4119c61df8 | ||
|
|
5b50182658 | ||
|
|
7ace0efd65 | ||
|
|
738247d47e | ||
|
|
c6b646e92c | ||
|
|
bea162c34c | ||
|
|
d3be8e022f | ||
|
|
f0677c5af1 | ||
|
|
db22666a30 | ||
|
|
4263805c78 | ||
|
|
a3def2bbd9 | ||
|
|
44d7a49a48 | ||
|
|
57e159b369 | ||
|
|
c6a567acab | ||
|
|
7a6f49cd42 | ||
|
|
ceca078acb | ||
|
|
021f5d689b | ||
|
|
b089f1a492 | ||
|
|
11eb014311 | ||
|
|
f970abf14a | ||
|
|
6ecefad692 | ||
|
|
1cbd53c01c | ||
|
|
d9871e92d2 | ||
|
|
76cba561cf | ||
|
|
871dee4674 | ||
|
|
86dd933596 | ||
|
|
444dfded84 | ||
|
|
2e32b44061 | ||
|
|
6344469a9b | ||
|
|
d64546c791 | ||
|
|
e12b6c0306 | ||
|
|
0ed816d4e9 | ||
|
|
fb1ed0e30d | ||
|
|
19d546938a | ||
|
|
60d3681371 | ||
|
|
393e1f70ad | ||
|
|
99256100a0 | ||
|
|
e5ad2223a1 | ||
|
|
c9b3ef58de | ||
|
|
2f2e417b68 | ||
|
|
b282e34dc2 | ||
|
|
5065d4ab2d | ||
|
|
b318167cd3 | ||
|
|
06474e5990 | ||
|
|
ee3fe07acf | ||
|
|
469863f7f0 | ||
|
|
d2924c7748 | ||
|
|
cb5a10c6a3 | ||
|
|
f1db22d48b | ||
|
|
4fcfc9410f | ||
|
|
9655dc9ca9 | ||
|
|
f8eb988347 | ||
|
|
60421b23f0 | ||
|
|
2929563294 | ||
|
|
d3b7965c76 | ||
|
|
d89774cb7f | ||
|
|
2e6a3c7b16 | ||
|
|
f224b9fe28 | ||
|
|
11b0a9cb76 | ||
|
|
a62adf62ca | ||
|
|
affe708961 | ||
|
|
a09eaf8756 | ||
|
|
8178fc9973 | ||
|
|
2697d6a4fb | ||
|
|
70008b093e | ||
|
|
0d095f72e4 | ||
|
|
a4ceb051a7 | ||
|
|
6e53c38c2f | ||
|
|
cbd94b18a5 | ||
|
|
6e11923551 | ||
|
|
ed8efb5aef | ||
|
|
60db731e36 | ||
|
|
f9dbaf6292 | ||
|
|
c77c4e3c60 | ||
|
|
8d3f9c0b75 | ||
|
|
1a64a817ac | ||
|
|
85d1d99459 | ||
|
|
6c45787a37 | ||
|
|
ff4189ab25 | ||
|
|
8dfac6a4cf | ||
|
|
f050b22d6c | ||
|
|
1fcbed4e90 | ||
|
|
776308c4eb | ||
|
|
93e0dddbf3 | ||
|
|
3c54b3cff4 | ||
|
|
a64613172d | ||
|
|
3674ad9f8e | ||
|
|
db584ff7f8 | ||
|
|
6219a9ad1f | ||
|
|
4c97ff3717 | ||
|
|
200cbcde62 | ||
|
|
a11c28cb4c | ||
|
|
79371c03a8 | ||
|
|
fe31f389b0 | ||
|
|
29eff0ecd7 | ||
|
|
082bb49c7c | ||
|
|
854fb38612 | ||
|
|
9e98bba206 | ||
|
|
6a756136ef | ||
|
|
c58b73ad9b | ||
|
|
7f1de86779 | ||
|
|
b861899919 | ||
|
|
a846a11e10 | ||
|
|
07f635c3bc | ||
|
|
82a5d39778 | ||
|
|
496a7398d1 | ||
|
|
037b2b0135 | ||
|
|
201c24c110 | ||
|
|
f4ad5b0579 | ||
|
|
f3f0f9750a | ||
|
|
46eb77f9bb | ||
|
|
eec951cad2 | ||
|
|
f8b2d3cacc | ||
|
|
66a353dcb5 | ||
|
|
fda771c83f | ||
|
|
b423bb9e2d | ||
|
|
333709657c | ||
|
|
f9410bcaa7 | ||
|
|
8301519fb0 | ||
|
|
db152ca540 | ||
|
|
67d1e572ca | ||
|
|
b1daede91b | ||
|
|
91ac2e0dd9 | ||
|
|
249eeccf32 | ||
|
|
9db53cf256 | ||
|
|
ff66269b62 | ||
|
|
3ddcd87098 | ||
|
|
ab85118233 | ||
|
|
41aba0c02c | ||
|
|
4af6b4eb0e | ||
|
|
556382ff5f | ||
|
|
64ed47502b | ||
|
|
08266b7256 | ||
|
|
1d7e01b754 | ||
|
|
da6154b29c | ||
|
|
60d2f1557d | ||
|
|
b7763c1cb6 | ||
|
|
3f6f50d0ba | ||
|
|
9f4c2f87d3 | ||
|
|
453d0be4d4 | ||
|
|
88ad8d3a89 | ||
|
|
4db68669b6 | ||
|
|
1d3f045e85 | ||
|
|
96a23591e7 | ||
|
|
dbe33236fb | ||
|
|
fffbc2d490 | ||
|
|
a5b5887efc | ||
|
|
84d4a2c8a0 | ||
|
|
f8c2704d2b | ||
|
|
14858f6224 | ||
|
|
04da4c8094 | ||
|
|
4a8ef198d7 | ||
|
|
56c5c7b1b6 | ||
|
|
e8ef501f02 | ||
|
|
56a5d5af8d | ||
|
|
98384b62fd | ||
|
|
f11d531d45 | ||
|
|
06c43286cd | ||
|
|
746017ea4f | ||
|
|
f7ff84f17f | ||
|
|
97ecd20fc9 | ||
|
|
8904bc4cde | ||
|
|
f53632a84b | ||
|
|
b5f3578fe4 | ||
|
|
83ab3966d1 | ||
|
|
a362261972 | ||
|
|
31ed352ab6 | ||
|
|
60c1ada4c1 | ||
|
|
578f8a6dec | ||
|
|
200d9b9ac2 | ||
|
|
a60767c43a | ||
|
|
12ba8b9799 | ||
|
|
b1b8c4ed32 | ||
|
|
b16d47030e | ||
|
|
9fe24991d5 | ||
|
|
7d6b2a4740 | ||
|
|
420f068376 | ||
|
|
d3e1f20dcc | ||
|
|
13d6a74eb2 | ||
|
|
fdc8a267de | ||
|
|
9a3d46f8e3 | ||
|
|
01ceace18e | ||
|
|
402ab598b6 | ||
|
|
7bb62b9f21 | ||
|
|
f905a1e779 | ||
|
|
db69ce89f0 | ||
|
|
a6cfaba018 | ||
|
|
d6d62e8d4b | ||
|
|
a8cd7df44a | ||
|
|
d5149e592e | ||
|
|
d9b32db8d7 | ||
|
|
f5471bcebf | ||
|
|
25fb6f9a46 | ||
|
|
779641e9d4 | ||
|
|
b7a375f5aa | ||
|
|
4e1f1a0b92 | ||
|
|
788acdf527 | ||
|
|
865a017936 | ||
|
|
97575e7185 | ||
|
|
70e67b7c6d | ||
|
|
5c6e3f457f | ||
|
|
bc03233364 | ||
|
|
d923ba2206 | ||
|
|
bea4f6ca14 | ||
|
|
f628953c33 | ||
|
|
f6d8525d1d | ||
|
|
98d9aadd37 | ||
|
|
bcd06304cc | ||
|
|
439e88b5a6 | ||
|
|
47b2e49068 | ||
|
|
2bd2959ac3 | ||
|
|
bb7e165ce8 | ||
|
|
1690a080b2 | ||
|
|
bc025d5305 | ||
|
|
267201ff44 | ||
|
|
109385e955 | ||
|
|
296acc4a0a | ||
|
|
164091c269 | ||
|
|
9b3bf0e46c | ||
|
|
bc8d34143d | ||
|
|
1937be2bb2 | ||
|
|
d7a4b12d2a | ||
|
|
83ca595472 | ||
|
|
747377142b | ||
|
|
dd37f0540f | ||
|
|
75e749039b | ||
|
|
43ff60cb23 | ||
|
|
40d19d2064 | ||
|
|
f177cec509 | ||
|
|
d614716ff2 | ||
|
|
ce6a2140a2 | ||
|
|
7f760f16b0 | ||
|
|
35bafd9861 | ||
|
|
7ad5a90127 | ||
|
|
2ed6d8cca6 | ||
|
|
03f852c799 | ||
|
|
0b0ece9649 | ||
|
|
0adb2ba6b8 | ||
|
|
06b81c063a | ||
|
|
4fbb57f789 | ||
|
|
aafe8d84cb | ||
|
|
88f1d32cc4 | ||
|
|
acd8836d27 | ||
|
|
73f331df84 | ||
|
|
76cbe8bf33 | ||
|
|
5ccf8e8078 | ||
|
|
ac793a3c5a | ||
|
|
d361a1ddf5 | ||
|
|
694f93de80 | ||
|
|
37e4e022fd | ||
|
|
6e3f4d1079 | ||
|
|
98b8f8649d | ||
|
|
2b4277ec18 | ||
|
|
ae4e654d2a | ||
|
|
b23883b3b6 | ||
|
|
1f030af06f | ||
|
|
bb92fd1db0 | ||
|
|
53d171cf5b | ||
|
|
906472b21d | ||
|
|
f22d6b87e1 | ||
|
|
748870b03f | ||
|
|
95b997fb35 | ||
|
|
f827ada811 | ||
|
|
c91372daa6 | ||
|
|
ee920d4f83 | ||
|
|
708acee502 | ||
|
|
9b51ed7af2 | ||
|
|
ae9b81c18f | ||
|
|
5c467083e5 | ||
|
|
f036ef8a3c | ||
|
|
75d63db60d | ||
|
|
eca4b928d2 | ||
|
|
b931ced0a3 | ||
|
|
2e427c66ac | ||
|
|
c81f1cda47 | ||
|
|
fa3ded4134 | ||
|
|
495a776671 | ||
|
|
44d8e35988 | ||
|
|
d09606c65b | ||
|
|
032f1226db | ||
|
|
452bd0b013 | ||
|
|
d3205a0070 | ||
|
|
97603d6e17 | ||
|
|
b5100a7aaf | ||
|
|
7214a8e265 | ||
|
|
cfbfc7cb67 | ||
|
|
4e0522a80c | ||
|
|
888eb2abb5 | ||
|
|
1d779389cb | ||
|
|
01bcc89803 | ||
|
|
1ab8232b55 | ||
|
|
e8d4be579d | ||
|
|
a12c7b86b0 | ||
|
|
f82ac793b4 | ||
|
|
10bb76fe6b | ||
|
|
4d322df95e | ||
|
|
0d98949199 | ||
|
|
e4b7e31902 | ||
|
|
57ded4fd80 | ||
|
|
ea8ecf35f4 | ||
|
|
655b449270 | ||
|
|
0fb4f59fa6 | ||
|
|
69d1b88b9e | ||
|
|
e8a5ee4f48 | ||
|
|
77fadab560 | ||
|
|
4f317c7e3d | ||
|
|
0b99557c29 | ||
|
|
9bf93e698e | ||
|
|
aae77e8ea3 | ||
|
|
c7af289f4b | ||
|
|
5a237af973 | ||
|
|
6491192aa3 | ||
|
|
a9069520ae | ||
|
|
04356ad141 | ||
|
|
6039b25bc9 | ||
|
|
3c7ffa2a2c | ||
|
|
ebad3a44ab | ||
|
|
7f32eb1e25 | ||
|
|
c133e72f62 | ||
|
|
ff331178aa | ||
|
|
7e76a7d21b | ||
|
|
1c77d323b0 | ||
|
|
5e55f0da4d | ||
|
|
19c537b687 | ||
|
|
20853972b2 | ||
|
|
056871242b | ||
|
|
0655151b8c | ||
|
|
6319d84f42 | ||
|
|
922c614bde | ||
|
|
16c66e097b | ||
|
|
3423c1da18 | ||
|
|
49375d6031 | ||
|
|
5068b6ae7d | ||
|
|
12825938d7 | ||
|
|
8f240276db | ||
|
|
bfa87b4f50 | ||
|
|
648626115a | ||
|
|
12e6ccc581 | ||
|
|
702d7ac424 | ||
|
|
852af28f91 | ||
|
|
6f30a78a6c | ||
|
|
7e2031b18f | ||
|
|
dc8dd8b486 | ||
|
|
c98df05ed0 | ||
|
|
feb8eeb830 | ||
|
|
8480008a9a | ||
|
|
80d80daf64 | ||
|
|
dad733086a | ||
|
|
e73b859b1d | ||
|
|
568132c0c9 | ||
|
|
13e5541e17 | ||
|
|
a09ef6002a | ||
|
|
feea33d5e0 | ||
|
|
d429b6296b | ||
|
|
c7228fefa7 | ||
|
|
702fbdf731 | ||
|
|
834a25f084 | ||
|
|
7abfab8e77 | ||
|
|
3edfe1d28f | ||
|
|
85eae57e4c | ||
|
|
67763fb375 | ||
|
|
6d58916cfd | ||
|
|
842dab07b4 | ||
|
|
a51aa4c586 | ||
|
|
9e974f6a1b | ||
|
|
cf5739946b | ||
|
|
1ed41f8b21 | ||
|
|
c523bc4f07 | ||
|
|
2fd48df9d9 | ||
|
|
f7afa80250 | ||
|
|
1e1c368ae8 | ||
|
|
007c4a1965 | ||
|
|
8a12fd9ec4 | ||
|
|
6c4fee85e3 | ||
|
|
e2849a36e5 | ||
|
|
3db6182181 | ||
|
|
940b5edcaa | ||
|
|
50d351944f | ||
|
|
d0982cafa7 | ||
|
|
5b1fd374be | ||
|
|
d4d7ced922 | ||
|
|
922032b9bb | ||
|
|
702ff48cda | ||
|
|
2ad45ca04f | ||
|
|
5bfb72d058 | ||
|
|
aba1fe01b3 | ||
|
|
defcd4edc5 | ||
|
|
c8234a5af6 | ||
|
|
79d18c69b4 | ||
|
|
77fc8c5914 | ||
|
|
28e5f20c8e | ||
|
|
9e6ad558c5 | ||
|
|
9bcaa65574 | ||
|
|
0d83c1b91e | ||
|
|
018a9a20be | ||
|
|
cb19a7da99 | ||
|
|
ef98d26c9e | ||
|
|
afc1532b24 | ||
|
|
233a9a9b6c | ||
|
|
49f4216280 | ||
|
|
7f6500ae07 | ||
|
|
f339e9c284 | ||
|
|
03a0def4c3 | ||
|
|
9ba335a7c4 | ||
|
|
b46cf2bb0e | ||
|
|
c0122eeef3 | ||
|
|
f1e3ac5dec | ||
|
|
16e72211c9 | ||
|
|
cf76711789 | ||
|
|
241039ebbe | ||
|
|
697427b584 | ||
|
|
3a6f9c9bcf | ||
|
|
7f7e4e9885 | ||
|
|
3699996985 | ||
|
|
00fbca99dc | ||
|
|
131dfd0c19 | ||
|
|
a8d343318b | ||
|
|
f0845c7fff | ||
|
|
14c6f12b0c | ||
|
|
a08f8a4b80 | ||
|
|
db0c25b3d8 | ||
|
|
eb2acd11c2 | ||
|
|
5519dbd445 | ||
|
|
7b621bb5e1 | ||
|
|
0467195f07 | ||
|
|
4433b4c006 | ||
|
|
03f50180f3 | ||
|
|
69b4f93830 | ||
|
|
17918f0b82 | ||
|
|
eaf000eff1 | ||
|
|
d2a811eef2 | ||
|
|
5bd72696ac | ||
|
|
98110c1697 | ||
|
|
f1273073fc | ||
|
|
cec1d97035 | ||
|
|
ae23e46313 | ||
|
|
e755540be9 | ||
|
|
daabdfe357 | ||
|
|
5c25d29272 | ||
|
|
b3447f4375 | ||
|
|
6816661b0f | ||
|
|
299312c805 | ||
|
|
95fe745a0c | ||
|
|
c546c309f1 | ||
|
|
a146a48ccc | ||
|
|
ebf58709d3 | ||
|
|
43e3f5724c | ||
|
|
a6f7f9b0b8 | ||
|
|
7efeb146c5 | ||
|
|
4d1eedfa28 | ||
|
|
dc13e10637 | ||
|
|
a218eaf1f0 | ||
|
|
430eb67489 | ||
|
|
44acf4b756 | ||
|
|
0301504184 | ||
|
|
26e7cd8c75 | ||
|
|
2fe0d479f1 | ||
|
|
2d7dea1a09 | ||
|
|
8a48baa056 | ||
|
|
78aabf66ce | ||
|
|
4e3ea49cff | ||
|
|
c4b92e17d0 | ||
|
|
74332e1a61 | ||
|
|
be0e88a606 | ||
|
|
5c4480ec6c | ||
|
|
8ab7dd9d08 | ||
|
|
d0b238d2db | ||
|
|
07e0d13d2d | ||
|
|
dd5661b297 | ||
|
|
9b603f5ffa | ||
|
|
8db9319a06 | ||
|
|
480a073f1f | ||
|
|
5b844d7011 | ||
|
|
8b0718ac92 | ||
|
|
458ada173e | ||
|
|
8647191bee | ||
|
|
03d76479a5 | ||
|
|
a6a6b87f1b | ||
|
|
ab86d263c9 | ||
|
|
603de2d5db | ||
|
|
f124ebab1d | ||
|
|
1c0a2a7db8 | ||
|
|
869161a261 | ||
|
|
87b3b84471 | ||
|
|
955eae3500 | ||
|
|
2da84ed331 | ||
|
|
68bcaff14d | ||
|
|
c1e353491a | ||
|
|
828e4a5ace | ||
|
|
9e77563c99 | ||
|
|
c34feca59c | ||
|
|
6de84c64c6 | ||
|
|
72fc001d0d | ||
|
|
ac66c133a5 | ||
|
|
6d1bcd4b8c | ||
|
|
0a223838bd | ||
|
|
f8776ad5cd | ||
|
|
a01557f4cb | ||
|
|
c11d84f314 | ||
|
|
7b81cf3762 | ||
|
|
9f4f8de9ad | ||
|
|
e18c7e160c | ||
|
|
d773e11c7a | ||
|
|
00d0274fd7 | ||
|
|
849b6ec28d | ||
|
|
d84b80b795 | ||
|
|
536559f62d | ||
|
|
1675243f29 | ||
|
|
e97c60cc10 | ||
|
|
468514f525 | ||
|
|
3a3553dc46 | ||
|
|
88d608b661 | ||
|
|
69b9d8c3c2 | ||
|
|
873868cc10 | ||
|
|
7362de9a18 | ||
|
|
03fd66e209 | ||
|
|
04c2c5e58d | ||
|
|
c5a63f4775 | ||
|
|
6ce0097846 | ||
|
|
9dd228747c | ||
|
|
f07482382b | ||
|
|
cd47528a75 | ||
|
|
cc66e25cd2 | ||
|
|
7ca5052942 | ||
|
|
793dd81ca2 | ||
|
|
ab4ddb1e0e | ||
|
|
e31c514b00 | ||
|
|
6bf31467c7 | ||
|
|
b303a02461 | ||
|
|
c7a71d35b0 | ||
|
|
58954bf46f | ||
|
|
67401f1908 | ||
|
|
c5cf9bd290 | ||
|
|
f01d5616b3 | ||
|
|
a4740ca836 | ||
|
|
2dd5b777f7 | ||
|
|
75a2b05aa3 | ||
|
|
fc7f81f6e7 | ||
|
|
9ecbf92569 | ||
|
|
81af1bafba | ||
|
|
a808df5019 | ||
|
|
8a1d640dc4 | ||
|
|
9f345da20f | ||
|
|
942c2cbd7b | ||
|
|
57c5405657 | ||
|
|
6db1c8bafb | ||
|
|
e2c7be3a2e | ||
|
|
43a69d20bf | ||
|
|
4936d6c342 | ||
|
|
cb6b1d8d41 | ||
|
|
be58993f47 | ||
|
|
b857cf9d9b | ||
|
|
456738ba64 | ||
|
|
2cada598c6 | ||
|
|
f3e07c231b | ||
|
|
4d5e1e5947 | ||
|
|
7f49514f6f | ||
|
|
fffb14bc87 | ||
|
|
050ab19264 | ||
|
|
94a35f25f3 | ||
|
|
63c4884b16 | ||
|
|
b9068c1304 | ||
|
|
02a1597642 | ||
|
|
230258702f | ||
|
|
e4b1e5c3c8 | ||
|
|
d49e91cd78 | ||
|
|
69facc0e2f | ||
|
|
15b8499f8d | ||
|
|
01dc9e8abb | ||
|
|
d712c87ec0 | ||
|
|
6448e0c25d | ||
|
|
8c64d06b3a | ||
|
|
da0d090af9 | ||
|
|
b3d1db249d | ||
|
|
9cd6b33e97 | ||
|
|
4b9b9547d4 | ||
|
|
fc3924ac70 | ||
|
|
b2b8a003c1 | ||
|
|
371ad2e397 | ||
|
|
61ff330e99 | ||
|
|
1d09291f95 | ||
|
|
70f6740309 | ||
|
|
9026b3e86e | ||
|
|
97f757c669 | ||
|
|
d8c275306e | ||
|
|
70c5cbd436 | ||
|
|
a44700ed1f | ||
|
|
8b4597aefa | ||
|
|
6d4925af17 | ||
|
|
0e67fa9688 | ||
|
|
ef6224e45d | ||
|
|
e7e378c211 | ||
|
|
5a1fc03545 | ||
|
|
e1530dc190 | ||
|
|
7c1008e5e5 | ||
|
|
2815e3bae9 | ||
|
|
f080ca43df | ||
|
|
5409dfbb0f | ||
|
|
a2112e1be0 | ||
|
|
3288d729ae | ||
|
|
58344980e4 | ||
|
|
f7c22f0159 | ||
|
|
b3f714612d | ||
|
|
52fc476a6f | ||
|
|
dbee816205 | ||
|
|
3a8746ca54 | ||
|
|
1129956f7f | ||
|
|
3bf883327e | ||
|
|
e0dfa7a069 | ||
|
|
0909f669a0 | ||
|
|
4a0939a4e4 | ||
|
|
f9a1769df1 | ||
|
|
1fbb8723dc | ||
|
|
2c7dad589d | ||
|
|
72e89b615b | ||
|
|
761c0eb1ed | ||
|
|
5047bdb4a2 | ||
|
|
f5bed84340 | ||
|
|
83efe1547d | ||
|
|
48919009fc | ||
|
|
f66fef0ec5 | ||
|
|
478fe0ecf2 | ||
|
|
7ecc0f4b11 | ||
|
|
021ef0d14b | ||
|
|
e3fc676260 | ||
|
|
82c3ccc8dd | ||
|
|
80cefade65 | ||
|
|
bd97cbc523 | ||
|
|
c5f23b26fc | ||
|
|
a7faefd4ce | ||
|
|
b3513d3167 | ||
|
|
4ce6586710 | ||
|
|
68e2dee2cd | ||
|
|
366fe0d394 | ||
|
|
9fcff1bd9a | ||
|
|
7ab9160ee1 | ||
|
|
a337b844ec | ||
|
|
e936fe9001 | ||
|
|
c46e91d229 | ||
|
|
37b79174d1 | ||
|
|
b095496d30 | ||
|
|
14ec3bfc1d | ||
|
|
427c7fbf93 | ||
|
|
a72c92e55f | ||
|
|
3a67b6ddc1 | ||
|
|
7f85e15990 | ||
|
|
b20cdff82d | ||
|
|
813a4f7456 | ||
|
|
470d950918 | ||
|
|
4049c72e6c | ||
|
|
30f138a538 | ||
|
|
41f686ab9d | ||
|
|
98d66a569b | ||
|
|
654173e7c7 | ||
|
|
543476cba1 | ||
|
|
9a8e020559 | ||
|
|
f0d140f164 | ||
|
|
ee6067e98c | ||
|
|
c2ce97785f | ||
|
|
f302c9fda2 | ||
|
|
3cb0071025 | ||
|
|
043b7a7c65 | ||
|
|
bfd2739fce | ||
|
|
0656838fe5 | ||
|
|
4fb5bb09b6 | ||
|
|
e074a54a20 | ||
|
|
492f93416d | ||
|
|
18b3afc97a | ||
|
|
0c898df430 | ||
|
|
c8f54aad8b | ||
|
|
8de0027df5 | ||
|
|
5b0f5f456e | ||
|
|
59022b6fe0 | ||
|
|
8b15523c9d | ||
|
|
e05cc109a6 | ||
|
|
a55ae8ad52 | ||
|
|
76da296799 | ||
|
|
3065506b38 | ||
|
|
d953ed442c | ||
|
|
1be354bdce | ||
|
|
adc8d344a5 | ||
|
|
e767c3ea4f | ||
|
|
e46c3415f7 | ||
|
|
4beaaa0650 | ||
|
|
9fa648e570 | ||
|
|
66e7013dfe | ||
|
|
07a51815e9 | ||
|
|
90a6f43c56 | ||
|
|
53cf1b4900 | ||
|
|
ed44f12f6d | ||
|
|
7b6837cbc2 | ||
|
|
b14332df96 | ||
|
|
da9b672d1b | ||
|
|
86a7c56275 | ||
|
|
13e7069eb9 | ||
|
|
54dd925283 | ||
|
|
80398a2a3a | ||
|
|
4f28876c8d | ||
|
|
e61c9af523 | ||
|
|
4d1ac7332e | ||
|
|
e2100d0626 | ||
|
|
47b6ce93f8 | ||
|
|
0d8cf87a8c | ||
|
|
f9c20aff9d | ||
|
|
83ce8c30fc | ||
|
|
19159ec479 | ||
|
|
9cb034d49e | ||
|
|
d1562e48e1 | ||
|
|
dc42d15352 | ||
|
|
4d3353750e | ||
|
|
297f64e286 | ||
|
|
8fb29e5230 | ||
|
|
2d13382c68 | ||
|
|
d96d0a87cf | ||
|
|
f7ff98c747 | ||
|
|
5b18cf09e7 | ||
|
|
6b5867ce9d | ||
|
|
43e655afc8 | ||
|
|
cc34ac0bd5 | ||
|
|
e88795be13 | ||
|
|
b18ec59c56 | ||
|
|
10853e4d2f | ||
|
|
a1783a14cc | ||
|
|
855058858a | ||
|
|
64509dd6ca | ||
|
|
924f797c58 | ||
|
|
e025fc00a4 | ||
|
|
5ee7fdc0cc | ||
|
|
3450eff288 | ||
|
|
3e29d0f75b | ||
|
|
809aa028ec | ||
|
|
89ccb6be05 | ||
|
|
5385bf9555 | ||
|
|
9ba52db585 | ||
|
|
dcaf1796fe | ||
|
|
f54f530ada | ||
|
|
d0cc9a5634 | ||
|
|
b9f385bd66 | ||
|
|
096ffa9744 | ||
|
|
3320e495f4 | ||
|
|
57005ed7f8 | ||
|
|
36f9633223 | ||
|
|
df49692dff | ||
|
|
05eda424fc | ||
|
|
4194ae33fd | ||
|
|
88d0df523e | ||
|
|
54bd1c406a | ||
|
|
48a24559a3 | ||
|
|
79fdea0de4 | ||
|
|
7d73bbb073 | ||
|
|
7d382ba5fe | ||
|
|
ce1f7ab662 | ||
|
|
ed848425c7 | ||
|
|
dffad65f2f | ||
|
|
7e29218327 | ||
|
|
8fa61c28e4 | ||
|
|
61550f1b0a | ||
|
|
0fbec28858 | ||
|
|
1bc041b46d | ||
|
|
603f8e4f86 | ||
|
|
01cbd5cb58 | ||
|
|
1c36706306 | ||
|
|
99e47fc5fc | ||
|
|
78474409a5 | ||
|
|
1c2affea8e | ||
|
|
0559aa9673 | ||
|
|
c4b7966dbe | ||
|
|
3aa021a812 | ||
|
|
e7b237c8da | ||
|
|
b0035747e3 | ||
|
|
9992fe648d | ||
|
|
a3c8235f86 | ||
|
|
fa8198f44b | ||
|
|
f04d8fcbcc | ||
|
|
d5b0538f7b | ||
|
|
01d3f69c52 | ||
|
|
a89a3c86d0 | ||
|
|
0d331c1e3a | ||
|
|
0f4c7dd8fd | ||
|
|
ce99bb927d | ||
|
|
34837afc7a | ||
|
|
14d4252904 | ||
|
|
6d12230021 | ||
|
|
09059bfdcc | ||
|
|
b6ce40e87f | ||
|
|
87fee21ef5 | ||
|
|
761ef1c73e | ||
|
|
52e55508da | ||
|
|
b9b3651a98 | ||
|
|
09bd3d015d | ||
|
|
0ba3f47e31 | ||
|
|
78678f4bcb | ||
|
|
185a916f5e | ||
|
|
a5be4a6d40 | ||
|
|
a57162e8bf | ||
|
|
cdae9fc680 | ||
|
|
40ba6d2a6f | ||
|
|
574cc41f0b | ||
|
|
dd84637c34 | ||
|
|
af905a3ff7 | ||
|
|
c63cebaee1 | ||
|
|
d3ae3a8e14 | ||
|
|
b38ff39e8b | ||
|
|
d981eb282f | ||
|
|
576573711a | ||
|
|
3d8df0f709 | ||
|
|
582d5d526c | ||
|
|
3713119ab9 | ||
|
|
2fa2235fe3 | ||
|
|
c527d85d97 | ||
|
|
16f6984d02 | ||
|
|
dda13def2a | ||
|
|
3018443cd7 | ||
|
|
2e74fb60c8 | ||
|
|
8dfe22ef1c | ||
|
|
339856eb78 | ||
|
|
5771225f54 | ||
|
|
079fdbad13 | ||
|
|
b617b13c43 | ||
|
|
d0dbf6d2ea | ||
|
|
b6de5f00b3 | ||
|
|
1f63094542 | ||
|
|
c601ef03b1 | ||
|
|
0647c75a06 | ||
|
|
101e784577 | ||
|
|
79b0a58132 | ||
|
|
356b8048c5 | ||
|
|
18cf59c375 | ||
|
|
fe8dc26849 | ||
|
|
cc01c352c3 | ||
|
|
a61453d3ec | ||
|
|
f6d75476b9 | ||
|
|
fa2a7b5f2f | ||
|
|
e416679cea | ||
|
|
3a25af223f | ||
|
|
26bb9094d4 | ||
|
|
0e3140c54c | ||
|
|
04380d6a36 | ||
|
|
d514b6f3f9 | ||
|
|
1ef81ac518 | ||
|
|
e20ef8a077 | ||
|
|
bb839ba268 | ||
|
|
96d2f11f81 | ||
|
|
b456173eb8 | ||
|
|
535b1610c8 | ||
|
|
4f47b8cff9 | ||
|
|
a6e948840d | ||
|
|
5ce6bbf076 | ||
|
|
caeffa3998 | ||
|
|
6df18a9181 | ||
|
|
46a89a7d61 | ||
|
|
59017da4f2 | ||
|
|
45a12505f2 | ||
|
|
8e67c4f597 | ||
|
|
c24c1ffd1a | ||
|
|
9d7868ee4e | ||
|
|
dfde029430 | ||
|
|
db1ac7b3eb | ||
|
|
4734efa9a1 | ||
|
|
57c85adc53 | ||
|
|
f8b03c45ef | ||
|
|
e639f1f889 | ||
|
|
f101ad6855 | ||
|
|
766512c475 | ||
|
|
3626ec5cf7 | ||
|
|
e8193ec201 | ||
|
|
596f58507e | ||
|
|
442e798985 | ||
|
|
1d86ac8761 | ||
|
|
c9e33d3709 | ||
|
|
adcfaa5735 | ||
|
|
6dd257a81f | ||
|
|
b03e7b26b5 | ||
|
|
3fb98a904b | ||
|
|
74b045e9b6 | ||
|
|
6e21aeea59 | ||
|
|
d1fd372eb2 | ||
|
|
f91baa4b4b | ||
|
|
0649d778a7 | ||
|
|
95e0d2f1b2 | ||
|
|
1b41b8682b | ||
|
|
274230dbcb | ||
|
|
6c5eddaf1d | ||
|
|
7a7f4cecbb | ||
|
|
b873b856f2 | ||
|
|
c67aee7012 | ||
|
|
112e2c6922 | ||
|
|
62f9ce180d | ||
|
|
eec72b5136 | ||
|
|
5364b3d8f5 | ||
|
|
b39c384d6d | ||
|
|
113392bce8 | ||
|
|
a192373c25 | ||
|
|
3523ad5239 | ||
|
|
18254d9aae | ||
|
|
f0cc264757 | ||
|
|
5d100994b1 | ||
|
|
a87fe8ffce | ||
|
|
7bc10d46e3 | ||
|
|
6876bfa685 | ||
|
|
7dcbbaa653 | ||
|
|
a2bb5a34fd | ||
|
|
ca2a6cc36b | ||
|
|
67cd8959bc | ||
|
|
c359a5117f | ||
|
|
cc4d475519 | ||
|
|
62074c7653 | ||
|
|
4c8367a8b3 | ||
|
|
f7f9129b05 | ||
|
|
a98f359122 | ||
|
|
a436b0345a | ||
|
|
61b1d73f5a | ||
|
|
7cf64ae07a | ||
|
|
40f7c5d286 | ||
|
|
166cc0d48a | ||
|
|
6c88abf62f | ||
|
|
963c36338a | ||
|
|
4e48f64512 | ||
|
|
4d56039ad4 | ||
|
|
9210bf4be1 | ||
|
|
3c9ef6245e | ||
|
|
688b99eb73 | ||
|
|
7ae7029154 | ||
|
|
e921cb1a9d | ||
|
|
df5e54e02a | ||
|
|
031d26527f | ||
|
|
521be17a9e | ||
|
|
f925374db6 | ||
|
|
90d410d627 | ||
|
|
b177afc326 | ||
|
|
aa44028b46 | ||
|
|
f240c57f16 | ||
|
|
82e6d67ccc | ||
|
|
4fda5f8bfd | ||
|
|
daac5de1ba | ||
|
|
a9a336fdff | ||
|
|
34963de458 | ||
|
|
662915e691 | ||
|
|
520875d455 | ||
|
|
d0e2475ece | ||
|
|
2c0a7fe75e | ||
|
|
de5e07ce3e | ||
|
|
6b0894d806 | ||
|
|
f825d23789 | ||
|
|
1817864a45 | ||
|
|
a4f64c0116 | ||
|
|
020dd480ed | ||
|
|
70d050416b | ||
|
|
dcb8215482 | ||
|
|
94757a209b | ||
|
|
805740069a | ||
|
|
faaf44f171 | ||
|
|
6983277042 | ||
|
|
2395ee9b2e | ||
|
|
3c48d871d1 | ||
|
|
5feae4f74c | ||
|
|
2dcdd121ec | ||
|
|
bbcde8a19d | ||
|
|
1e78b8bc28 | ||
|
|
2a777a970c | ||
|
|
91db227b27 | ||
|
|
1c6729d4c1 | ||
|
|
4b0904e9c4 | ||
|
|
7d1e9a6b8a | ||
|
|
320e946d50 | ||
|
|
c4897df09c | ||
|
|
8b1f83a0ed | ||
|
|
430f371a97 | ||
|
|
9b8f8f4bb9 | ||
|
|
d8bb3845ae | ||
|
|
9bf10975bd | ||
|
|
a6aa79aab2 | ||
|
|
2c595d2d16 | ||
|
|
a4d3f2da3d | ||
|
|
3476d31e50 | ||
|
|
8d10b91cf3 | ||
|
|
95855da282 | ||
|
|
3b2645979d | ||
|
|
418878edce | ||
|
|
30242409f4 | ||
|
|
fd2e6bcf5d | ||
|
|
26cdd11d8f | ||
|
|
51aac49e82 | ||
|
|
e09f45f5ed | ||
|
|
32ba7fc6c0 | ||
|
|
86cd40fba8 | ||
|
|
7272af8ec4 | ||
|
|
c86ae76e02 | ||
|
|
c89b4fd18b | ||
|
|
36a31771f1 | ||
|
|
8f88d382a5 | ||
|
|
d3d23e779a | ||
|
|
3afa3bea73 | ||
|
|
85bfab612c | ||
|
|
dc2c1aedcc | ||
|
|
c7cf4fa46c | ||
|
|
ebf8e9f663 | ||
|
|
4e1c30b60a | ||
|
|
99aee22e08 | ||
|
|
5646ca9458 | ||
|
|
96b73e3e94 | ||
|
|
3188382ea7 | ||
|
|
b8314fb054 | ||
|
|
66317b8438 | ||
|
|
dac3b592ed | ||
|
|
98d4adbb8a | ||
|
|
e9790c030e | ||
|
|
49b1ba5bbf | ||
|
|
8660ecc7ec | ||
|
|
50b909e537 | ||
|
|
5c760523be | ||
|
|
dc47db5512 | ||
|
|
b7a18580b8 | ||
|
|
c42d33e800 | ||
|
|
eaad4fa3c4 | ||
|
|
c65b9588e2 | ||
|
|
9cd221cc33 | ||
|
|
5c81fa1075 | ||
|
|
d47a6701c6 | ||
|
|
6f96862662 | ||
|
|
6e876e0582 | ||
|
|
3f253a587c | ||
|
|
382441f9ff | ||
|
|
71dfecd96d | ||
|
|
283138eb86 | ||
|
|
ea37a8ca64 | ||
|
|
86e80aa9a0 | ||
|
|
d09475d23b | ||
|
|
df17271f05 | ||
|
|
b9e8b5a816 | ||
|
|
1a194a578c | ||
|
|
d960e94290 | ||
|
|
08c41fc7e7 | ||
|
|
51432ac724 | ||
|
|
ba84350e58 | ||
|
|
bf32977dcb | ||
|
|
e736963f3c | ||
|
|
4d1ccf3e10 | ||
|
|
03d99503bb | ||
|
|
f0c2a2dcb3 | ||
|
|
41f29e9d8c | ||
|
|
c1bc529654 | ||
|
|
087b839354 | ||
|
|
67146ffa78 | ||
|
|
53b663af35 | ||
|
|
2a7972e8ea | ||
|
|
7cc1f473b6 | ||
|
|
49d639ecab | ||
|
|
c28d55d343 | ||
|
|
3a024d62df | ||
|
|
4483732b2c | ||
|
|
830a44a84a | ||
|
|
98aa9cc068 | ||
|
|
95c373e762 | ||
|
|
ce676ee100 | ||
|
|
fcfa4d4ca9 | ||
|
|
71e9b302d4 | ||
|
|
3ece066700 | ||
|
|
c37a20178e | ||
|
|
57496e522a | ||
|
|
b96911c517 | ||
|
|
1b6ab2f6af | ||
|
|
0d23f49f74 | ||
|
|
020ba6c9a8 | ||
|
|
add99ed57e | ||
|
|
43689146cc | ||
|
|
f56339f38d | ||
|
|
b113760cf4 | ||
|
|
78bc7b393f | ||
|
|
23012deccf | ||
|
|
b75ca9890d | ||
|
|
6fc72b19bb | ||
|
|
981c981fa8 | ||
|
|
62f5e35cbe | ||
|
|
85efc37320 | ||
|
|
b07d81fb08 | ||
|
|
b4cb8bfd27 | ||
|
|
6d9cab25d6 | ||
|
|
f511b507a5 | ||
|
|
d48d76cb4f | ||
|
|
853701cb6b | ||
|
|
9d8a6d2562 | ||
|
|
d5d7ea59a1 | ||
|
|
d33443906a | ||
|
|
709c6cf8b8 | ||
|
|
7be74c7d6a | ||
|
|
fb8c96c3e1 | ||
|
|
79127b267b | ||
|
|
5f9efceee3 | ||
|
|
25efb4debe | ||
|
|
a091e6f3bc | ||
|
|
1704e5f1a6 | ||
|
|
b2f636ab8c | ||
|
|
4ee766e966 | ||
|
|
89a06a8503 | ||
|
|
a506e7953f | ||
|
|
382c521df7 | ||
|
|
226df38c95 | ||
|
|
e282a9b06a | ||
|
|
3b1b955fc5 | ||
|
|
e0d8259d98 | ||
|
|
be35ec63cb | ||
|
|
7e0c080581 | ||
|
|
000c645d45 | ||
|
|
701bb9af19 | ||
|
|
2e0d0046c4 | ||
|
|
2df72001b2 | ||
|
|
2adf4a108b | ||
|
|
eff83a87d1 | ||
|
|
f7998f8652 | ||
|
|
714ccb6e2b | ||
|
|
1a04522e18 | ||
|
|
09f98630c0 | ||
|
|
75f4964c48 | ||
|
|
7bfa93a283 | ||
|
|
55c40997b1 | ||
|
|
133181bbe4 | ||
|
|
b13bcdaeda | ||
|
|
1791de4ae4 | ||
|
|
e381356af9 | ||
|
|
cc724305b6 | ||
|
|
29a325626f | ||
|
|
74ff6bc3ed | ||
|
|
77cab2b570 | ||
|
|
3beb80c907 | ||
|
|
a2b1afce78 | ||
|
|
0e23ee4dce | ||
|
|
e4f06a7069 | ||
|
|
2f10f2960b | ||
|
|
23ed4d36c8 | ||
|
|
79e84ddaed | ||
|
|
b3e467a939 | ||
|
|
b78afa688a | ||
|
|
440af8033d | ||
|
|
73451c68eb | ||
|
|
3edc33732a | ||
|
|
29cd7b3e00 | ||
|
|
eb174a3de1 | ||
|
|
b2ad9a1110 | ||
|
|
7b4a53b2c1 | ||
|
|
7b10d62096 | ||
|
|
a86042e413 | ||
|
|
47bc0f2f29 | ||
|
|
0bd992aa44 | ||
|
|
41bd5179f3 | ||
|
|
af416189f1 | ||
|
|
996a1789e8 | ||
|
|
029e3a3822 | ||
|
|
5afdc469a3 | ||
|
|
09bc196958 | ||
|
|
ef191f2901 | ||
|
|
8f72a1965f | ||
|
|
d102443630 | ||
|
|
352ef2830c | ||
|
|
2495ce6707 | ||
|
|
889099ac0d | ||
|
|
7481b7376d | ||
|
|
9601880e32 | ||
|
|
2c1a846279 | ||
|
|
543f5af5af | ||
|
|
ab20cf8197 | ||
|
|
fe91fd00ad | ||
|
|
7304c840e3 | ||
|
|
ac2ef389d1 | ||
|
|
e7741db9a2 | ||
|
|
cec2b3724c | ||
|
|
5b5d6341e5 | ||
|
|
31979d6192 | ||
|
|
cacfc85869 | ||
|
|
f2b07d6051 | ||
|
|
7d810a15c0 | ||
|
|
f7f6f331db | ||
|
|
e4531fc1e6 | ||
|
|
d77f3120c3 | ||
|
|
c25c9aff41 | ||
|
|
cceb5768c7 | ||
|
|
479a4699e3 | ||
|
|
0b192917f8 | ||
|
|
7471bccb9b | ||
|
|
25568245cf | ||
|
|
8d9a77c9b7 | ||
|
|
44f53cba1d | ||
|
|
49784d7f28 | ||
|
|
165734ce11 | ||
|
|
a3e4145e8a | ||
|
|
878d1aa35e | ||
|
|
3d3a810488 | ||
|
|
b51282ae95 | ||
|
|
329c5915fe | ||
|
|
e778d04740 | ||
|
|
763f5e16c7 | ||
|
|
5b7628cf08 | ||
|
|
5a40f539f2 | ||
|
|
12d86a0f1e | ||
|
|
089eb8ad39 | ||
|
|
8651f7c727 | ||
|
|
ed07d3c8c6 | ||
|
|
33602a03a4 | ||
|
|
c02a2e25c4 | ||
|
|
986797c1c8 | ||
|
|
1384fed3eb | ||
|
|
c9b0cec5b8 | ||
|
|
305c36ddd1 | ||
|
|
01d96433b1 | ||
|
|
6ec6541a0d | ||
|
|
2b1369277f | ||
|
|
d56c748fa8 | ||
|
|
57ec736941 | ||
|
|
c0dfdf4392 | ||
|
|
a3583e4e7c | ||
|
|
e431d4121e | ||
|
|
124c232a3b | ||
|
|
52180f386b | ||
|
|
ba972694c7 | ||
|
|
482e3fb973 | ||
|
|
7a6394378c | ||
|
|
89fd1e4b6e | ||
|
|
ed7b00bf02 | ||
|
|
9ebbf655c0 | ||
|
|
74b76a2c41 | ||
|
|
6c5a3d3dbf | ||
|
|
ca67ed69a1 | ||
|
|
9d03cd20ba | ||
|
|
dbd7a0c92d | ||
|
|
8af4753002 | ||
|
|
8cdfd5852d | ||
|
|
cd1b70caf7 | ||
|
|
b0e8f8ca2a | ||
|
|
7ce628bf09 | ||
|
|
179d36ba0e | ||
|
|
a5d6e70299 | ||
|
|
f527fc1d5e | ||
|
|
30bcda7136 | ||
|
|
b85eb293fe | ||
|
|
af106fe961 | ||
|
|
b5aa2ef605 | ||
|
|
670b240a26 | ||
|
|
e9a8999f63 | ||
|
|
f7bcd8e958 | ||
|
|
bd664def45 | ||
|
|
02ae8b98a5 | ||
|
|
626b896448 | ||
|
|
7ca10d8dcf | ||
|
|
bff7b71389 | ||
|
|
a3c17f17b1 | ||
|
|
92653d2c41 | ||
|
|
cbaaf1b539 | ||
|
|
88e7c98e6e | ||
|
|
a09240391f | ||
|
|
599d0ae21b | ||
|
|
b225793103 | ||
|
|
d0229d99ed | ||
|
|
348a50052e | ||
|
|
620b1244b4 | ||
|
|
4126280d55 | ||
|
|
d39c62bbed | ||
|
|
2f1cf164b9 | ||
|
|
1cd19447e3 | ||
|
|
a2f8d985fb | ||
|
|
ba179b1542 | ||
|
|
ca16cfa147 | ||
|
|
794b755f1d | ||
|
|
fa9318914c | ||
|
|
7920b4685e | ||
|
|
f7094d7a99 | ||
|
|
b9aee2defb | ||
|
|
a092794804 | ||
|
|
4be5ccd0c8 | ||
|
|
69343c5951 | ||
|
|
57a4549d86 | ||
|
|
ce4acecaa8 | ||
|
|
4c58cef24a | ||
|
|
aac5fa49de | ||
|
|
df78466a12 | ||
|
|
78ccbbf3d0 | ||
|
|
b5c89b9a73 | ||
|
|
6cd0b961da | ||
|
|
e67afa8715 | ||
|
|
bcd36dedb4 | ||
|
|
4b97358100 | ||
|
|
c65a9f5639 | ||
|
|
c38b50e9fc | ||
|
|
3d8d18dd8f | ||
|
|
f903727476 | ||
|
|
0812346e56 | ||
|
|
17fcf828d3 | ||
|
|
b41d7bd5a3 | ||
|
|
73f32be01f | ||
|
|
bdacb5c25a | ||
|
|
dddbd86649 | ||
|
|
c57884a295 | ||
|
|
0f8ad6c40e | ||
|
|
027d86794f | ||
|
|
34eb00de33 | ||
|
|
fe439f54f5 | ||
|
|
3188598367 | ||
|
|
2af5d9fb15 | ||
|
|
66689f2381 | ||
|
|
d6c4734e34 | ||
|
|
3333577e06 | ||
|
|
181e7a547a | ||
|
|
3b3391cd65 | ||
|
|
dc03626167 | ||
|
|
530927db64 | ||
|
|
5d88cec2df | ||
|
|
a3fb644d86 | ||
|
|
b8bef16c98 | ||
|
|
5f975f5ce8 | ||
|
|
df2d3ea7c0 | ||
|
|
a0b2582a75 | ||
|
|
77fd5ecd98 | ||
|
|
8e7f08d04d | ||
|
|
34ccb4f6c9 | ||
|
|
e5a5dbde40 | ||
|
|
b88603896a | ||
|
|
5d9ea0f3d4 | ||
|
|
5615604253 | ||
|
|
4ac8f2e59d | ||
|
|
68bf82643c | ||
|
|
5f19af8fce | ||
|
|
413e5c145c | ||
|
|
38231b6891 | ||
|
|
fd9f924ad7 | ||
|
|
d85b1d70db | ||
|
|
cb28c26398 | ||
|
|
d7f6af09e6 | ||
|
|
d2f3cab8e1 | ||
|
|
a437d77431 | ||
|
|
4b7b439be9 | ||
|
|
08cbb2c345 | ||
|
|
faf497feb8 | ||
|
|
5f58da8de7 | ||
|
|
e60af7b82e | ||
|
|
3e5b4da361 | ||
|
|
625f880b15 | ||
|
|
b5f99b26eb | ||
|
|
38260fcfb1 | ||
|
|
fe3f06435e | ||
|
|
e7aaa24da8 | ||
|
|
e8e8d11bd3 | ||
|
|
c1307103b2 | ||
|
|
34e03e7cf6 | ||
|
|
8ff0d17d6a | ||
|
|
dcd12576c6 | ||
|
|
025589adf8 | ||
|
|
f7d6909b6f | ||
|
|
5367d96512 | ||
|
|
dac95464b8 | ||
|
|
029923329d | ||
|
|
dc24bad791 | ||
|
|
750e1aaaa5 | ||
|
|
7e0ae72b07 | ||
|
|
982aaa41b9 | ||
|
|
68ceea3f8d | ||
|
|
328aa48c6a | ||
|
|
8ceaaa6c4f | ||
|
|
1c30a780a7 | ||
|
|
729716ab7a | ||
|
|
87b98711f7 | ||
|
|
d344e87de0 | ||
|
|
8c04c5ed5f | ||
|
|
1818a2a2da | ||
|
|
637469e656 | ||
|
|
5f2604b1f7 | ||
|
|
5c0c5a4913 | ||
|
|
83c0c9843d | ||
|
|
e378f9892d | ||
|
|
3ee017d350 | ||
|
|
3b5035c468 | ||
|
|
51939efeac | ||
|
|
9653a54766 | ||
|
|
da0480ad72 | ||
|
|
4ecf5956d7 | ||
|
|
7ad6cd35e8 | ||
|
|
cb56322937 | ||
|
|
68021c6fc3 | ||
|
|
cbc5a76e80 | ||
|
|
b771f060f1 | ||
|
|
2eb9014606 | ||
|
|
56a3d30e75 | ||
|
|
460923f094 | ||
|
|
85894160c6 | ||
|
|
7337c29b90 | ||
|
|
5878f7c3a1 | ||
|
|
f20ef922fd | ||
|
|
161526555f | ||
|
|
963023898e | ||
|
|
931bf2a50a | ||
|
|
0abd809663 | ||
|
|
6084e7670a | ||
|
|
47620bb27a | ||
|
|
ae2ef6e41d | ||
|
|
f7f582ec86 | ||
|
|
008aee0dc1 | ||
|
|
7c82e2316b | ||
|
|
79142614ea | ||
|
|
5f4dc11409 | ||
|
|
abde40377c | ||
|
|
67be8a5af8 | ||
|
|
d6aa6239de | ||
|
|
51fafdb525 | ||
|
|
2861275fb6 | ||
|
|
259c7d66f7 | ||
|
|
25a3c47def | ||
|
|
59f6a13609 | ||
|
|
39b774a131 | ||
|
|
6e0601a73b | ||
|
|
a0955aa4dd | ||
|
|
b1f083cb60 | ||
|
|
5c6a166761 | ||
|
|
7251e357e7 | ||
|
|
7c5c94785c | ||
|
|
c22e5c1c51 | ||
|
|
0563773944 | ||
|
|
463589da01 | ||
|
|
96b67a7c35 | ||
|
|
252e553ef2 | ||
|
|
b2e8bfb54e | ||
|
|
76bf72e8ef | ||
|
|
37dd41ab91 | ||
|
|
3dbebfd1e1 | ||
|
|
e5e6eeda83 | ||
|
|
d8bc540130 | ||
|
|
af32b52727 | ||
|
|
2841d59fb0 | ||
|
|
3fec41b911 | ||
|
|
92afbb858a | ||
|
|
988f9d60d5 | ||
|
|
f8b1d48f82 | ||
|
|
1040761ab6 | ||
|
|
1c044280d6 | ||
|
|
41143b3b78 | ||
|
|
fb75fe852c | ||
|
|
6cedaf4356 | ||
|
|
0c42c69e94 | ||
|
|
eec67d6008 | ||
|
|
946aa6d1e7 | ||
|
|
7621b9b8a9 | ||
|
|
7a8bc2e19e | ||
|
|
097aac2328 | ||
|
|
24cc55b444 | ||
|
|
d30052ce85 | ||
|
|
ff0560ee03 | ||
|
|
c3ce024fc1 | ||
|
|
054374c765 | ||
|
|
466a55b06d | ||
|
|
6f2d590617 | ||
|
|
c169429c33 | ||
|
|
c81f85e16d | ||
|
|
45757b8b55 | ||
|
|
1f0a564e43 | ||
|
|
cd10c277b2 | ||
|
|
a121453188 | ||
|
|
eac9c4d86b | ||
|
|
86b17e8972 | ||
|
|
c830b60f36 | ||
|
|
e6e85a6b2c | ||
|
|
7283d68e32 | ||
|
|
ab9206c38e | ||
|
|
27c74a7e66 | ||
|
|
edae676913 | ||
|
|
ef4c2c0d1e | ||
|
|
67125688ed | ||
|
|
91829057c5 | ||
|
|
f68e15da89 | ||
|
|
d0147a16a9 | ||
|
|
59b9fd26fc | ||
|
|
6d7556b31f | ||
|
|
69a7de1ad8 | ||
|
|
0e5c4e432d | ||
|
|
2a8c60f71b | ||
|
|
2cba123474 | ||
|
|
e7585548a4 | ||
|
|
d6fbd741fd | ||
|
|
1d5c44e2df | ||
|
|
af4b9c3aee | ||
|
|
6887e55f6a | ||
|
|
260fcd8e1e | ||
|
|
bf56bce5e9 | ||
|
|
cda2a6b510 | ||
|
|
bd6e1a8a70 | ||
|
|
1bf75f7f73 | ||
|
|
512899e6a6 | ||
|
|
da9abc2a93 | ||
|
|
11e91bd549 | ||
|
|
2e2f426fe2 | ||
|
|
5fdb1d89ce | ||
|
|
eeeccf2f78 | ||
|
|
e449a4a517 | ||
|
|
a234789c59 | ||
|
|
c38eee73ca | ||
|
|
bc2f3b26e7 | ||
|
|
1645d3c185 | ||
|
|
bd0c7a3d28 | ||
|
|
fa1bb3cee3 | ||
|
|
ac66eee045 | ||
|
|
47aea42d66 | ||
|
|
8111f7663d | ||
|
|
d0473e27d9 | ||
|
|
c4a4d3609b | ||
|
|
0e5e0a3754 | ||
|
|
aed74b5568 | ||
|
|
3b68711139 | ||
|
|
8f0e2f31af | ||
|
|
5eac4f043a | ||
|
|
0702eee3b1 | ||
|
|
1888d01fa0 | ||
|
|
5cb6590eae | ||
|
|
b579451db9 | ||
|
|
53eacb4341 | ||
|
|
cca1df83da | ||
|
|
3185eebf2e | ||
|
|
3422272a50 | ||
|
|
9e9b2c0703 | ||
|
|
54723c3713 | ||
|
|
2637c9eac2 | ||
|
|
c43dcfa3e2 | ||
|
|
59ded34b83 | ||
|
|
030905714b | ||
|
|
55380a014d | ||
|
|
3f5f8657d2 | ||
|
|
738e528329 | ||
|
|
69ac6b6bf6 | ||
|
|
82b74c7940 | ||
|
|
2e70cc8be7 | ||
|
|
37b231b5dc | ||
|
|
8e1ac16d16 | ||
|
|
48e4ced29d | ||
|
|
d5e7c1de0a | ||
|
|
f7c1a15ad1 | ||
|
|
e45c6b5e21 | ||
|
|
3572e1140e | ||
|
|
078118ecba | ||
|
|
11b4e0c77d | ||
|
|
e0951dd44f | ||
|
|
44c4e74655 | ||
|
|
a74978baeb | ||
|
|
82f6a6838f | ||
|
|
0deda9b638 | ||
|
|
7cef280bdc | ||
|
|
27f04a382a | ||
|
|
ed154053c8 | ||
|
|
b27947b355 | ||
|
|
c2a6012ba5 | ||
|
|
f457eef144 | ||
|
|
d51c8d37bd | ||
|
|
952974491b | ||
|
|
54906c48f3 | ||
|
|
e94d52c1af | ||
|
|
fb53ec30f7 | ||
|
|
8f0b527b28 | ||
|
|
81debd73d4 | ||
|
|
63ebafa113 | ||
|
|
3ae2eabf09 | ||
|
|
1b3f204220 | ||
|
|
123b0cc2df | ||
|
|
ff1c04c486 | ||
|
|
dd2245956f | ||
|
|
b409ccc5ab | ||
|
|
5e3b6e968a | ||
|
|
dd66193bfb | ||
|
|
524a44f027 | ||
|
|
70fe7e6b5d | ||
|
|
c6bd4e656e | ||
|
|
de368ef3c3 | ||
|
|
d9c25ccbb0 | ||
|
|
ddf4f27a56 | ||
|
|
76ba0021e5 | ||
|
|
ac15868694 | ||
|
|
ae3245f1dc | ||
|
|
72490bc00f | ||
|
|
208ed2a991 | ||
|
|
1165632fa0 | ||
|
|
d4105f9b46 | ||
|
|
175456870a | ||
|
|
49cc81fdab | ||
|
|
4c280bc317 | ||
|
|
90018be9d2 | ||
|
|
b87ec11c1c | ||
|
|
b0e5112702 | ||
|
|
4c1bc99366 | ||
|
|
db46565d18 | ||
|
|
1ac71a111f | ||
|
|
3afc2d2ce6 | ||
|
|
4c200acd7d | ||
|
|
53b6831f73 | ||
|
|
cbd9d14cc4 | ||
|
|
53ae13a012 | ||
|
|
e30e325770 | ||
|
|
d1fcf1fd67 | ||
|
|
50269b74ce | ||
|
|
715d327df0 | ||
|
|
fb635146a1 | ||
|
|
915b16f97a | ||
|
|
e4da140d0a | ||
|
|
3222d40871 | ||
|
|
95dc977608 | ||
|
|
a4369b35a7 | ||
|
|
4d8ce2fe26 | ||
|
|
437532d559 | ||
|
|
9da3ea35ac | ||
|
|
0c75e0438e | ||
|
|
1aea3512a4 | ||
|
|
6658d5de45 | ||
|
|
2d0a555270 | ||
|
|
a1d5a6298c | ||
|
|
2d4a7ac9f9 | ||
|
|
018df9ceb0 | ||
|
|
a3eddde525 | ||
|
|
9bbbbb7c2c | ||
|
|
db8e27be6e | ||
|
|
bd278337db | ||
|
|
a4cef2fbd4 | ||
|
|
91492b4947 | ||
|
|
b395a5289b | ||
|
|
2ca983b6d8 | ||
|
|
aecea22666 | ||
|
|
38f4425a65 | ||
|
|
79d11ac951 | ||
|
|
d4e5a22e53 | ||
|
|
37a1a70cc3 | ||
|
|
7743ddd7db | ||
|
|
5071f528f6 | ||
|
|
7e0951ad9c | ||
|
|
55f2627fcf | ||
|
|
ab6fb13ad7 | ||
|
|
1b6f53cdac | ||
|
|
cb4e8ec16b | ||
|
|
d3b267bac2 | ||
|
|
0b7a235c17 | ||
|
|
f2af477324 | ||
|
|
84e1a59df7 | ||
|
|
030dde227a | ||
|
|
06444b7c52 | ||
|
|
c3ef8b433c | ||
|
|
97556f6023 | ||
|
|
81b9175c7a | ||
|
|
f35b958d90 | ||
|
|
866d15023d | ||
|
|
768eaff4b8 | ||
|
|
ec7dfeeaf8 | ||
|
|
921f1c626a | ||
|
|
b0c7df0c3b | ||
|
|
ca9056d673 | ||
|
|
84c9ac66ac | ||
|
|
50fafa3a2c | ||
|
|
a502b78c3f | ||
|
|
bf9c4ed033 | ||
|
|
d1494ea786 | ||
|
|
5b49065a57 | ||
|
|
3b21317863 | ||
|
|
ee08e38126 | ||
|
|
be83a56bb9 | ||
|
|
5f278c6bd7 | ||
|
|
92ffba2ab9 | ||
|
|
f262fed197 | ||
|
|
dd685fdd8d | ||
|
|
bf0ccf3461 | ||
|
|
5d2a1e8d48 | ||
|
|
8243710351 | ||
|
|
ce7394f3bf | ||
|
|
8fb8ebdf14 | ||
|
|
e9eb8949ba | ||
|
|
3c8dd8592a | ||
|
|
c35fe9d631 | ||
|
|
018f0b73be | ||
|
|
264678c9b1 | ||
|
|
46b8c4cc98 | ||
|
|
9b95430e9f | ||
|
|
37afb31d05 | ||
|
|
315879ce47 | ||
|
|
1943647860 | ||
|
|
11cc489ca5 | ||
|
|
79a49ada39 | ||
|
|
ebe7af1833 | ||
|
|
ab5e9727a9 | ||
|
|
6c8810e4d2 | ||
|
|
8af7906b3d | ||
|
|
6201ed537e | ||
|
|
b3df7673ed | ||
|
|
7e83a75fba | ||
|
|
e19edccf3a | ||
|
|
2deee3f47c | ||
|
|
2add211a86 | ||
|
|
8b60de622e | ||
|
|
fa61bb1867 | ||
|
|
3ef7a34f49 | ||
|
|
94dbe60233 | ||
|
|
5e020196f6 | ||
|
|
5dc509c6e4 | ||
|
|
e00d8dc536 | ||
|
|
084e0ab7bb | ||
|
|
f5a8382933 | ||
|
|
9782ace1bd | ||
|
|
6f606bb350 | ||
|
|
b23e51f205 | ||
|
|
166a5fc524 | ||
|
|
ecd0399f8d | ||
|
|
ccab4217e4 | ||
|
|
01f2fcf72d | ||
|
|
86c8f248bd | ||
|
|
9630825576 | ||
|
|
6f7b0cafee | ||
|
|
3aefea0fe2 | ||
|
|
1d0be87e0e | ||
|
|
ce615b4e6f | ||
|
|
8c2c5986c8 | ||
|
|
6b1e60582c | ||
|
|
8e25cc74d1 | ||
|
|
c8eb9a7542 | ||
|
|
be952035c7 | ||
|
|
ba55296b18 | ||
|
|
45a6323a4b | ||
|
|
6ce41e30a4 | ||
|
|
2fe4371899 | ||
|
|
3a6c37aa6c | ||
|
|
4c7eb645a1 | ||
|
|
d2dd7d1694 | ||
|
|
819de58197 | ||
|
|
98022f2b3d | ||
|
|
5cb38f9ea7 | ||
|
|
2fd6b65a9e | ||
|
|
33d5778a46 | ||
|
|
46d13f6b5e | ||
|
|
20706d8cf2 | ||
|
|
a847e2beee | ||
|
|
3d53f73006 | ||
|
|
4b3676a54b | ||
|
|
b5c29e25aa | ||
|
|
5d86b50782 | ||
|
|
d63c5231ac | ||
|
|
7ee12f14a8 | ||
|
|
019173b1cc | ||
|
|
59ca65da3c | ||
|
|
ac5f227aae | ||
|
|
ca8c8a56b7 | ||
|
|
729340708e | ||
|
|
e340fbee82 | ||
|
|
df74f538f7 | ||
|
|
2002111a80 | ||
|
|
d89371af99 | ||
|
|
73dbb3aed9 | ||
|
|
a34570fc5b | ||
|
|
e986dcf5e0 | ||
|
|
d056c622bf | ||
|
|
77c0de914a | ||
|
|
08dcf2f035 | ||
|
|
5e97179d06 | ||
|
|
7d8e9f829c | ||
|
|
462f2ed958 | ||
|
|
a1bc529db6 | ||
|
|
eae0080d75 | ||
|
|
fc9f1da143 | ||
|
|
e19fd68f18 | ||
|
|
f3da0906ed | ||
|
|
b0e250d437 | ||
|
|
6671f576cb | ||
|
|
4846a7232e | ||
|
|
15ced2398e | ||
|
|
9b99240584 | ||
|
|
e7c4ee1c64 | ||
|
|
b5ac55f012 | ||
|
|
6892842021 | ||
|
|
9e0f8d9f0d | ||
|
|
4a7833f1bf | ||
|
|
e4c0693b03 | ||
|
|
6daf221937 | ||
|
|
8684b0999d | ||
|
|
9f4630736d | ||
|
|
9bde067f16 | ||
|
|
a7d8d46306 | ||
|
|
a74f6cf593 | ||
|
|
85a1b419c0 | ||
|
|
0349199d0e | ||
|
|
03aa23fb1b | ||
|
|
a56a523f29 | ||
|
|
fbe828e486 | ||
|
|
09542d82b4 | ||
|
|
cdd64a8099 | ||
|
|
1a2ff0514c | ||
|
|
b95c9860ed | ||
|
|
6a84f50d24 | ||
|
|
a467d5081c | ||
|
|
c51884ce23 | ||
|
|
1760dd083d | ||
|
|
c48bda0232 | ||
|
|
7a30a48027 | ||
|
|
8d0ea07f5f | ||
|
|
f5d981ab4d | ||
|
|
317e12644a | ||
|
|
f7adf1687f | ||
|
|
97e4a1d6eb | ||
|
|
2dceb44ae4 | ||
|
|
c72f10511a | ||
|
|
58087bc64f | ||
|
|
09ed882e5f | ||
|
|
8f9e84bca0 | ||
|
|
869a6711bc | ||
|
|
9b4ce65882 | ||
|
|
0c32e2e965 | ||
|
|
868e47f994 | ||
|
|
b820609088 | ||
|
|
9f92f2779d | ||
|
|
5e3ecc1b82 | ||
|
|
03f4c0b832 | ||
|
|
31e4dbfe38 | ||
|
|
0121f35c12 | ||
|
|
0109cc0e30 | ||
|
|
5caa7bbdc9 | ||
|
|
10c2a4540e | ||
|
|
aab5390cb5 | ||
|
|
85da309eed | ||
|
|
5e9dc0e668 | ||
|
|
3f1136c194 | ||
|
|
51860424a6 | ||
|
|
c627942691 | ||
|
|
50c3f1d4a7 | ||
|
|
f3a4125ee7 | ||
|
|
2e1ffa189b | ||
|
|
2af8c354a7 | ||
|
|
577bbcb2e3 | ||
|
|
008b3fbbc9 | ||
|
|
d46e588200 | ||
|
|
eb9456d7d5 | ||
|
|
bcffffbc5e | ||
|
|
68a216586f | ||
|
|
74989d69c9 | ||
|
|
de6e1442d7 | ||
|
|
8aba24a3f8 | ||
|
|
bb01324482 | ||
|
|
8edf12f026 | ||
|
|
4c31b6d533 | ||
|
|
3c7c85b1d4 | ||
|
|
659bf1940f | ||
|
|
380953692b | ||
|
|
50b1eff390 | ||
|
|
10511fc54c | ||
|
|
563902cda5 | ||
|
|
c8af490fb0 | ||
|
|
0701286243 | ||
|
|
97a1d587d4 | ||
|
|
4c2ca916ec | ||
|
|
298fdb4603 | ||
|
|
0eff4311f5 | ||
|
|
2ccc098882 | ||
|
|
60c17068a6 | ||
|
|
b2f4a4e739 | ||
|
|
3c98f1a119 | ||
|
|
4c36190dd3 | ||
|
|
c27f6175d7 | ||
|
|
6913fabc64 | ||
|
|
ae3a53388f | ||
|
|
6813f118d4 | ||
|
|
cf7094f3c9 | ||
|
|
cc8af2e7dc | ||
|
|
ea75165e85 | ||
|
|
9c6a9bf518 | ||
|
|
a657eec299 | ||
|
|
d018809830 | ||
|
|
b39d1a77b4 | ||
|
|
041a93887c | ||
|
|
2c7a4eea1f | ||
|
|
1fed603df9 | ||
|
|
10930ce6b6 | ||
|
|
25d0caa901 | ||
|
|
4d7884ca65 | ||
|
|
23ecd7bb33 | ||
|
|
02f4e7b82c | ||
|
|
5381479177 | ||
|
|
2858701e6c | ||
|
|
70be76735c | ||
|
|
da97f86447 | ||
|
|
8fade18e40 | ||
|
|
4f362fe883 | ||
|
|
48357c529c |
No files matched your search
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
Sponsors SeaweedFS via Patreon https://www.patreon.com/seaweedfs
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**System Setup**
|
||||
List the command line to start "weed master", "weed volume", "weed filer", "weed s3", "weed mount".
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
.goxc*
|
||||
vendor
|
||||
tags
|
||||
*.swp
|
||||
### OSX template
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
|
||||
|
||||
*.iml
|
||||
|
||||
## Directory-based project format:
|
||||
.idea/
|
||||
# if you remove the above rule, at least ignore the following:
|
||||
|
||||
# User-specific stuff:
|
||||
# .idea/workspace.xml
|
||||
# .idea/tasks.xml
|
||||
# .idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
# .idea/dataSources.ids
|
||||
# .idea/dataSources.xml
|
||||
# .idea/sqlDataSources.xml
|
||||
# .idea/dynamic.xml
|
||||
# .idea/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
# .idea/gradle.xml
|
||||
# .idea/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
# .idea/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
|
||||
test_data
|
||||
build
|
||||
target
|
||||
*.class
|
||||
other/java/hdfs/dependency-reduced-pom.xml
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
sudo: false
|
||||
language: go
|
||||
go:
|
||||
- 1.10.x
|
||||
- 1.11.x
|
||||
- tip
|
||||
|
||||
before_install:
|
||||
- export PATH=/home/travis/gopath/bin:$PATH
|
||||
|
||||
install:
|
||||
- go get ./weed/...
|
||||
|
||||
script:
|
||||
- go test ./weed/...
|
||||
|
||||
before_deploy:
|
||||
- make release
|
||||
deploy:
|
||||
provider: releases
|
||||
skip_cleanup: true
|
||||
api_key:
|
||||
secure: ERL986+ncQ8lwAJUYDrQ8s2/FxF/cyNIwJIFCqspnWxQgGNNyokET9HapmlPSxjpFRF0q6L2WCg9OY3mSVRq4oI6hg1igOQ12KlLyN71XSJ3c8w0Ay5ho48TQ9l3f3Iu97mntBCe9l0R9pnT8wj1VI8YJxloXwUMG2yeTjA9aBI=
|
||||
file:
|
||||
- build/linux_arm.tar.gz
|
||||
- build/linux_arm64.tar.gz
|
||||
- build/linux_386.tar.gz
|
||||
- build/linux_amd64.tar.gz
|
||||
- build/darwin_amd64.tar.gz
|
||||
- build/windows_386.zip
|
||||
- build/windows_amd64.zip
|
||||
- build/freebsd_arm.tar.gz
|
||||
- build/freebsd_amd64.tar.gz
|
||||
- build/freebsd_386.tar.gz
|
||||
- build/netbsd_arm.tar.gz
|
||||
- build/netbsd_amd64.tar.gz
|
||||
- build/netbsd_386.tar.gz
|
||||
- build/openbsd_arm.tar.gz
|
||||
- build/openbsd_amd64.tar.gz
|
||||
- build/openbsd_386.tar.gz
|
||||
on:
|
||||
tags: true
|
||||
repo: chrislusf/seaweedfs
|
||||
go: tip
|
||||
@@ -178,7 +178,7 @@
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
@@ -186,7 +186,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2016 Chris Lu
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -198,4 +198,4 @@
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,113 @@
|
||||
BINARY = weed/weed
|
||||
package = github.com/chrislusf/seaweedfs/weed
|
||||
|
||||
GO_FLAGS = #-v
|
||||
SOURCE_DIR = ./weed/
|
||||
|
||||
appname := weed
|
||||
|
||||
sources := $(wildcard *.go)
|
||||
|
||||
build = CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -ldflags "-extldflags -static" -o build/$(appname)$(3) $(SOURCE_DIR)
|
||||
tar = cd build && tar -cvzf $(1)_$(2).tar.gz $(appname)$(3) && rm $(appname)$(3)
|
||||
zip = cd build && zip $(1)_$(2).zip $(appname)$(3) && rm $(appname)$(3)
|
||||
|
||||
|
||||
all: build
|
||||
|
||||
.PHONY : clean deps build linux release windows_build darwin_build linux_build bsd_build clean
|
||||
|
||||
clean:
|
||||
go clean -i $(GO_FLAGS) $(SOURCE_DIR)
|
||||
rm -f $(BINARY)
|
||||
rm -rf build/
|
||||
|
||||
deps:
|
||||
go get $(GO_FLAGS) -d $(SOURCE_DIR)
|
||||
|
||||
build: deps
|
||||
go build $(GO_FLAGS) -o $(BINARY) $(SOURCE_DIR)
|
||||
|
||||
linux: deps
|
||||
mkdir -p linux
|
||||
GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o linux/$(BINARY) $(SOURCE_DIR)
|
||||
|
||||
release: deps windows_build darwin_build linux_build bsd_build
|
||||
|
||||
##### LINUX BUILDS #####
|
||||
linux_build: build/linux_arm.tar.gz build/linux_arm64.tar.gz build/linux_386.tar.gz build/linux_amd64.tar.gz
|
||||
|
||||
build/linux_386.tar.gz: $(sources)
|
||||
$(call build,linux,386,)
|
||||
$(call tar,linux,386)
|
||||
|
||||
build/linux_amd64.tar.gz: $(sources)
|
||||
$(call build,linux,amd64,)
|
||||
$(call tar,linux,amd64)
|
||||
|
||||
build/linux_arm.tar.gz: $(sources)
|
||||
$(call build,linux,arm,)
|
||||
$(call tar,linux,arm)
|
||||
|
||||
build/linux_arm64.tar.gz: $(sources)
|
||||
$(call build,linux,arm64,)
|
||||
$(call tar,linux,arm64)
|
||||
|
||||
##### DARWIN (MAC) BUILDS #####
|
||||
darwin_build: build/darwin_amd64.tar.gz
|
||||
|
||||
build/darwin_amd64.tar.gz: $(sources)
|
||||
$(call build,darwin,amd64,)
|
||||
$(call tar,darwin,amd64)
|
||||
|
||||
##### WINDOWS BUILDS #####
|
||||
windows_build: build/windows_386.zip build/windows_amd64.zip
|
||||
|
||||
build/windows_386.zip: $(sources)
|
||||
$(call build,windows,386,.exe)
|
||||
$(call zip,windows,386,.exe)
|
||||
|
||||
build/windows_amd64.zip: $(sources)
|
||||
$(call build,windows,amd64,.exe)
|
||||
$(call zip,windows,amd64,.exe)
|
||||
|
||||
##### BSD BUILDS #####
|
||||
bsd_build: build/freebsd_arm.tar.gz build/freebsd_386.tar.gz build/freebsd_amd64.tar.gz \
|
||||
build/netbsd_arm.tar.gz build/netbsd_386.tar.gz build/netbsd_amd64.tar.gz \
|
||||
build/openbsd_arm.tar.gz build/openbsd_386.tar.gz build/openbsd_amd64.tar.gz
|
||||
|
||||
build/freebsd_386.tar.gz: $(sources)
|
||||
$(call build,freebsd,386,)
|
||||
$(call tar,freebsd,386)
|
||||
|
||||
build/freebsd_amd64.tar.gz: $(sources)
|
||||
$(call build,freebsd,amd64,)
|
||||
$(call tar,freebsd,amd64)
|
||||
|
||||
build/freebsd_arm.tar.gz: $(sources)
|
||||
$(call build,freebsd,arm,)
|
||||
$(call tar,freebsd,arm)
|
||||
|
||||
build/netbsd_386.tar.gz: $(sources)
|
||||
$(call build,netbsd,386,)
|
||||
$(call tar,netbsd,386)
|
||||
|
||||
build/netbsd_amd64.tar.gz: $(sources)
|
||||
$(call build,netbsd,amd64,)
|
||||
$(call tar,netbsd,amd64)
|
||||
|
||||
build/netbsd_arm.tar.gz: $(sources)
|
||||
$(call build,netbsd,arm,)
|
||||
$(call tar,netbsd,arm)
|
||||
|
||||
build/openbsd_386.tar.gz: $(sources)
|
||||
$(call build,openbsd,386,)
|
||||
$(call tar,openbsd,386)
|
||||
|
||||
build/openbsd_amd64.tar.gz: $(sources)
|
||||
$(call build,openbsd,amd64,)
|
||||
$(call tar,openbsd,amd64)
|
||||
|
||||
build/openbsd_arm.tar.gz: $(sources)
|
||||
$(call build,openbsd,arm,)
|
||||
$(call tar,openbsd,arm)
|
||||
@@ -0,0 +1,456 @@
|
||||
# SeaweedFS
|
||||
|
||||
|
||||
[](https://travis-ci.org/chrislusf/seaweedfs)
|
||||
[](https://godoc.org/github.com/chrislusf/seaweedfs/weed)
|
||||
[](https://github.com/chrislusf/seaweedfs/wiki)
|
||||
[](https://hub.docker.com/r/chrislusf/seaweedfs/)
|
||||
|
||||

|
||||
|
||||
<h2 align="center">Supporting SeaweedFS</h2>
|
||||
|
||||
SeaweedFS is an independent Apache-licensed open source project with its ongoing development made
|
||||
possible entirely thanks to the support of these awesome [backers](https://github.com/chrislusf/seaweedfs/blob/master/backers.md).
|
||||
If you'd like to grow SeaweedFS even stronger, please consider joining our
|
||||
<a href="https://www.patreon.com/seaweedfs">sponsors on Patreon</a>.
|
||||
|
||||
Platinum ($2500/month), Gold ($500/month): put your company logo on the SeaweedFS github page
|
||||
Generous Backer($50/month), Backer($10/month): put your name on the SeaweedFS backer page.
|
||||
|
||||
Your support will be really appreciated by me and other supporters!
|
||||
|
||||
<h3 align="center"><a href="https://www.patreon.com/seaweedfs">Sponsor SeaweedFS via Patreon</a></h3>
|
||||
|
||||
<h4 align="center">Platinum</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="" target="_blank">
|
||||
Add your name or icon here
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h4 align="center">Gold</h4>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<a href="" target="_blank">
|
||||
Add your name or icon here
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
---
|
||||
|
||||
|
||||
- [Download Binaries for different platforms](https://github.com/chrislusf/seaweedfs/releases/latest)
|
||||
- [SeaweedFS on Slack](https://join.slack.com/t/seaweedfs/shared_invite/enQtMzI4MTMwMjU2MzA3LTc4MmVlYmFlNjBmZTgzZmJlYmI1MDE1YzkyNWYyZjkwZDFiM2RlMDdjNjVlNjdjYzc4NGFhZGIyYzEyMzJkYTA)
|
||||
- [SeaweedFS Mailing List](https://groups.google.com/d/forum/seaweedfs)
|
||||
- [Wiki Documentation](https://github.com/chrislusf/seaweedfs/wiki)
|
||||
|
||||
|
||||
## Introduction
|
||||
|
||||
SeaweedFS is a simple and highly scalable distributed file system. There are two objectives:
|
||||
|
||||
1. to store billions of files!
|
||||
2. to serve the files fast!
|
||||
|
||||
SeaweedFS started as an Object Store to handle small files efficiently. Instead of managing all file metadata in a central master, the central master only manages file volumes, and it lets these volume servers manage files and their metadata. This relieves concurrency pressure from the central master and spreads file metadata into volume servers, allowing faster file access (just one disk read operation).
|
||||
|
||||
There is only 40 bytes of disk storage overhead for each file's metadata. It is so simple with O(1) disk reads that you are welcome to challenge the performance with your actual use cases.
|
||||
|
||||
SeaweedFS started by implementing [Facebook's Haystack design paper](http://www.usenix.org/event/osdi10/tech/full_papers/Beaver.pdf).
|
||||
|
||||
SeaweedFS can work very well with just the object store. [[Filer]] can then be added later to support directories and POSIX attributes. Filer is a separate linearly-scalable stateless server with customizable metadata stores, e.g., MySql/Postgres/Redis/Cassandra/LevelDB.
|
||||
|
||||
## Additional Features
|
||||
* Can choose no replication or different replication levels, rack and data center aware
|
||||
* Automatic master servers failover - no single point of failure (SPOF)
|
||||
* Automatic Gzip compression depending on file mime type
|
||||
* Automatic compaction to reclaim disk space after deletion or update
|
||||
* Servers in the same cluster can have different disk spaces, file systems, OS etc.
|
||||
* Adding/Removing servers does **not** cause any data re-balancing
|
||||
* Optionally fix the orientation for jpeg pictures
|
||||
* Support Etag, Accept-Range, Last-Modified, etc.
|
||||
* Support in-memory/leveldb/boltdb/btree mode tuning for memory/performance balance.
|
||||
|
||||
## Filer Features
|
||||
* [filer server][Filer] provide "normal" directories and files via http.
|
||||
* [mount filer][Mount] to read and write files directly as a local directory via FUSE.
|
||||
* [Amazon S3 compatible API][AmazonS3API] to access files with S3 tooling.
|
||||
* [Hadoop Compatible File System][Hadoop] to access files from Hadoop/Spark/Flink/etc jobs.
|
||||
* [Async Backup To Cloud][BackupToCloud] has extremely fast local access and backups to Amazon S3, Google Cloud Storage, Azure, BackBlaze.
|
||||
|
||||
[Filer]: https://github.com/chrislusf/seaweedfs/wiki/Directories-and-Files
|
||||
[Mount]: https://github.com/chrislusf/seaweedfs/wiki/Mount
|
||||
[AmazonS3API]: https://github.com/chrislusf/seaweedfs/wiki/Amazon-S3-API
|
||||
[BackupToCloud]: https://github.com/chrislusf/seaweedfs/wiki/Backup-to-Cloud
|
||||
[Hadoop]: https://github.com/chrislusf/seaweedfs/wiki/Hadoop-Compatible-File-System
|
||||
|
||||
## Example Usage
|
||||
By default, the master node runs on port 9333, and the volume nodes run on port 8080.
|
||||
Let's start one master node, and two volume nodes on port 8080 and 8081. Ideally, they should be started from different machines. We'll use localhost as an example.
|
||||
|
||||
SeaweedFS uses HTTP REST operations to read, write, and delete. The responses are in JSON or JSONP format.
|
||||
|
||||
### Start Master Server
|
||||
|
||||
```
|
||||
> ./weed master
|
||||
```
|
||||
|
||||
### Start Volume Servers ###
|
||||
|
||||
```
|
||||
> weed volume -dir="/tmp/data1" -max=5 -mserver="localhost:9333" -port=8080 &
|
||||
> weed volume -dir="/tmp/data2" -max=10 -mserver="localhost:9333" -port=8081 &
|
||||
```
|
||||
|
||||
### Write File ###
|
||||
|
||||
To upload a file: first, send a HTTP POST, PUT, or GET request to `/dir/assign` to get an `fid` and a volume server url:
|
||||
|
||||
```
|
||||
> curl http://localhost:9333/dir/assign
|
||||
{"count":1,"fid":"3,01637037d6","url":"127.0.0.1:8080","publicUrl":"localhost:8080"}
|
||||
```
|
||||
|
||||
Second, to store the file content, send a HTTP multi-part POST request to `url + '/' + fid` from the response:
|
||||
|
||||
```
|
||||
> curl -F file=@/home/chris/myphoto.jpg http://127.0.0.1:8080/3,01637037d6
|
||||
{"size": 43234}
|
||||
```
|
||||
|
||||
To update, send another POST request with updated file content.
|
||||
|
||||
For deletion, send an HTTP DELETE request to the same `url + '/' + fid` URL:
|
||||
|
||||
```
|
||||
> curl -X DELETE http://127.0.0.1:8080/3,01637037d6
|
||||
```
|
||||
### Save File Id ###
|
||||
|
||||
Now, you can save the `fid`, 3,01637037d6 in this case, to a database field.
|
||||
|
||||
The number 3 at the start represents a volume id. After the comma, it's one file key, 01, and a file cookie, 637037d6.
|
||||
|
||||
The volume id is an unsigned 32-bit integer. The file key is an unsigned 64-bit integer. The file cookie is an unsigned 32-bit integer, used to prevent URL guessing.
|
||||
|
||||
The file key and file cookie are both coded in hex. You can store the <volume id, file key, file cookie> tuple in your own format, or simply store the `fid` as a string.
|
||||
|
||||
If stored as a string, in theory, you would need 8+1+16+8=33 bytes. A char(33) would be enough, if not more than enough, since most uses will not need 2^32 volumes.
|
||||
|
||||
If space is really a concern, you can store the file id in your own format. You would need one 4-byte integer for volume id, 8-byte long number for file key, and a 4-byte integer for the file cookie. So 16 bytes are more than enough.
|
||||
|
||||
### Read File ###
|
||||
|
||||
Here is an example of how to render the URL.
|
||||
|
||||
First look up the volume server's URLs by the file's volumeId:
|
||||
|
||||
```
|
||||
> curl http://localhost:9333/dir/lookup?volumeId=3
|
||||
{"locations":[{"publicUrl":"localhost:8080","url":"localhost:8080"}]}
|
||||
```
|
||||
|
||||
Since (usually) there are not too many volume servers, and volumes don't move often, you can cache the results most of the time. Depending on the replication type, one volume can have multiple replica locations. Just randomly pick one location to read.
|
||||
|
||||
Now you can take the public url, render the url or directly read from the volume server via url:
|
||||
|
||||
```
|
||||
http://localhost:8080/3,01637037d6.jpg
|
||||
```
|
||||
|
||||
Notice we add a file extension ".jpg" here. It's optional and just one way for the client to specify the file content type.
|
||||
|
||||
If you want a nicer URL, you can use one of these alternative URL formats:
|
||||
|
||||
```
|
||||
http://localhost:8080/3/01637037d6/my_preferred_name.jpg
|
||||
http://localhost:8080/3/01637037d6.jpg
|
||||
http://localhost:8080/3,01637037d6.jpg
|
||||
http://localhost:8080/3/01637037d6
|
||||
http://localhost:8080/3,01637037d6
|
||||
```
|
||||
|
||||
If you want to get a scaled version of an image, you can add some params:
|
||||
|
||||
```
|
||||
http://localhost:8080/3/01637037d6.jpg?height=200&width=200
|
||||
http://localhost:8080/3/01637037d6.jpg?height=200&width=200&mode=fit
|
||||
http://localhost:8080/3/01637037d6.jpg?height=200&width=200&mode=fill
|
||||
```
|
||||
|
||||
### Rack-Aware and Data Center-Aware Replication ###
|
||||
|
||||
SeaweedFS applies the replication strategy at a volume level. So, when you are getting a file id, you can specify the replication strategy. For example:
|
||||
|
||||
```
|
||||
curl http://localhost:9333/dir/assign?replication=001
|
||||
```
|
||||
|
||||
The replication parameter options are:
|
||||
|
||||
```
|
||||
000: no replication
|
||||
001: replicate once on the same rack
|
||||
010: replicate once on a different rack, but same data center
|
||||
100: replicate once on a different data center
|
||||
200: replicate twice on two different data center
|
||||
110: replicate once on a different rack, and once on a different data center
|
||||
```
|
||||
|
||||
More details about replication can be found [on the wiki][Replication].
|
||||
|
||||
[Replication]: https://github.com/chrislusf/seaweedfs/wiki/Replication
|
||||
|
||||
You can also set the default replication strategy when starting the master server.
|
||||
|
||||
### Allocate File Key on specific data center ###
|
||||
|
||||
Volume servers can be started with a specific data center name:
|
||||
|
||||
```
|
||||
weed volume -dir=/tmp/1 -port=8080 -dataCenter=dc1
|
||||
weed volume -dir=/tmp/2 -port=8081 -dataCenter=dc2
|
||||
```
|
||||
|
||||
When requesting a file key, an optional "dataCenter" parameter can limit the assigned volume to the specific data center. For example, this specifies that the assigned volume should be limited to 'dc1':
|
||||
|
||||
```
|
||||
http://localhost:9333/dir/assign?dataCenter=dc1
|
||||
```
|
||||
|
||||
### Other Features ###
|
||||
* [No Single Point of Failure][feat-1]
|
||||
* [Insert with your own keys][feat-2]
|
||||
* [Chunking large files][feat-3]
|
||||
* [Collection as a Simple Name Space][feat-4]
|
||||
|
||||
[feat-1]: https://github.com/chrislusf/seaweedfs/wiki/Failover-Master-Server
|
||||
[feat-2]: https://github.com/chrislusf/seaweedfs/wiki/Optimization#insert-with-your-own-keys
|
||||
[feat-3]: https://github.com/chrislusf/seaweedfs/wiki/Optimization#upload-large-files
|
||||
[feat-4]: https://github.com/chrislusf/seaweedfs/wiki/Optimization#collection-as-a-simple-name-space
|
||||
|
||||
## Architecture ##
|
||||
|
||||
Usually distributed file systems split each file into chunks, a central master keeps a mapping of filenames, chunk indices to chunk handles, and also which chunks each chunk server has.
|
||||
|
||||
The main drawback is that the central master can't handle many small files efficiently, and since all read requests need to go through the chunk master, so it might not scale well for many concurrent users.
|
||||
|
||||
Instead of managing chunks, SeaweedFS manages data volumes in the master server. Each data volume is 32GB in size, and can hold a lot of files. And each storage node can have many data volumes. So the master node only needs to store the metadata about the volumes, which is a fairly small amount of data and is generally stable.
|
||||
|
||||
The actual file metadata is stored in each volume on volume servers. Since each volume server only manages metadata of files on its own disk, with only 16 bytes for each file, all file access can read file metadata just from memory and only needs one disk operation to actually read file data.
|
||||
|
||||
For comparison, consider that an xfs inode structure in Linux is 536 bytes.
|
||||
|
||||
### Master Server and Volume Server ###
|
||||
|
||||
The architecture is fairly simple. The actual data is stored in volumes on storage nodes. One volume server can have multiple volumes, and can both support read and write access with basic authentication.
|
||||
|
||||
All volumes are managed by a master server. The master server contains the volume id to volume server mapping. This is fairly static information, and can be easily cached.
|
||||
|
||||
On each write request, the master server also generates a file key, which is a growing 64-bit unsigned integer. Since write requests are not generally as frequent as read requests, one master server should be able to handle the concurrency well.
|
||||
|
||||
### Write and Read files ###
|
||||
|
||||
When a client sends a write request, the master server returns (volume id, file key, file cookie, volume node url) for the file. The client then contacts the volume node and POSTs the file content.
|
||||
|
||||
When a client needs to read a file based on (volume id, file key, file cookie), it asks the master server by the volume id for the (volume node url, volume node public url), or retrieves this from a cache. Then the client can GET the content, or just render the URL on web pages and let browsers fetch the content.
|
||||
|
||||
Please see the example for details on the write-read process.
|
||||
|
||||
### Storage Size ###
|
||||
|
||||
In the current implementation, each volume can hold 32 gibibytes (32GiB or 8x2^32 bytes). This is because we align content to 8 bytes. We can easily increase this to 64GiB, or 128GiB, or more, by changing 2 lines of code, at the cost of some wasted padding space due to alignment.
|
||||
|
||||
There can be 4 gibibytes (4GiB or 2^32 bytes) of volumes. So the total system size is 8 x 4GiB x 4GiB which is 128 exbibytes (128EiB or 2^67 bytes).
|
||||
|
||||
Each individual file size is limited to the volume size.
|
||||
|
||||
### Saving memory ###
|
||||
|
||||
All file meta information stored on an volume server is readable from memory without disk access. Each file takes just a 16-byte map entry of <64bit key, 32bit offset, 32bit size>. Of course, each map entry has its own space cost for the map. But usually the disk space runs out before the memory does.
|
||||
|
||||
## Compared to Other File Systems ##
|
||||
|
||||
Most other distributed file systems seem more complicated than necessary.
|
||||
|
||||
SeaweedFS is meant to be fast and simple, in both setup and operation. If you do not understand how it works when you reach here, we've failed! Please raise an issue with any questions or update this file with clarifications.
|
||||
|
||||
### Compared to HDFS ###
|
||||
|
||||
HDFS uses the chunk approach for each file, and is ideal for storing large files.
|
||||
|
||||
SeaweedFS is ideal for serving relatively smaller files quickly and concurrently.
|
||||
|
||||
SeaweedFS can also store extra large files by splitting them into manageable data chunks, and store the file ids of the data chunks into a meta chunk. This is managed by "weed upload/download" tool, and the weed master or volume servers are agnostic about it.
|
||||
|
||||
|
||||
### Compared to GlusterFS, Ceph ###
|
||||
|
||||
The architectures are mostly the same. SeaweedFS aims to store and read files fast, with a simple and flat architecture. The main differences are
|
||||
|
||||
* SeaweedFS optimizes for small files, ensuring O(1) disk seek operation, and can also handle large files.
|
||||
* SeaweedFS statically assigns a volume id for a file. Locating file content becomes just a lookup of the volume id, which can be easily cached.
|
||||
* SeaweedFS Filer metadata store can be any well-known and proven data stores, e.g., Cassandra, Redis, MySql, Postgres, etc, and is easy to customized.
|
||||
* SeaweedFS Volume server also communicates directly with clients via HTTP, supporting range queries, direct uploads, etc.
|
||||
|
||||
| System | File Meta | File Content Read| POSIX | REST API | Optimized for small files |
|
||||
| ------------- | ------------------------------- | ---------------- | ------ | -------- | ------------------------- |
|
||||
| SeaweedFS | lookup volume id, cacheable | O(1) disk seek | | Yes | Yes |
|
||||
| SeaweedFS Filer| Linearly Scalable, Customizable | O(1) disk seek | FUSE | Yes | Yes |
|
||||
| GlusterFS | hashing | | FUSE, NFS | | |
|
||||
| Ceph | hashing + rules | | FUSE | Yes | |
|
||||
|
||||
### Compared to GlusterFS ###
|
||||
|
||||
GlusterFS stores files, both directories and content, in configurable volumes called "bricks".
|
||||
|
||||
GlusterFS hashes the path and filename into ids, and assigned to virtual volumes, and then mapped to "bricks".
|
||||
|
||||
### Compared to Ceph ###
|
||||
|
||||
Ceph can be setup similar to SeaweedFS as a key->blob store. It is much more complicated, with the need to support layers on top of it. [Here is a more detailed comparison](https://github.com/chrislusf/seaweedfs/issues/120)
|
||||
|
||||
SeaweedFS has a centralized master group to look up free volumes, while Ceph uses hashing and metadata servers to locate its objects. Having a centralized master makes it easy to code and manage.
|
||||
|
||||
Same as SeaweedFS, Ceph is also based on the object store RADOS. Ceph is rather complicated with mixed reviews.
|
||||
|
||||
Ceph uses CRUSH hashing to automatically manage the data placement. SeaweedFS places data by assigned volumes.
|
||||
|
||||
SeaweedFS is optimized for small files. Small files are stored as one continuous block of content, with at most 8 unused bytes between files. Small file access is O(1) disk read.
|
||||
|
||||
SeaweedFS Filer uses off-the-shelf stores, such as MySql, Postgres, Redis, Cassandra, to manage file directories. There are proven, scalable, and easier to manage.
|
||||
|
||||
| SeaweedFS | comparable to Ceph | advantage |
|
||||
| ------------- | ------------- | ---------------- |
|
||||
| Master | MDS | simpler |
|
||||
| Volume | OSD | optimized for small files |
|
||||
| Filer | Ceph FS | linearly scalable, Customizable, O(1) or O(logN) |
|
||||
|
||||
|
||||
## Dev plan ##
|
||||
|
||||
More tools and documentation, on how to maintain and scale the system. For example, how to move volumes, automatically balancing data, how to grow volumes, how to check system status, etc.
|
||||
Other key features include: Erasure Encoding, JWT security.
|
||||
|
||||
This is a super exciting project! And we need helpers and [support](https://www.patreon.com/seaweedfs)!
|
||||
|
||||
|
||||
## Installation guide for users who are not familiar with golang
|
||||
|
||||
Step 1: install go on your machine and setup the environment by following the instructions at:
|
||||
|
||||
https://golang.org/doc/install
|
||||
|
||||
make sure you set up your $GOPATH
|
||||
|
||||
|
||||
Step 2: also you may need to install Mercurial by following the instructions at:
|
||||
|
||||
http://mercurial.selenic.com/downloads
|
||||
|
||||
Step 3: download, compile, and install the project by executing the following command
|
||||
|
||||
```bash
|
||||
go get github.com/chrislusf/seaweedfs/weed
|
||||
```
|
||||
|
||||
Once this is done, you will find the executable "weed" in your `$GOPATH/bin` directory
|
||||
|
||||
Step 4: after you modify your code locally, you could start a local build by calling `go install` under
|
||||
|
||||
```
|
||||
$GOPATH/src/github.com/chrislusf/seaweedfs/weed
|
||||
```
|
||||
|
||||
## Disk Related topics ##
|
||||
|
||||
### Hard Drive Performance ###
|
||||
|
||||
When testing read performance on SeaweedFS, it basically becomes a performance test of your hard drive's random read speed. Hard drives usually get 100MB/s~200MB/s.
|
||||
|
||||
### Solid State Disk
|
||||
|
||||
To modify or delete small files, SSD must delete a whole block at a time, and move content in existing blocks to a new block. SSD is fast when brand new, but will get fragmented over time and you have to garbage collect, compacting blocks. SeaweedFS is friendly to SSD since it is append-only. Deletion and compaction are done on volume level in the background, not slowing reading and not causing fragmentation.
|
||||
|
||||
## Benchmark
|
||||
|
||||
My Own Unscientific Single Machine Results on Mac Book with Solid State Disk, CPU: 1 Intel Core i7 2.6GHz.
|
||||
|
||||
Write 1 million 1KB file:
|
||||
```
|
||||
Concurrency Level: 16
|
||||
Time taken for tests: 88.796 seconds
|
||||
Complete requests: 1048576
|
||||
Failed requests: 0
|
||||
Total transferred: 1106764659 bytes
|
||||
Requests per second: 11808.87 [#/sec]
|
||||
Transfer rate: 12172.05 [Kbytes/sec]
|
||||
|
||||
Connection Times (ms)
|
||||
min avg max std
|
||||
Total: 0.2 1.3 44.8 0.9
|
||||
|
||||
Percentage of the requests served within a certain time (ms)
|
||||
50% 1.1 ms
|
||||
66% 1.3 ms
|
||||
75% 1.5 ms
|
||||
80% 1.7 ms
|
||||
90% 2.1 ms
|
||||
95% 2.6 ms
|
||||
98% 3.7 ms
|
||||
99% 4.6 ms
|
||||
100% 44.8 ms
|
||||
```
|
||||
|
||||
Randomly read 1 million files:
|
||||
```
|
||||
Concurrency Level: 16
|
||||
Time taken for tests: 34.263 seconds
|
||||
Complete requests: 1048576
|
||||
Failed requests: 0
|
||||
Total transferred: 1106762945 bytes
|
||||
Requests per second: 30603.34 [#/sec]
|
||||
Transfer rate: 31544.49 [Kbytes/sec]
|
||||
|
||||
Connection Times (ms)
|
||||
min avg max std
|
||||
Total: 0.0 0.5 20.7 0.7
|
||||
|
||||
Percentage of the requests served within a certain time (ms)
|
||||
50% 0.4 ms
|
||||
75% 0.5 ms
|
||||
95% 0.6 ms
|
||||
98% 0.8 ms
|
||||
99% 1.2 ms
|
||||
100% 20.7 ms
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
## Stargazers over time
|
||||
|
||||
[](https://starcharts.herokuapp.com/chrislusf/seaweedfs)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<h1 align="center">Sponsors & Backers</h1>
|
||||
|
||||
- [Become a backer or sponsor on Patreon](https://www.patreon.com/seaweedfs).
|
||||
|
||||
<h2 align="center">Generous Backers ($50+)</h2>
|
||||
|
||||
- [Evercam Camera Management Software](https://evercam.io/)
|
||||
|
||||
<h2 align="center">Backers</h2>
|
||||
|
||||
- [ColorfulClouds Tech Co. Ltd.](https://caiyunai.com/)
|
||||
- [Haravan - Ecommerce Platform](https://www.haravan.com)
|
||||
@@ -0,0 +1,29 @@
|
||||
FROM frolvlad/alpine-glibc
|
||||
|
||||
# Tried to use curl only (curl -o /tmp/linux_amd64.tar.gz ...), however it turned out that the following tar command failed with "gzip: stdin: not in gzip format"
|
||||
RUN apk add --no-cache --virtual build-dependencies --update wget curl ca-certificates && \
|
||||
wget -P /tmp https://github.com/$(curl -s -L https://github.com/chrislusf/seaweedfs/releases/latest | egrep -o 'chrislusf/seaweedfs/releases/download/.*/linux_amd64.tar.gz') && \
|
||||
tar -C /usr/bin/ -xzvf /tmp/linux_amd64.tar.gz && \
|
||||
apk del build-dependencies && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
# volume server gprc port
|
||||
EXPOSE 18080
|
||||
# volume server http port
|
||||
EXPOSE 8080
|
||||
# filer server gprc port
|
||||
EXPOSE 18888
|
||||
# filer server http port
|
||||
EXPOSE 8888
|
||||
# master server shared gprc+http port
|
||||
EXPOSE 9333
|
||||
# s3 server http port
|
||||
EXPOSE 8333
|
||||
|
||||
VOLUME /data
|
||||
|
||||
COPY filer.toml /etc/seaweedfs/filer.toml
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,25 @@
|
||||
FROM golang:latest
|
||||
RUN go get github.com/chrislusf/seaweedfs/weed
|
||||
|
||||
# volume server gprc port
|
||||
EXPOSE 18080
|
||||
# volume server http port
|
||||
EXPOSE 8080
|
||||
# filer server gprc port
|
||||
EXPOSE 18888
|
||||
# filer server http port
|
||||
EXPOSE 8888
|
||||
# master server shared gprc+http port
|
||||
EXPOSE 9333
|
||||
# s3 server http port
|
||||
EXPOSE 8333
|
||||
|
||||
VOLUME /data
|
||||
|
||||
RUN mkdir -p /etc/seaweedfs
|
||||
RUN cp /go/src/github.com/chrislusf/seaweedfs/docker/filer.toml /etc/seaweedfs/filer.toml
|
||||
RUN cp /go/src/github.com/chrislusf/seaweedfs/docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
RUN cp /go/bin/weed /usr/bin/
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,21 @@
|
||||
# Docker
|
||||
|
||||
|
||||
## Try it out
|
||||
|
||||
```bash
|
||||
|
||||
wget https://raw.githubusercontent.com/chrislusf/seaweedfs/master/docker/seaweedfs-compose.yml
|
||||
|
||||
docker-compose -f seaweedfs-compose.yml -p seaweedfs up
|
||||
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
cd $GOPATH/src/github.com/chrislusf/seaweedfs/docker
|
||||
|
||||
docker-compose -f dev-compose.yml -p seaweedfs up
|
||||
|
||||
```
|
||||
@@ -0,0 +1,42 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
master:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.go_build
|
||||
ports:
|
||||
- 9333:9333
|
||||
command: "master"
|
||||
volume:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.go_build
|
||||
ports:
|
||||
- 8080:8080
|
||||
- 18080:18080
|
||||
command: 'volume -max=5 -mserver="master:9333" -port=8080'
|
||||
depends_on:
|
||||
- master
|
||||
filer:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.go_build
|
||||
ports:
|
||||
- 8888:8888
|
||||
- 18888:18888
|
||||
command: 'filer -master="master:9333"'
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
s3:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.go_build
|
||||
ports:
|
||||
- 8333:8333
|
||||
command: 's3 -filer="filer:8888"'
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
- filer
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
|
||||
'master')
|
||||
ARGS="-ip `hostname -i` -mdir /data"
|
||||
# Is this instance linked with an other master? (Docker commandline "--link master1:master")
|
||||
if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -peers=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
|
||||
fi
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
'volume')
|
||||
ARGS="-ip `hostname -i` -dir /data"
|
||||
# Is this instance linked with a master? (Docker commandline "--link master1:master")
|
||||
if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -mserver=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
|
||||
fi
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
'server')
|
||||
ARGS="-ip `hostname -i` -dir /data"
|
||||
if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -master.peers=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
|
||||
fi
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
'filer')
|
||||
ARGS="-ip `hostname -i` "
|
||||
if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -master=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
|
||||
fi
|
||||
mkdir -p /data/filerdb
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
's3')
|
||||
ARGS="-domainName=$S3_DOMAIN_NAME -key.file=$S3_KEY_FILE -cert.file=$S3_CERT_FILE"
|
||||
if [ -n "$FILER_PORT_8888_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -filer=$FILER_PORT_8888_TCP_ADDR:$FILER_PORT_8888_TCP_PORT"
|
||||
fi
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
*)
|
||||
exec /usr/bin/weed $@
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,3 @@
|
||||
[leveldb]
|
||||
enabled = true
|
||||
dir = "/data/filerdb"
|
||||
@@ -0,0 +1,36 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
master:
|
||||
image: chrislusf/seaweedfs # use a remote image
|
||||
ports:
|
||||
- 9333:9333
|
||||
command: "master"
|
||||
volume:
|
||||
image: chrislusf/seaweedfs # use a remote image
|
||||
ports:
|
||||
- 8080:8080
|
||||
- 18080:18080
|
||||
command: 'volume -max=15 -mserver="master:9333" -port=8080'
|
||||
depends_on:
|
||||
- master
|
||||
filer:
|
||||
image: chrislusf/seaweedfs # use a remote image
|
||||
ports:
|
||||
- 8888:8888
|
||||
- 18888:18888
|
||||
command: 'filer -master="master:9333"'
|
||||
tty: true
|
||||
stdin_open: true
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
s3:
|
||||
image: chrislusf/seaweedfs # use a remote image
|
||||
ports:
|
||||
- 8333:8333
|
||||
command: 's3 -filer="filer:8888"'
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
- filer
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
@@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.github.chrislusf</groupId>
|
||||
<artifactId>seaweedfs-client</artifactId>
|
||||
<version>1.0.5</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>9</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<protobuf.version>3.5.1</protobuf.version>
|
||||
<grpc.version>1.16.1</grpc.version>
|
||||
<guava.version>26.0-jre</guava.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java -->
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>${protobuf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-netty-shaded</artifactId>
|
||||
<version>${grpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-protobuf</artifactId>
|
||||
<version>${grpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-stub</artifactId>
|
||||
<version>${grpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>kr.motd.maven</groupId>
|
||||
<artifactId>os-maven-plugin</artifactId>
|
||||
<version>1.5.0.Final</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>7</source>
|
||||
<target>7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.xolstice.maven.plugins</groupId>
|
||||
<artifactId>protobuf-maven-plugin</artifactId>
|
||||
<version>0.5.1</version>
|
||||
<configuration>
|
||||
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}-1:exe:${os.detected.classifier}</protocArtifact>
|
||||
<pluginId>grpc-java</pluginId>
|
||||
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>compile-custom</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,21 @@
|
||||
package seaweedfs.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class ByteBufferOutputStream extends OutputStream {
|
||||
private final ByteBuffer buf;
|
||||
|
||||
public ByteBufferOutputStream(ByteBuffer buf) {
|
||||
this.buf = buf;
|
||||
}
|
||||
|
||||
public void write(int b) throws IOException {
|
||||
this.buf.put((byte)b);
|
||||
}
|
||||
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
this.buf.put(b, off, len);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package seaweedfs.client;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class FilerClient {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FilerClient.class);
|
||||
|
||||
private FilerGrpcClient filerGrpcClient;
|
||||
|
||||
public FilerClient(String host, int grpcPort) {
|
||||
filerGrpcClient = new FilerGrpcClient(host, grpcPort);
|
||||
}
|
||||
|
||||
public FilerClient(FilerGrpcClient filerGrpcClient) {
|
||||
this.filerGrpcClient = filerGrpcClient;
|
||||
}
|
||||
|
||||
public boolean mkdirs(String path, int mode) {
|
||||
String currentUser = System.getProperty("user.name");
|
||||
return mkdirs(path, mode, 0, 0, currentUser, new String[]{});
|
||||
}
|
||||
|
||||
public boolean mkdirs(String path, int mode, String userName, String[] groupNames) {
|
||||
return mkdirs(path, mode, 0, 0, userName, groupNames);
|
||||
}
|
||||
|
||||
public boolean mkdirs(String path, int mode, int uid, int gid, String userName, String[] groupNames) {
|
||||
|
||||
Path pathObject = Paths.get(path);
|
||||
String parent = pathObject.getParent().toString();
|
||||
String name = pathObject.getFileName().toString();
|
||||
|
||||
if ("/".equals(path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mkdirs(parent, mode, uid, gid, userName, groupNames);
|
||||
|
||||
FilerProto.Entry existingEntry = lookupEntry(parent, name);
|
||||
|
||||
if (existingEntry != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return createEntry(
|
||||
parent,
|
||||
newDirectoryEntry(name, mode, uid, gid, userName, groupNames).build()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public boolean rm(String path, boolean isRecursive) {
|
||||
|
||||
Path pathObject = Paths.get(path);
|
||||
String parent = pathObject.getParent().toString();
|
||||
String name = pathObject.getFileName().toString();
|
||||
|
||||
return deleteEntry(
|
||||
parent,
|
||||
name,
|
||||
true,
|
||||
isRecursive);
|
||||
}
|
||||
|
||||
public boolean touch(String path, int mode) {
|
||||
String currentUser = System.getProperty("user.name");
|
||||
return touch(path, mode, 0, 0, currentUser, new String[]{});
|
||||
}
|
||||
|
||||
public boolean touch(String path, int mode, int uid, int gid, String userName, String[] groupNames) {
|
||||
|
||||
Path pathObject = Paths.get(path);
|
||||
String parent = pathObject.getParent().toString();
|
||||
String name = pathObject.getFileName().toString();
|
||||
|
||||
FilerProto.Entry entry = lookupEntry(parent, name);
|
||||
if (entry == null) {
|
||||
return createEntry(
|
||||
parent,
|
||||
newFileEntry(name, mode, uid, gid, userName, groupNames).build()
|
||||
);
|
||||
}
|
||||
long now = System.currentTimeMillis() / 1000L;
|
||||
FilerProto.FuseAttributes.Builder attr = entry.getAttributes().toBuilder()
|
||||
.setMtime(now)
|
||||
.setUid(uid)
|
||||
.setGid(gid)
|
||||
.setUserName(userName)
|
||||
.clearGroupName()
|
||||
.addAllGroupName(Arrays.asList(groupNames));
|
||||
return updateEntry(parent, entry.toBuilder().setAttributes(attr).build());
|
||||
}
|
||||
|
||||
public FilerProto.Entry.Builder newDirectoryEntry(String name, int mode,
|
||||
int uid, int gid, String userName, String[] groupNames) {
|
||||
|
||||
long now = System.currentTimeMillis() / 1000L;
|
||||
|
||||
return FilerProto.Entry.newBuilder()
|
||||
.setName(name)
|
||||
.setIsDirectory(true)
|
||||
.setAttributes(FilerProto.FuseAttributes.newBuilder()
|
||||
.setMtime(now)
|
||||
.setCrtime(now)
|
||||
.setUid(uid)
|
||||
.setGid(gid)
|
||||
.setFileMode(mode | 1 << 31)
|
||||
.setUserName(userName)
|
||||
.clearGroupName()
|
||||
.addAllGroupName(Arrays.asList(groupNames)));
|
||||
}
|
||||
|
||||
public FilerProto.Entry.Builder newFileEntry(String name, int mode,
|
||||
int uid, int gid, String userName, String[] groupNames) {
|
||||
|
||||
long now = System.currentTimeMillis() / 1000L;
|
||||
|
||||
return FilerProto.Entry.newBuilder()
|
||||
.setName(name)
|
||||
.setIsDirectory(false)
|
||||
.setAttributes(FilerProto.FuseAttributes.newBuilder()
|
||||
.setMtime(now)
|
||||
.setCrtime(now)
|
||||
.setUid(uid)
|
||||
.setGid(gid)
|
||||
.setFileMode(mode)
|
||||
.setUserName(userName)
|
||||
.clearGroupName()
|
||||
.addAllGroupName(Arrays.asList(groupNames)));
|
||||
}
|
||||
|
||||
public List<FilerProto.Entry> listEntries(String path) {
|
||||
List<FilerProto.Entry> results = new ArrayList<FilerProto.Entry>();
|
||||
String lastFileName = "";
|
||||
for (int limit = Integer.MAX_VALUE; limit > 0; ) {
|
||||
List<FilerProto.Entry> t = listEntries(path, "", lastFileName, 1024);
|
||||
if (t == null) {
|
||||
break;
|
||||
}
|
||||
int nSize = t.size();
|
||||
if (nSize > 0) {
|
||||
limit -= nSize;
|
||||
lastFileName = t.get(nSize - 1).getName();
|
||||
}
|
||||
results.addAll(t);
|
||||
if (t.size() < 1024) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<FilerProto.Entry> listEntries(String path, String entryPrefix, String lastEntryName, int limit) {
|
||||
return filerGrpcClient.getBlockingStub().listEntries(FilerProto.ListEntriesRequest.newBuilder()
|
||||
.setDirectory(path)
|
||||
.setPrefix(entryPrefix)
|
||||
.setStartFromFileName(lastEntryName)
|
||||
.setLimit(limit)
|
||||
.build()).getEntriesList();
|
||||
}
|
||||
|
||||
public FilerProto.Entry lookupEntry(String directory, String entryName) {
|
||||
try {
|
||||
return filerGrpcClient.getBlockingStub().lookupDirectoryEntry(
|
||||
FilerProto.LookupDirectoryEntryRequest.newBuilder()
|
||||
.setDirectory(directory)
|
||||
.setName(entryName)
|
||||
.build()).getEntry();
|
||||
} catch (Exception e) {
|
||||
LOG.warn("lookupEntry {}/{}: {}", directory, entryName, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean createEntry(String parent, FilerProto.Entry entry) {
|
||||
try {
|
||||
filerGrpcClient.getBlockingStub().createEntry(FilerProto.CreateEntryRequest.newBuilder()
|
||||
.setDirectory(parent)
|
||||
.setEntry(entry)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
LOG.warn("createEntry {}/{}: {}", parent, entry.getName(), e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean updateEntry(String parent, FilerProto.Entry entry) {
|
||||
try {
|
||||
filerGrpcClient.getBlockingStub().updateEntry(FilerProto.UpdateEntryRequest.newBuilder()
|
||||
.setDirectory(parent)
|
||||
.setEntry(entry)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
LOG.warn("createEntry {}/{}: {}", parent, entry.getName(), e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean deleteEntry(String parent, String entryName, boolean isDeleteFileChunk, boolean isRecursive) {
|
||||
try {
|
||||
filerGrpcClient.getBlockingStub().deleteEntry(FilerProto.DeleteEntryRequest.newBuilder()
|
||||
.setDirectory(parent)
|
||||
.setName(entryName)
|
||||
.setIsDeleteData(isDeleteFileChunk)
|
||||
.setIsRecursive(isRecursive)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
LOG.warn("deleteEntry {}/{}: {}", parent, entryName, e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package seaweedfs.client;
|
||||
|
||||
import io.grpc.ManagedChannel;
|
||||
import io.grpc.ManagedChannelBuilder;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class FilerGrpcClient {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(FilerGrpcClient.class.getName());
|
||||
|
||||
private final ManagedChannel channel;
|
||||
private final SeaweedFilerGrpc.SeaweedFilerBlockingStub blockingStub;
|
||||
private final SeaweedFilerGrpc.SeaweedFilerStub asyncStub;
|
||||
private final SeaweedFilerGrpc.SeaweedFilerFutureStub futureStub;
|
||||
|
||||
|
||||
public FilerGrpcClient(String host, int grpcPort) {
|
||||
this(ManagedChannelBuilder.forAddress(host, grpcPort).usePlaintext());
|
||||
}
|
||||
|
||||
public FilerGrpcClient(ManagedChannelBuilder<?> channelBuilder) {
|
||||
channel = channelBuilder.build();
|
||||
blockingStub = SeaweedFilerGrpc.newBlockingStub(channel);
|
||||
asyncStub = SeaweedFilerGrpc.newStub(channel);
|
||||
futureStub = SeaweedFilerGrpc.newFutureStub(channel);
|
||||
}
|
||||
|
||||
public void shutdown() throws InterruptedException {
|
||||
channel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public SeaweedFilerGrpc.SeaweedFilerBlockingStub getBlockingStub() {
|
||||
return blockingStub;
|
||||
}
|
||||
|
||||
public SeaweedFilerGrpc.SeaweedFilerStub getAsyncStub() {
|
||||
return asyncStub;
|
||||
}
|
||||
|
||||
public SeaweedFilerGrpc.SeaweedFilerFutureStub getFutureStub() {
|
||||
return futureStub;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package seaweedfs.client;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SeaweedRead {
|
||||
|
||||
// private static final Logger LOG = LoggerFactory.getLogger(SeaweedRead.class);
|
||||
|
||||
// returns bytesRead
|
||||
public static long read(FilerGrpcClient filerGrpcClient, List<VisibleInterval> visibleIntervals,
|
||||
final long position, final byte[] buffer, final int bufferOffset,
|
||||
final int bufferLength) {
|
||||
|
||||
List<ChunkView> chunkViews = viewFromVisibles(visibleIntervals, position, bufferLength);
|
||||
|
||||
FilerProto.LookupVolumeRequest.Builder lookupRequest = FilerProto.LookupVolumeRequest.newBuilder();
|
||||
for (ChunkView chunkView : chunkViews) {
|
||||
String vid = parseVolumeId(chunkView.fileId);
|
||||
lookupRequest.addVolumeIds(vid);
|
||||
}
|
||||
|
||||
FilerProto.LookupVolumeResponse lookupResponse = filerGrpcClient
|
||||
.getBlockingStub().lookupVolume(lookupRequest.build());
|
||||
|
||||
Map<String, FilerProto.Locations> vid2Locations = lookupResponse.getLocationsMapMap();
|
||||
|
||||
//TODO parallel this
|
||||
long readCount = 0;
|
||||
int startOffset = bufferOffset;
|
||||
for (ChunkView chunkView : chunkViews) {
|
||||
FilerProto.Locations locations = vid2Locations.get(parseVolumeId(chunkView.fileId));
|
||||
if (locations.getLocationsCount() == 0) {
|
||||
// log here!
|
||||
return 0;
|
||||
}
|
||||
|
||||
int len = readChunkView(position, buffer, startOffset, chunkView, locations);
|
||||
|
||||
readCount += len;
|
||||
startOffset += len;
|
||||
|
||||
}
|
||||
|
||||
return readCount;
|
||||
}
|
||||
|
||||
private static int readChunkView(long position, byte[] buffer, int startOffset, ChunkView chunkView, FilerProto.Locations locations) {
|
||||
HttpClient client = HttpClientBuilder.create().build();
|
||||
HttpGet request = new HttpGet(
|
||||
String.format("http://%s/%s", locations.getLocations(0).getUrl(), chunkView.fileId));
|
||||
|
||||
if (!chunkView.isFullChunk) {
|
||||
request.setHeader(HttpHeaders.ACCEPT_ENCODING, "");
|
||||
request.setHeader(HttpHeaders.RANGE,
|
||||
String.format("bytes=%d-%d", chunkView.offset, chunkView.offset + chunkView.size));
|
||||
}
|
||||
|
||||
try {
|
||||
HttpResponse response = client.execute(request);
|
||||
HttpEntity entity = response.getEntity();
|
||||
|
||||
int len = (int) (chunkView.logicOffset - position + chunkView.size);
|
||||
OutputStream outputStream = new ByteBufferOutputStream(ByteBuffer.wrap(buffer, startOffset, len));
|
||||
entity.writeTo(outputStream);
|
||||
// LOG.debug("* read chunkView:{} startOffset:{} length:{}", chunkView, startOffset, len);
|
||||
|
||||
return len;
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static List<ChunkView> viewFromVisibles(List<VisibleInterval> visibleIntervals, long offset, long size) {
|
||||
List<ChunkView> views = new ArrayList<>();
|
||||
|
||||
long stop = offset + size;
|
||||
for (VisibleInterval chunk : visibleIntervals) {
|
||||
if (chunk.start <= offset && offset < chunk.stop && offset < stop) {
|
||||
boolean isFullChunk = chunk.isFullChunk && chunk.start == offset && chunk.stop <= stop;
|
||||
views.add(new ChunkView(
|
||||
chunk.fileId,
|
||||
offset - chunk.start,
|
||||
Math.min(chunk.stop, stop) - offset,
|
||||
offset,
|
||||
isFullChunk
|
||||
));
|
||||
offset = Math.min(chunk.stop, stop);
|
||||
}
|
||||
}
|
||||
return views;
|
||||
}
|
||||
|
||||
public static List<VisibleInterval> nonOverlappingVisibleIntervals(List<FilerProto.FileChunk> chunkList) {
|
||||
FilerProto.FileChunk[] chunks = chunkList.toArray(new FilerProto.FileChunk[0]);
|
||||
Arrays.sort(chunks, new Comparator<FilerProto.FileChunk>() {
|
||||
@Override
|
||||
public int compare(FilerProto.FileChunk a, FilerProto.FileChunk b) {
|
||||
return (int) (a.getMtime() - b.getMtime());
|
||||
}
|
||||
});
|
||||
|
||||
List<VisibleInterval> visibles = new ArrayList<>();
|
||||
for (FilerProto.FileChunk chunk : chunks) {
|
||||
List<VisibleInterval> newVisibles = new ArrayList<>();
|
||||
visibles = mergeIntoVisibles(visibles, newVisibles, chunk);
|
||||
}
|
||||
|
||||
return visibles;
|
||||
}
|
||||
|
||||
private static List<VisibleInterval> mergeIntoVisibles(List<VisibleInterval> visibles,
|
||||
List<VisibleInterval> newVisibles,
|
||||
FilerProto.FileChunk chunk) {
|
||||
VisibleInterval newV = new VisibleInterval(
|
||||
chunk.getOffset(),
|
||||
chunk.getOffset() + chunk.getSize(),
|
||||
chunk.getFileId(),
|
||||
chunk.getMtime(),
|
||||
true
|
||||
);
|
||||
|
||||
// easy cases to speed up
|
||||
if (visibles.size() == 0) {
|
||||
visibles.add(newV);
|
||||
return visibles;
|
||||
}
|
||||
if (visibles.get(visibles.size() - 1).stop <= chunk.getOffset()) {
|
||||
visibles.add(newV);
|
||||
return visibles;
|
||||
}
|
||||
|
||||
for (VisibleInterval v : visibles) {
|
||||
if (v.start < chunk.getOffset() && chunk.getOffset() < v.stop) {
|
||||
newVisibles.add(new VisibleInterval(
|
||||
v.start,
|
||||
chunk.getOffset(),
|
||||
v.fileId,
|
||||
v.modifiedTime,
|
||||
false
|
||||
));
|
||||
}
|
||||
long chunkStop = chunk.getOffset() + chunk.getSize();
|
||||
if (v.start < chunkStop && chunkStop < v.stop) {
|
||||
newVisibles.add(new VisibleInterval(
|
||||
chunkStop,
|
||||
v.stop,
|
||||
v.fileId,
|
||||
v.modifiedTime,
|
||||
false
|
||||
));
|
||||
}
|
||||
if (chunkStop <= v.start || v.stop <= chunk.getOffset()) {
|
||||
newVisibles.add(v);
|
||||
}
|
||||
}
|
||||
newVisibles.add(newV);
|
||||
|
||||
// keep everything sorted
|
||||
for (int i = newVisibles.size() - 1; i >= 0; i--) {
|
||||
if (i > 0 && newV.start < newVisibles.get(i - 1).start) {
|
||||
newVisibles.set(i, newVisibles.get(i - 1));
|
||||
} else {
|
||||
newVisibles.set(i, newV);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return newVisibles;
|
||||
}
|
||||
|
||||
public static String parseVolumeId(String fileId) {
|
||||
int commaIndex = fileId.lastIndexOf(',');
|
||||
if (commaIndex > 0) {
|
||||
return fileId.substring(0, commaIndex);
|
||||
}
|
||||
return fileId;
|
||||
}
|
||||
|
||||
public static long totalSize(List<FilerProto.FileChunk> chunksList) {
|
||||
long size = 0;
|
||||
for (FilerProto.FileChunk chunk : chunksList) {
|
||||
long t = chunk.getOffset() + chunk.getSize();
|
||||
if (size < t) {
|
||||
size = t;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public static class VisibleInterval {
|
||||
public final long start;
|
||||
public final long stop;
|
||||
public final long modifiedTime;
|
||||
public final String fileId;
|
||||
public final boolean isFullChunk;
|
||||
|
||||
public VisibleInterval(long start, long stop, String fileId, long modifiedTime, boolean isFullChunk) {
|
||||
this.start = start;
|
||||
this.stop = stop;
|
||||
this.modifiedTime = modifiedTime;
|
||||
this.fileId = fileId;
|
||||
this.isFullChunk = isFullChunk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VisibleInterval{" +
|
||||
"start=" + start +
|
||||
", stop=" + stop +
|
||||
", modifiedTime=" + modifiedTime +
|
||||
", fileId='" + fileId + '\'' +
|
||||
", isFullChunk=" + isFullChunk +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class ChunkView {
|
||||
public final String fileId;
|
||||
public final long offset;
|
||||
public final long size;
|
||||
public final long logicOffset;
|
||||
public final boolean isFullChunk;
|
||||
|
||||
public ChunkView(String fileId, long offset, long size, long logicOffset, boolean isFullChunk) {
|
||||
this.fileId = fileId;
|
||||
this.offset = offset;
|
||||
this.size = size;
|
||||
this.logicOffset = logicOffset;
|
||||
this.isFullChunk = isFullChunk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChunkView{" +
|
||||
"fileId='" + fileId + '\'' +
|
||||
", offset=" + offset +
|
||||
", size=" + size +
|
||||
", logicOffset=" + logicOffset +
|
||||
", isFullChunk=" + isFullChunk +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package seaweedfs.client;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.mime.HttpMultipartMode;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class SeaweedWrite {
|
||||
|
||||
public static void writeData(FilerProto.Entry.Builder entry,
|
||||
final String replication,
|
||||
final FilerGrpcClient filerGrpcClient,
|
||||
final long offset,
|
||||
final byte[] bytes,
|
||||
final long bytesOffset, final long bytesLength) throws IOException {
|
||||
FilerProto.AssignVolumeResponse response = filerGrpcClient.getBlockingStub().assignVolume(
|
||||
FilerProto.AssignVolumeRequest.newBuilder()
|
||||
.setCollection("")
|
||||
.setReplication(replication)
|
||||
.setDataCenter("")
|
||||
.setReplication("")
|
||||
.setTtlSec(0)
|
||||
.build());
|
||||
String fileId = response.getFileId();
|
||||
String url = response.getUrl();
|
||||
String targetUrl = String.format("http://%s/%s", url, fileId);
|
||||
|
||||
String etag = multipartUpload(targetUrl, bytes, bytesOffset, bytesLength);
|
||||
|
||||
entry.addChunks(FilerProto.FileChunk.newBuilder()
|
||||
.setFileId(fileId)
|
||||
.setOffset(offset)
|
||||
.setSize(bytesLength)
|
||||
.setMtime(System.currentTimeMillis() / 10000L)
|
||||
.setETag(etag)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static void writeMeta(final FilerGrpcClient filerGrpcClient,
|
||||
final String parentDirectory, final FilerProto.Entry.Builder entry) {
|
||||
filerGrpcClient.getBlockingStub().createEntry(
|
||||
FilerProto.CreateEntryRequest.newBuilder()
|
||||
.setDirectory(parentDirectory)
|
||||
.setEntry(entry)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
private static String multipartUpload(String targetUrl,
|
||||
final byte[] bytes,
|
||||
final long bytesOffset, final long bytesLength) throws IOException {
|
||||
|
||||
CloseableHttpClient client = HttpClientBuilder.create().setUserAgent("hdfs-client").build();
|
||||
|
||||
InputStream inputStream = new ByteArrayInputStream(bytes, (int) bytesOffset, (int) bytesLength);
|
||||
|
||||
HttpPost post = new HttpPost(targetUrl);
|
||||
|
||||
post.setEntity(MultipartEntityBuilder.create()
|
||||
.setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
|
||||
.addBinaryBody("upload", inputStream)
|
||||
.build());
|
||||
|
||||
try {
|
||||
HttpResponse response = client.execute(post);
|
||||
|
||||
String etag = response.getLastHeader("ETag").getValue();
|
||||
|
||||
if (etag != null && etag.startsWith("\"") && etag.endsWith("\"")) {
|
||||
etag = etag.substring(1, etag.length() - 1);
|
||||
}
|
||||
|
||||
return etag;
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package filer_pb;
|
||||
|
||||
option java_package = "seaweedfs.client";
|
||||
option java_outer_classname = "FilerProto";
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
service SeaweedFiler {
|
||||
|
||||
rpc LookupDirectoryEntry (LookupDirectoryEntryRequest) returns (LookupDirectoryEntryResponse) {
|
||||
}
|
||||
|
||||
rpc ListEntries (ListEntriesRequest) returns (ListEntriesResponse) {
|
||||
}
|
||||
|
||||
rpc CreateEntry (CreateEntryRequest) returns (CreateEntryResponse) {
|
||||
}
|
||||
|
||||
rpc UpdateEntry (UpdateEntryRequest) returns (UpdateEntryResponse) {
|
||||
}
|
||||
|
||||
rpc DeleteEntry (DeleteEntryRequest) returns (DeleteEntryResponse) {
|
||||
}
|
||||
|
||||
rpc AssignVolume (AssignVolumeRequest) returns (AssignVolumeResponse) {
|
||||
}
|
||||
|
||||
rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
|
||||
}
|
||||
|
||||
rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
|
||||
}
|
||||
|
||||
rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
message LookupDirectoryEntryRequest {
|
||||
string directory = 1;
|
||||
string name = 2;
|
||||
}
|
||||
|
||||
message LookupDirectoryEntryResponse {
|
||||
Entry entry = 1;
|
||||
}
|
||||
|
||||
message ListEntriesRequest {
|
||||
string directory = 1;
|
||||
string prefix = 2;
|
||||
string startFromFileName = 3;
|
||||
bool inclusiveStartFrom = 4;
|
||||
uint32 limit = 5;
|
||||
}
|
||||
|
||||
message ListEntriesResponse {
|
||||
repeated Entry entries = 1;
|
||||
}
|
||||
|
||||
message Entry {
|
||||
string name = 1;
|
||||
bool is_directory = 2;
|
||||
repeated FileChunk chunks = 3;
|
||||
FuseAttributes attributes = 4;
|
||||
map<string, bytes> extended = 5;
|
||||
}
|
||||
|
||||
message EventNotification {
|
||||
Entry old_entry = 1;
|
||||
Entry new_entry = 2;
|
||||
bool delete_chunks = 3;
|
||||
}
|
||||
|
||||
message FileChunk {
|
||||
string file_id = 1;
|
||||
int64 offset = 2;
|
||||
uint64 size = 3;
|
||||
int64 mtime = 4;
|
||||
string e_tag = 5;
|
||||
string source_file_id = 6;
|
||||
}
|
||||
|
||||
message FuseAttributes {
|
||||
uint64 file_size = 1;
|
||||
int64 mtime = 2; // unix time in seconds
|
||||
uint32 file_mode = 3;
|
||||
uint32 uid = 4;
|
||||
uint32 gid = 5;
|
||||
int64 crtime = 6; // unix time in seconds
|
||||
string mime = 7;
|
||||
string replication = 8;
|
||||
string collection = 9;
|
||||
int32 ttl_sec = 10;
|
||||
string user_name = 11; // for hdfs
|
||||
repeated string group_name = 12; // for hdfs
|
||||
string symlink_target = 13;
|
||||
}
|
||||
|
||||
message CreateEntryRequest {
|
||||
string directory = 1;
|
||||
Entry entry = 2;
|
||||
}
|
||||
|
||||
message CreateEntryResponse {
|
||||
}
|
||||
|
||||
message UpdateEntryRequest {
|
||||
string directory = 1;
|
||||
Entry entry = 2;
|
||||
}
|
||||
message UpdateEntryResponse {
|
||||
}
|
||||
|
||||
message DeleteEntryRequest {
|
||||
string directory = 1;
|
||||
string name = 2;
|
||||
// bool is_directory = 3;
|
||||
bool is_delete_data = 4;
|
||||
bool is_recursive = 5;
|
||||
}
|
||||
|
||||
message DeleteEntryResponse {
|
||||
}
|
||||
|
||||
message AssignVolumeRequest {
|
||||
int32 count = 1;
|
||||
string collection = 2;
|
||||
string replication = 3;
|
||||
int32 ttl_sec = 4;
|
||||
string data_center = 5;
|
||||
}
|
||||
|
||||
message AssignVolumeResponse {
|
||||
string file_id = 1;
|
||||
string url = 2;
|
||||
string public_url = 3;
|
||||
int32 count = 4;
|
||||
}
|
||||
|
||||
message LookupVolumeRequest {
|
||||
repeated string volume_ids = 1;
|
||||
}
|
||||
|
||||
message Locations {
|
||||
repeated Location locations = 1;
|
||||
}
|
||||
|
||||
message Location {
|
||||
string url = 1;
|
||||
string public_url = 2;
|
||||
}
|
||||
message LookupVolumeResponse {
|
||||
map<string, Locations> locations_map = 1;
|
||||
}
|
||||
|
||||
message DeleteCollectionRequest {
|
||||
string collection = 1;
|
||||
}
|
||||
|
||||
message DeleteCollectionResponse {
|
||||
}
|
||||
|
||||
message StatisticsRequest {
|
||||
string replication = 1;
|
||||
string collection = 2;
|
||||
string ttl = 3;
|
||||
}
|
||||
message StatisticsResponse {
|
||||
string replication = 1;
|
||||
string collection = 2;
|
||||
string ttl = 3;
|
||||
uint64 total_size = 4;
|
||||
uint64 used_size = 5;
|
||||
uint64 file_count = 6;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package seaweedfs.client;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SeaweedReadTest {
|
||||
|
||||
@Test
|
||||
public void testNonOverlappingVisibleIntervals() {
|
||||
List<FilerProto.FileChunk> chunks = new ArrayList<>();
|
||||
chunks.add(FilerProto.FileChunk.newBuilder()
|
||||
.setFileId("aaa")
|
||||
.setOffset(0)
|
||||
.setSize(100)
|
||||
.setMtime(1000)
|
||||
.build());
|
||||
chunks.add(FilerProto.FileChunk.newBuilder()
|
||||
.setFileId("bbb")
|
||||
.setOffset(100)
|
||||
.setSize(133)
|
||||
.setMtime(2000)
|
||||
.build());
|
||||
|
||||
List<SeaweedRead.VisibleInterval> visibleIntervals = SeaweedRead.nonOverlappingVisibleIntervals(chunks);
|
||||
for (SeaweedRead.VisibleInterval visibleInterval : visibleIntervals) {
|
||||
System.out.println("visible:" + visibleInterval);
|
||||
}
|
||||
|
||||
Assert.assertEquals(visibleIntervals.size(), 2);
|
||||
|
||||
SeaweedRead.VisibleInterval visibleInterval = visibleIntervals.get(0);
|
||||
Assert.assertEquals(visibleInterval.start, 0);
|
||||
Assert.assertEquals(visibleInterval.stop, 100);
|
||||
Assert.assertEquals(visibleInterval.modifiedTime, 1000);
|
||||
Assert.assertEquals(visibleInterval.fileId, "aaa");
|
||||
|
||||
visibleInterval = visibleIntervals.get(1);
|
||||
Assert.assertEquals(visibleInterval.start, 100);
|
||||
Assert.assertEquals(visibleInterval.stop, 233);
|
||||
Assert.assertEquals(visibleInterval.modifiedTime, 2000);
|
||||
Assert.assertEquals(visibleInterval.fileId, "bbb");
|
||||
|
||||
List<SeaweedRead.ChunkView> chunkViews = SeaweedRead.viewFromVisibles(visibleIntervals, 0, 233);
|
||||
|
||||
SeaweedRead.ChunkView chunkView = chunkViews.get(0);
|
||||
Assert.assertEquals(chunkView.offset, 0);
|
||||
Assert.assertEquals(chunkView.size, 100);
|
||||
Assert.assertEquals(chunkView.logicOffset, 0);
|
||||
Assert.assertEquals(chunkView.fileId, "aaa");
|
||||
|
||||
chunkView = chunkViews.get(1);
|
||||
Assert.assertEquals(chunkView.offset, 0);
|
||||
Assert.assertEquals(chunkView.size, 133);
|
||||
Assert.assertEquals(chunkView.logicOffset, 100);
|
||||
Assert.assertEquals(chunkView.fileId, "bbb");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.0.5</seaweedfs.client.version>
|
||||
<hadoop.version>3.1.1</hadoop.version>
|
||||
</properties>
|
||||
|
||||
<groupId>com.github.chrislusf</groupId>
|
||||
<artifactId>seaweedfs-hadoop-client</artifactId>
|
||||
<version>${seaweedfs.client.version}</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>9</version>
|
||||
</parent>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>7</source>
|
||||
<target>7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
<exclude>org/slf4j/**</exclude>
|
||||
<exclude>META-INF/maven/org.slf4j/**</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<transformers>
|
||||
<transformer
|
||||
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
||||
</transformers>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.google</pattern>
|
||||
<shadedPattern>shaded.com.google</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>io.grpc.internal</pattern>
|
||||
<shadedPattern>shaded.io.grpc.internal</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.apache.commons</pattern>
|
||||
<shadedPattern>shaded.org.apache.commons</shadedPattern>
|
||||
<excludes>
|
||||
<exclude>org.apache.hadoop</exclude>
|
||||
<exclude>org.apache.log4j</exclude>
|
||||
</excludes>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-client</artifactId>
|
||||
<version>${hadoop.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.chrislusf</groupId>
|
||||
<artifactId>seaweedfs-client</artifactId>
|
||||
<version>${seaweedfs.client.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-common</artifactId>
|
||||
<version>${hadoop.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package seaweed.hdfs;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
class ReadBuffer {
|
||||
|
||||
private SeaweedInputStream stream;
|
||||
private long offset; // offset within the file for the buffer
|
||||
private int length; // actual length, set after the buffer is filles
|
||||
private int requestedLength; // requested length of the read
|
||||
private byte[] buffer; // the buffer itself
|
||||
private int bufferindex = -1; // index in the buffers array in Buffer manager
|
||||
private ReadBufferStatus status; // status of the buffer
|
||||
private CountDownLatch latch = null; // signaled when the buffer is done reading, so any client
|
||||
// waiting on this buffer gets unblocked
|
||||
|
||||
// fields to help with eviction logic
|
||||
private long timeStamp = 0; // tick at which buffer became available to read
|
||||
private boolean isFirstByteConsumed = false;
|
||||
private boolean isLastByteConsumed = false;
|
||||
private boolean isAnyByteConsumed = false;
|
||||
|
||||
public SeaweedInputStream getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public void setStream(SeaweedInputStream stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
public long getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(long offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(int length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public int getRequestedLength() {
|
||||
return requestedLength;
|
||||
}
|
||||
|
||||
public void setRequestedLength(int requestedLength) {
|
||||
this.requestedLength = requestedLength;
|
||||
}
|
||||
|
||||
public byte[] getBuffer() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public void setBuffer(byte[] buffer) {
|
||||
this.buffer = buffer;
|
||||
}
|
||||
|
||||
public int getBufferindex() {
|
||||
return bufferindex;
|
||||
}
|
||||
|
||||
public void setBufferindex(int bufferindex) {
|
||||
this.bufferindex = bufferindex;
|
||||
}
|
||||
|
||||
public ReadBufferStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(ReadBufferStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public CountDownLatch getLatch() {
|
||||
return latch;
|
||||
}
|
||||
|
||||
public void setLatch(CountDownLatch latch) {
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public long getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public void setTimeStamp(long timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
public boolean isFirstByteConsumed() {
|
||||
return isFirstByteConsumed;
|
||||
}
|
||||
|
||||
public void setFirstByteConsumed(boolean isFirstByteConsumed) {
|
||||
this.isFirstByteConsumed = isFirstByteConsumed;
|
||||
}
|
||||
|
||||
public boolean isLastByteConsumed() {
|
||||
return isLastByteConsumed;
|
||||
}
|
||||
|
||||
public void setLastByteConsumed(boolean isLastByteConsumed) {
|
||||
this.isLastByteConsumed = isLastByteConsumed;
|
||||
}
|
||||
|
||||
public boolean isAnyByteConsumed() {
|
||||
return isAnyByteConsumed;
|
||||
}
|
||||
|
||||
public void setAnyByteConsumed(boolean isAnyByteConsumed) {
|
||||
this.isAnyByteConsumed = isAnyByteConsumed;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,394 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package seaweed.hdfs;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/**
|
||||
* The Read Buffer Manager for Rest AbfsClient.
|
||||
*/
|
||||
final class ReadBufferManager {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ReadBufferManager.class);
|
||||
|
||||
private static final int NUM_BUFFERS = 16;
|
||||
private static final int BLOCK_SIZE = 4 * 1024 * 1024;
|
||||
private static final int NUM_THREADS = 8;
|
||||
private static final int THRESHOLD_AGE_MILLISECONDS = 3000; // have to see if 3 seconds is a good threshold
|
||||
|
||||
private Thread[] threads = new Thread[NUM_THREADS];
|
||||
private byte[][] buffers; // array of byte[] buffers, to hold the data that is read
|
||||
private Stack<Integer> freeList = new Stack<>(); // indices in buffers[] array that are available
|
||||
|
||||
private Queue<ReadBuffer> readAheadQueue = new LinkedList<>(); // queue of requests that are not picked up by any worker thread yet
|
||||
private LinkedList<ReadBuffer> inProgressList = new LinkedList<>(); // requests being processed by worker threads
|
||||
private LinkedList<ReadBuffer> completedReadList = new LinkedList<>(); // buffers available for reading
|
||||
private static final ReadBufferManager BUFFER_MANAGER; // singleton, initialized in static initialization block
|
||||
|
||||
static {
|
||||
BUFFER_MANAGER = new ReadBufferManager();
|
||||
BUFFER_MANAGER.init();
|
||||
}
|
||||
|
||||
static ReadBufferManager getBufferManager() {
|
||||
return BUFFER_MANAGER;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
buffers = new byte[NUM_BUFFERS][];
|
||||
for (int i = 0; i < NUM_BUFFERS; i++) {
|
||||
buffers[i] = new byte[BLOCK_SIZE]; // same buffers are reused. The byte array never goes back to GC
|
||||
freeList.add(i);
|
||||
}
|
||||
for (int i = 0; i < NUM_THREADS; i++) {
|
||||
Thread t = new Thread(new ReadBufferWorker(i));
|
||||
t.setDaemon(true);
|
||||
threads[i] = t;
|
||||
t.setName("SeaweedFS-prefetch-" + i);
|
||||
t.start();
|
||||
}
|
||||
ReadBufferWorker.UNLEASH_WORKERS.countDown();
|
||||
}
|
||||
|
||||
// hide instance constructor
|
||||
private ReadBufferManager() {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* SeaweedInputStream-facing methods
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* {@link SeaweedInputStream} calls this method to queue read-aheads.
|
||||
*
|
||||
* @param stream The {@link SeaweedInputStream} for which to do the read-ahead
|
||||
* @param requestedOffset The offset in the file which shoukd be read
|
||||
* @param requestedLength The length to read
|
||||
*/
|
||||
void queueReadAhead(final SeaweedInputStream stream, final long requestedOffset, final int requestedLength) {
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("Start Queueing readAhead for {} offset {} length {}",
|
||||
stream.getPath(), requestedOffset, requestedLength);
|
||||
}
|
||||
ReadBuffer buffer;
|
||||
synchronized (this) {
|
||||
if (isAlreadyQueued(stream, requestedOffset)) {
|
||||
return; // already queued, do not queue again
|
||||
}
|
||||
if (freeList.isEmpty() && !tryEvict()) {
|
||||
return; // no buffers available, cannot queue anything
|
||||
}
|
||||
|
||||
buffer = new ReadBuffer();
|
||||
buffer.setStream(stream);
|
||||
buffer.setOffset(requestedOffset);
|
||||
buffer.setLength(0);
|
||||
buffer.setRequestedLength(requestedLength);
|
||||
buffer.setStatus(ReadBufferStatus.NOT_AVAILABLE);
|
||||
buffer.setLatch(new CountDownLatch(1));
|
||||
|
||||
Integer bufferIndex = freeList.pop(); // will return a value, since we have checked size > 0 already
|
||||
|
||||
buffer.setBuffer(buffers[bufferIndex]);
|
||||
buffer.setBufferindex(bufferIndex);
|
||||
readAheadQueue.add(buffer);
|
||||
notifyAll();
|
||||
}
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("Done q-ing readAhead for file {} offset {} buffer idx {}",
|
||||
stream.getPath(), requestedOffset, buffer.getBufferindex());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@link SeaweedInputStream} calls this method read any bytes already available in a buffer (thereby saving a
|
||||
* remote read). This returns the bytes if the data already exists in buffer. If there is a buffer that is reading
|
||||
* the requested offset, then this method blocks until that read completes. If the data is queued in a read-ahead
|
||||
* but not picked up by a worker thread yet, then it cancels that read-ahead and reports cache miss. This is because
|
||||
* depending on worker thread availability, the read-ahead may take a while - the calling thread can do it's own
|
||||
* read to get the data faster (copmared to the read waiting in queue for an indeterminate amount of time).
|
||||
*
|
||||
* @param stream the file to read bytes for
|
||||
* @param position the offset in the file to do a read for
|
||||
* @param length the length to read
|
||||
* @param buffer the buffer to read data into. Note that the buffer will be written into from offset 0.
|
||||
* @return the number of bytes read
|
||||
*/
|
||||
int getBlock(final SeaweedInputStream stream, final long position, final int length, final byte[] buffer) {
|
||||
// not synchronized, so have to be careful with locking
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("getBlock for file {} position {} thread {}",
|
||||
stream.getPath(), position, Thread.currentThread().getName());
|
||||
}
|
||||
|
||||
waitForProcess(stream, position);
|
||||
|
||||
int bytesRead = 0;
|
||||
synchronized (this) {
|
||||
bytesRead = getBlockFromCompletedQueue(stream, position, length, buffer);
|
||||
}
|
||||
if (bytesRead > 0) {
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("Done read from Cache for {} position {} length {}",
|
||||
stream.getPath(), position, bytesRead);
|
||||
}
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
// otherwise, just say we got nothing - calling thread can do its own read
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Internal methods
|
||||
*
|
||||
*/
|
||||
|
||||
private void waitForProcess(final SeaweedInputStream stream, final long position) {
|
||||
ReadBuffer readBuf;
|
||||
synchronized (this) {
|
||||
clearFromReadAheadQueue(stream, position);
|
||||
readBuf = getFromList(inProgressList, stream, position);
|
||||
}
|
||||
if (readBuf != null) { // if in in-progress queue, then block for it
|
||||
try {
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("got a relevant read buffer for file {} offset {} buffer idx {}",
|
||||
stream.getPath(), readBuf.getOffset(), readBuf.getBufferindex());
|
||||
}
|
||||
readBuf.getLatch().await(); // blocking wait on the caller stream's thread
|
||||
// Note on correctness: readBuf gets out of inProgressList only in 1 place: after worker thread
|
||||
// is done processing it (in doneReading). There, the latch is set after removing the buffer from
|
||||
// inProgressList. So this latch is safe to be outside the synchronized block.
|
||||
// Putting it in synchronized would result in a deadlock, since this thread would be holding the lock
|
||||
// while waiting, so no one will be able to change any state. If this becomes more complex in the future,
|
||||
// then the latch cane be removed and replaced with wait/notify whenever inProgressList is touched.
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("latch done for file {} buffer idx {} length {}",
|
||||
stream.getPath(), readBuf.getBufferindex(), readBuf.getLength());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If any buffer in the completedlist can be reclaimed then reclaim it and return the buffer to free list.
|
||||
* The objective is to find just one buffer - there is no advantage to evicting more than one.
|
||||
*
|
||||
* @return whether the eviction succeeeded - i.e., were we able to free up one buffer
|
||||
*/
|
||||
private synchronized boolean tryEvict() {
|
||||
ReadBuffer nodeToEvict = null;
|
||||
if (completedReadList.size() <= 0) {
|
||||
return false; // there are no evict-able buffers
|
||||
}
|
||||
|
||||
// first, try buffers where all bytes have been consumed (approximated as first and last bytes consumed)
|
||||
for (ReadBuffer buf : completedReadList) {
|
||||
if (buf.isFirstByteConsumed() && buf.isLastByteConsumed()) {
|
||||
nodeToEvict = buf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nodeToEvict != null) {
|
||||
return evict(nodeToEvict);
|
||||
}
|
||||
|
||||
// next, try buffers where any bytes have been consumed (may be a bad idea? have to experiment and see)
|
||||
for (ReadBuffer buf : completedReadList) {
|
||||
if (buf.isAnyByteConsumed()) {
|
||||
nodeToEvict = buf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeToEvict != null) {
|
||||
return evict(nodeToEvict);
|
||||
}
|
||||
|
||||
// next, try any old nodes that have not been consumed
|
||||
long earliestBirthday = Long.MAX_VALUE;
|
||||
for (ReadBuffer buf : completedReadList) {
|
||||
if (buf.getTimeStamp() < earliestBirthday) {
|
||||
nodeToEvict = buf;
|
||||
earliestBirthday = buf.getTimeStamp();
|
||||
}
|
||||
}
|
||||
if ((currentTimeMillis() - earliestBirthday > THRESHOLD_AGE_MILLISECONDS) && (nodeToEvict != null)) {
|
||||
return evict(nodeToEvict);
|
||||
}
|
||||
|
||||
// nothing can be evicted
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean evict(final ReadBuffer buf) {
|
||||
freeList.push(buf.getBufferindex());
|
||||
completedReadList.remove(buf);
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("Evicting buffer idx {}; was used for file {} offset {} length {}",
|
||||
buf.getBufferindex(), buf.getStream().getPath(), buf.getOffset(), buf.getLength());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isAlreadyQueued(final SeaweedInputStream stream, final long requestedOffset) {
|
||||
// returns true if any part of the buffer is already queued
|
||||
return (isInList(readAheadQueue, stream, requestedOffset)
|
||||
|| isInList(inProgressList, stream, requestedOffset)
|
||||
|| isInList(completedReadList, stream, requestedOffset));
|
||||
}
|
||||
|
||||
private boolean isInList(final Collection<ReadBuffer> list, final SeaweedInputStream stream, final long requestedOffset) {
|
||||
return (getFromList(list, stream, requestedOffset) != null);
|
||||
}
|
||||
|
||||
private ReadBuffer getFromList(final Collection<ReadBuffer> list, final SeaweedInputStream stream, final long requestedOffset) {
|
||||
for (ReadBuffer buffer : list) {
|
||||
if (buffer.getStream() == stream) {
|
||||
if (buffer.getStatus() == ReadBufferStatus.AVAILABLE
|
||||
&& requestedOffset >= buffer.getOffset()
|
||||
&& requestedOffset < buffer.getOffset() + buffer.getLength()) {
|
||||
return buffer;
|
||||
} else if (requestedOffset >= buffer.getOffset()
|
||||
&& requestedOffset < buffer.getOffset() + buffer.getRequestedLength()) {
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void clearFromReadAheadQueue(final SeaweedInputStream stream, final long requestedOffset) {
|
||||
ReadBuffer buffer = getFromList(readAheadQueue, stream, requestedOffset);
|
||||
if (buffer != null) {
|
||||
readAheadQueue.remove(buffer);
|
||||
notifyAll(); // lock is held in calling method
|
||||
freeList.push(buffer.getBufferindex());
|
||||
}
|
||||
}
|
||||
|
||||
private int getBlockFromCompletedQueue(final SeaweedInputStream stream, final long position, final int length,
|
||||
final byte[] buffer) {
|
||||
ReadBuffer buf = getFromList(completedReadList, stream, position);
|
||||
if (buf == null || position >= buf.getOffset() + buf.getLength()) {
|
||||
return 0;
|
||||
}
|
||||
int cursor = (int) (position - buf.getOffset());
|
||||
int availableLengthInBuffer = buf.getLength() - cursor;
|
||||
int lengthToCopy = Math.min(length, availableLengthInBuffer);
|
||||
System.arraycopy(buf.getBuffer(), cursor, buffer, 0, lengthToCopy);
|
||||
if (cursor == 0) {
|
||||
buf.setFirstByteConsumed(true);
|
||||
}
|
||||
if (cursor + lengthToCopy == buf.getLength()) {
|
||||
buf.setLastByteConsumed(true);
|
||||
}
|
||||
buf.setAnyByteConsumed(true);
|
||||
return lengthToCopy;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* ReadBufferWorker-thread-facing methods
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* ReadBufferWorker thread calls this to get the next buffer that it should work on.
|
||||
*
|
||||
* @return {@link ReadBuffer}
|
||||
* @throws InterruptedException if thread is interrupted
|
||||
*/
|
||||
ReadBuffer getNextBlockToRead() throws InterruptedException {
|
||||
ReadBuffer buffer = null;
|
||||
synchronized (this) {
|
||||
//buffer = readAheadQueue.take(); // blocking method
|
||||
while (readAheadQueue.size() == 0) {
|
||||
wait();
|
||||
}
|
||||
buffer = readAheadQueue.remove();
|
||||
notifyAll();
|
||||
if (buffer == null) {
|
||||
return null; // should never happen
|
||||
}
|
||||
buffer.setStatus(ReadBufferStatus.READING_IN_PROGRESS);
|
||||
inProgressList.add(buffer);
|
||||
}
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("ReadBufferWorker picked file {} for offset {}",
|
||||
buffer.getStream().getPath(), buffer.getOffset());
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* ReadBufferWorker thread calls this method to post completion.
|
||||
*
|
||||
* @param buffer the buffer whose read was completed
|
||||
* @param result the {@link ReadBufferStatus} after the read operation in the worker thread
|
||||
* @param bytesActuallyRead the number of bytes that the worker thread was actually able to read
|
||||
*/
|
||||
void doneReading(final ReadBuffer buffer, final ReadBufferStatus result, final int bytesActuallyRead) {
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("ReadBufferWorker completed file {} for offset {} bytes {}",
|
||||
buffer.getStream().getPath(), buffer.getOffset(), bytesActuallyRead);
|
||||
}
|
||||
synchronized (this) {
|
||||
inProgressList.remove(buffer);
|
||||
if (result == ReadBufferStatus.AVAILABLE && bytesActuallyRead > 0) {
|
||||
buffer.setStatus(ReadBufferStatus.AVAILABLE);
|
||||
buffer.setTimeStamp(currentTimeMillis());
|
||||
buffer.setLength(bytesActuallyRead);
|
||||
completedReadList.add(buffer);
|
||||
} else {
|
||||
freeList.push(buffer.getBufferindex());
|
||||
// buffer should go out of scope after the end of the calling method in ReadBufferWorker, and eligible for GC
|
||||
}
|
||||
}
|
||||
//outside the synchronized, since anyone receiving a wake-up from the latch must see safe-published results
|
||||
buffer.getLatch().countDown(); // wake up waiting threads (if any)
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to System.currentTimeMillis, except implemented with System.nanoTime().
|
||||
* System.currentTimeMillis can go backwards when system clock is changed (e.g., with NTP time synchronization),
|
||||
* making it unsuitable for measuring time intervals. nanotime is strictly monotonically increasing per CPU core.
|
||||
* Note: it is not monotonic across Sockets, and even within a CPU, its only the
|
||||
* more recent parts which share a clock across all cores.
|
||||
*
|
||||
* @return current time in milliseconds
|
||||
*/
|
||||
private long currentTimeMillis() {
|
||||
return System.nanoTime() / 1000 / 1000;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package seaweed.hdfs;
|
||||
|
||||
/**
|
||||
* The ReadBufferStatus for Rest AbfsClient
|
||||
*/
|
||||
public enum ReadBufferStatus {
|
||||
NOT_AVAILABLE, // buffers sitting in readaheadqueue have this stats
|
||||
READING_IN_PROGRESS, // reading is in progress on this buffer. Buffer should be in inProgressList
|
||||
AVAILABLE, // data is available in buffer. It should be in completedList
|
||||
READ_FAILED // read completed, but failed.
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package seaweed.hdfs;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
class ReadBufferWorker implements Runnable {
|
||||
|
||||
protected static final CountDownLatch UNLEASH_WORKERS = new CountDownLatch(1);
|
||||
private int id;
|
||||
|
||||
ReadBufferWorker(final int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the ID of ReadBufferWorker.
|
||||
*/
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits until a buffer becomes available in ReadAheadQueue.
|
||||
* Once a buffer becomes available, reads the file specified in it and then posts results back to buffer manager.
|
||||
* Rinse and repeat. Forever.
|
||||
*/
|
||||
public void run() {
|
||||
try {
|
||||
UNLEASH_WORKERS.await();
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
ReadBufferManager bufferManager = ReadBufferManager.getBufferManager();
|
||||
ReadBuffer buffer;
|
||||
while (true) {
|
||||
try {
|
||||
buffer = bufferManager.getNextBlockToRead(); // blocks, until a buffer is available for this thread
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
if (buffer != null) {
|
||||
try {
|
||||
// do the actual read, from the file.
|
||||
int bytesRead = buffer.getStream().readRemote(buffer.getOffset(), buffer.getBuffer(), 0, buffer.getRequestedLength());
|
||||
bufferManager.doneReading(buffer, ReadBufferStatus.AVAILABLE, bytesRead); // post result back to ReadBufferManager
|
||||
} catch (Exception ex) {
|
||||
bufferManager.doneReading(buffer, ReadBufferStatus.READ_FAILED, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,594 @@
|
||||
package seaweed.hdfs;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FSDataInputStream;
|
||||
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||
import org.apache.hadoop.fs.FileAlreadyExistsException;
|
||||
import org.apache.hadoop.fs.FileStatus;
|
||||
import org.apache.hadoop.fs.ParentNotDirectoryException;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.fs.UnsupportedFileSystemException;
|
||||
import org.apache.hadoop.fs.XAttrSetFlag;
|
||||
import org.apache.hadoop.fs.permission.AclEntry;
|
||||
import org.apache.hadoop.fs.permission.AclStatus;
|
||||
import org.apache.hadoop.fs.permission.FsPermission;
|
||||
import org.apache.hadoop.security.AccessControlException;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.util.Progressable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URI;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY;
|
||||
|
||||
public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem {
|
||||
|
||||
public static final int FS_SEAWEED_DEFAULT_PORT = 8888;
|
||||
public static final String FS_SEAWEED_FILER_HOST = "fs.seaweed.filer.host";
|
||||
public static final String FS_SEAWEED_FILER_PORT = "fs.seaweed.filer.port";
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SeaweedFileSystem.class);
|
||||
private static int BUFFER_SIZE = 16 * 1024 * 1024;
|
||||
|
||||
private URI uri;
|
||||
private Path workingDirectory = new Path("/");
|
||||
private SeaweedFileSystemStore seaweedFileSystemStore;
|
||||
|
||||
public URI getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
return "seaweedfs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URI uri, Configuration conf) throws IOException { // get
|
||||
super.initialize(uri, conf);
|
||||
|
||||
// get host information from uri (overrides info in conf)
|
||||
String host = uri.getHost();
|
||||
host = (host == null) ? conf.get(FS_SEAWEED_FILER_HOST, "localhost") : host;
|
||||
if (host == null) {
|
||||
throw new IOException("Invalid host specified");
|
||||
}
|
||||
conf.set(FS_SEAWEED_FILER_HOST, host);
|
||||
|
||||
// get port information from uri, (overrides info in conf)
|
||||
int port = uri.getPort();
|
||||
port = (port == -1) ? FS_SEAWEED_DEFAULT_PORT : port;
|
||||
conf.setInt(FS_SEAWEED_FILER_PORT, port);
|
||||
|
||||
conf.setInt(IO_FILE_BUFFER_SIZE_KEY, BUFFER_SIZE);
|
||||
|
||||
setConf(conf);
|
||||
this.uri = uri;
|
||||
|
||||
seaweedFileSystemStore = new SeaweedFileSystemStore(host, port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FSDataInputStream open(Path path, int bufferSize) throws IOException {
|
||||
|
||||
LOG.debug("open path: {} bufferSize:{}", path, bufferSize);
|
||||
|
||||
path = qualify(path);
|
||||
|
||||
try {
|
||||
InputStream inputStream = seaweedFileSystemStore.openFileForRead(path, statistics, bufferSize);
|
||||
return new FSDataInputStream(inputStream);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FSDataOutputStream create(Path path, FsPermission permission, final boolean overwrite, final int bufferSize,
|
||||
final short replication, final long blockSize, final Progressable progress) throws IOException {
|
||||
|
||||
LOG.debug("create path: {} bufferSize:{} blockSize:{}", path, bufferSize, blockSize);
|
||||
|
||||
path = qualify(path);
|
||||
|
||||
try {
|
||||
String replicaPlacement = String.format("%03d", replication - 1);
|
||||
OutputStream outputStream = seaweedFileSystemStore.createFile(path, overwrite, permission, bufferSize, replicaPlacement);
|
||||
return new FSDataOutputStream(outputStream, statistics);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FSDataOutputStream append(Path path, int bufferSize, Progressable progressable) throws IOException {
|
||||
|
||||
LOG.debug("append path: {} bufferSize:{}", path, bufferSize);
|
||||
|
||||
path = qualify(path);
|
||||
try {
|
||||
OutputStream outputStream = seaweedFileSystemStore.createFile(path, false, null, bufferSize, "");
|
||||
return new FSDataOutputStream(outputStream, statistics);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rename(Path src, Path dst) {
|
||||
|
||||
LOG.debug("rename path: {} => {}", src, dst);
|
||||
|
||||
if (src.isRoot()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src.equals(dst)) {
|
||||
return true;
|
||||
}
|
||||
FileStatus dstFileStatus = getFileStatus(dst);
|
||||
|
||||
String sourceFileName = src.getName();
|
||||
Path adjustedDst = dst;
|
||||
|
||||
if (dstFileStatus != null) {
|
||||
if (!dstFileStatus.isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
adjustedDst = new Path(dst, sourceFileName);
|
||||
}
|
||||
|
||||
Path qualifiedSrcPath = qualify(src);
|
||||
Path qualifiedDstPath = qualify(adjustedDst);
|
||||
|
||||
seaweedFileSystemStore.rename(qualifiedSrcPath, qualifiedDstPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Path path, boolean recursive) {
|
||||
|
||||
LOG.debug("delete path: {} recursive:{}", path, recursive);
|
||||
|
||||
path = qualify(path);
|
||||
|
||||
FileStatus fileStatus = getFileStatus(path);
|
||||
|
||||
if (fileStatus == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return seaweedFileSystemStore.deleteEntries(path, fileStatus.isDirectory(), recursive);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileStatus[] listStatus(Path path) throws IOException {
|
||||
|
||||
LOG.debug("listStatus path: {}", path);
|
||||
|
||||
path = qualify(path);
|
||||
|
||||
return seaweedFileSystemStore.listEntries(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getWorkingDirectory() {
|
||||
return workingDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWorkingDirectory(Path path) {
|
||||
if (path.isAbsolute()) {
|
||||
workingDirectory = path;
|
||||
} else {
|
||||
workingDirectory = new Path(workingDirectory, path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mkdirs(Path path, FsPermission fsPermission) throws IOException {
|
||||
|
||||
LOG.debug("mkdirs path: {}", path);
|
||||
|
||||
path = qualify(path);
|
||||
|
||||
FileStatus fileStatus = getFileStatus(path);
|
||||
|
||||
if (fileStatus == null) {
|
||||
|
||||
UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
|
||||
return seaweedFileSystemStore.createDirectory(path, currentUser,
|
||||
fsPermission == null ? FsPermission.getDirDefault() : fsPermission,
|
||||
FsPermission.getUMask(getConf()));
|
||||
|
||||
}
|
||||
|
||||
if (fileStatus.isDirectory()) {
|
||||
return true;
|
||||
} else {
|
||||
throw new FileAlreadyExistsException("Path is a file: " + path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileStatus getFileStatus(Path path) {
|
||||
|
||||
LOG.debug("getFileStatus path: {}", path);
|
||||
|
||||
path = qualify(path);
|
||||
|
||||
return seaweedFileSystemStore.getFileStatus(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set owner of a path (i.e. a file or a directory).
|
||||
* The parameters owner and group cannot both be null.
|
||||
*
|
||||
* @param path The path
|
||||
* @param owner If it is null, the original username remains unchanged.
|
||||
* @param group If it is null, the original groupname remains unchanged.
|
||||
*/
|
||||
@Override
|
||||
public void setOwner(Path path, final String owner, final String group)
|
||||
throws IOException {
|
||||
LOG.debug("setOwner path: {}", path);
|
||||
path = qualify(path);
|
||||
|
||||
seaweedFileSystemStore.setOwner(path, owner, group);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set permission of a path.
|
||||
*
|
||||
* @param path The path
|
||||
* @param permission Access permission
|
||||
*/
|
||||
@Override
|
||||
public void setPermission(Path path, final FsPermission permission) throws IOException {
|
||||
LOG.debug("setPermission path: {}", path);
|
||||
|
||||
if (permission == null) {
|
||||
throw new IllegalArgumentException("The permission can't be null");
|
||||
}
|
||||
|
||||
path = qualify(path);
|
||||
|
||||
seaweedFileSystemStore.setPermission(path, permission);
|
||||
}
|
||||
|
||||
Path qualify(Path path) {
|
||||
return path.makeQualified(uri, workingDirectory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Concat existing files together.
|
||||
* @param trg the path to the target destination.
|
||||
* @param psrcs the paths to the sources to use for the concatenation.
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default).
|
||||
*/
|
||||
@Override
|
||||
public void concat(final Path trg, final Path [] psrcs) throws IOException {
|
||||
throw new UnsupportedOperationException("Not implemented by the " +
|
||||
getClass().getSimpleName() + " FileSystem implementation");
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncate the file in the indicated path to the indicated size.
|
||||
* <ul>
|
||||
* <li>Fails if path is a directory.</li>
|
||||
* <li>Fails if path does not exist.</li>
|
||||
* <li>Fails if path is not closed.</li>
|
||||
* <li>Fails if new size is greater than current size.</li>
|
||||
* </ul>
|
||||
* @param f The path to the file to be truncated
|
||||
* @param newLength The size the file is to be truncated to
|
||||
*
|
||||
* @return <code>true</code> if the file has been truncated to the desired
|
||||
* <code>newLength</code> and is immediately available to be reused for
|
||||
* write operations such as <code>append</code>, or
|
||||
* <code>false</code> if a background process of adjusting the length of
|
||||
* the last block has been started, and clients should wait for it to
|
||||
* complete before proceeding with further file updates.
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default).
|
||||
*/
|
||||
@Override
|
||||
public boolean truncate(Path f, long newLength) throws IOException {
|
||||
throw new UnsupportedOperationException("Not implemented by the " +
|
||||
getClass().getSimpleName() + " FileSystem implementation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createSymlink(final Path target, final Path link,
|
||||
final boolean createParent) throws AccessControlException,
|
||||
FileAlreadyExistsException, FileNotFoundException,
|
||||
ParentNotDirectoryException, UnsupportedFileSystemException,
|
||||
IOException {
|
||||
// Supporting filesystems should override this method
|
||||
throw new UnsupportedOperationException(
|
||||
"Filesystem does not support symlinks!");
|
||||
}
|
||||
|
||||
public boolean supportsSymlinks() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a snapshot.
|
||||
* @param path The directory where snapshots will be taken.
|
||||
* @param snapshotName The name of the snapshot
|
||||
* @return the snapshot path.
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
*/
|
||||
@Override
|
||||
public Path createSnapshot(Path path, String snapshotName)
|
||||
throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support createSnapshot");
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a snapshot.
|
||||
* @param path The directory path where the snapshot was taken
|
||||
* @param snapshotOldName Old name of the snapshot
|
||||
* @param snapshotNewName New name of the snapshot
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void renameSnapshot(Path path, String snapshotOldName,
|
||||
String snapshotNewName) throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support renameSnapshot");
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a snapshot of a directory.
|
||||
* @param path The directory that the to-be-deleted snapshot belongs to
|
||||
* @param snapshotName The name of the snapshot
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void deleteSnapshot(Path path, String snapshotName)
|
||||
throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support deleteSnapshot");
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies ACL entries of files and directories. This method can add new ACL
|
||||
* entries or modify the permissions on existing ACL entries. All existing
|
||||
* ACL entries that are not specified in this call are retained without
|
||||
* changes. (Modifications are merged into the current ACL.)
|
||||
*
|
||||
* @param path Path to modify
|
||||
* @param aclSpec List<AclEntry> describing modifications
|
||||
* @throws IOException if an ACL could not be modified
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void modifyAclEntries(Path path, List<AclEntry> aclSpec)
|
||||
throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support modifyAclEntries");
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes ACL entries from files and directories. Other ACL entries are
|
||||
* retained.
|
||||
*
|
||||
* @param path Path to modify
|
||||
* @param aclSpec List describing entries to remove
|
||||
* @throws IOException if an ACL could not be modified
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void removeAclEntries(Path path, List<AclEntry> aclSpec)
|
||||
throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support removeAclEntries");
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all default ACL entries from files and directories.
|
||||
*
|
||||
* @param path Path to modify
|
||||
* @throws IOException if an ACL could not be modified
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void removeDefaultAcl(Path path)
|
||||
throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support removeDefaultAcl");
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all but the base ACL entries of files and directories. The entries
|
||||
* for user, group, and others are retained for compatibility with permission
|
||||
* bits.
|
||||
*
|
||||
* @param path Path to modify
|
||||
* @throws IOException if an ACL could not be removed
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void removeAcl(Path path)
|
||||
throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support removeAcl");
|
||||
}
|
||||
|
||||
/**
|
||||
* Fully replaces ACL of files and directories, discarding all existing
|
||||
* entries.
|
||||
*
|
||||
* @param path Path to modify
|
||||
* @param aclSpec List describing modifications, which must include entries
|
||||
* for user, group, and others for compatibility with permission bits.
|
||||
* @throws IOException if an ACL could not be modified
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void setAcl(Path path, List<AclEntry> aclSpec) throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support setAcl");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ACL of a file or directory.
|
||||
*
|
||||
* @param path Path to get
|
||||
* @return AclStatus describing the ACL of the file or directory
|
||||
* @throws IOException if an ACL could not be read
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public AclStatus getAclStatus(Path path) throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support getAclStatus");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an xattr of a file or directory.
|
||||
* The name must be prefixed with the namespace followed by ".". For example,
|
||||
* "user.attr".
|
||||
* <p>
|
||||
* Refer to the HDFS extended attributes user documentation for details.
|
||||
*
|
||||
* @param path Path to modify
|
||||
* @param name xattr name.
|
||||
* @param value xattr value.
|
||||
* @param flag xattr set flag
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void setXAttr(Path path, String name, byte[] value,
|
||||
EnumSet<XAttrSetFlag> flag) throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support setXAttr");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an xattr name and value for a file or directory.
|
||||
* The name must be prefixed with the namespace followed by ".". For example,
|
||||
* "user.attr".
|
||||
* <p>
|
||||
* Refer to the HDFS extended attributes user documentation for details.
|
||||
*
|
||||
* @param path Path to get extended attribute
|
||||
* @param name xattr name.
|
||||
* @return byte[] xattr value.
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public byte[] getXAttr(Path path, String name) throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support getXAttr");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the xattr name/value pairs for a file or directory.
|
||||
* Only those xattrs which the logged-in user has permissions to view
|
||||
* are returned.
|
||||
* <p>
|
||||
* Refer to the HDFS extended attributes user documentation for details.
|
||||
*
|
||||
* @param path Path to get extended attributes
|
||||
* @return Map describing the XAttrs of the file or directory
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public Map<String, byte[]> getXAttrs(Path path) throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support getXAttrs");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the xattrs name/value pairs for a file or directory.
|
||||
* Only those xattrs which the logged-in user has permissions to view
|
||||
* are returned.
|
||||
* <p>
|
||||
* Refer to the HDFS extended attributes user documentation for details.
|
||||
*
|
||||
* @param path Path to get extended attributes
|
||||
* @param names XAttr names.
|
||||
* @return Map describing the XAttrs of the file or directory
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public Map<String, byte[]> getXAttrs(Path path, List<String> names)
|
||||
throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support getXAttrs");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the xattr names for a file or directory.
|
||||
* Only those xattr names which the logged-in user has permissions to view
|
||||
* are returned.
|
||||
* <p>
|
||||
* Refer to the HDFS extended attributes user documentation for details.
|
||||
*
|
||||
* @param path Path to get extended attributes
|
||||
* @return List{@literal <String>} of the XAttr names of the file or directory
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public List<String> listXAttrs(Path path) throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support listXAttrs");
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an xattr of a file or directory.
|
||||
* The name must be prefixed with the namespace followed by ".". For example,
|
||||
* "user.attr".
|
||||
* <p>
|
||||
* Refer to the HDFS extended attributes user documentation for details.
|
||||
*
|
||||
* @param path Path to remove extended attribute
|
||||
* @param name xattr name
|
||||
* @throws IOException IO failure
|
||||
* @throws UnsupportedOperationException if the operation is unsupported
|
||||
* (default outcome).
|
||||
*/
|
||||
@Override
|
||||
public void removeXAttr(Path path, String name) throws IOException {
|
||||
throw new UnsupportedOperationException(getClass().getSimpleName()
|
||||
+ " doesn't support removeXAttr");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
package seaweed.hdfs;
|
||||
|
||||
import org.apache.hadoop.fs.FileStatus;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.fs.permission.FsPermission;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import seaweedfs.client.FilerClient;
|
||||
import seaweedfs.client.FilerGrpcClient;
|
||||
import seaweedfs.client.FilerProto;
|
||||
import seaweedfs.client.SeaweedRead;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class SeaweedFileSystemStore {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SeaweedFileSystemStore.class);
|
||||
|
||||
private FilerGrpcClient filerGrpcClient;
|
||||
private FilerClient filerClient;
|
||||
|
||||
public SeaweedFileSystemStore(String host, int port) {
|
||||
int grpcPort = 10000 + port;
|
||||
filerGrpcClient = new FilerGrpcClient(host, grpcPort);
|
||||
filerClient = new FilerClient(filerGrpcClient);
|
||||
}
|
||||
|
||||
public static String getParentDirectory(Path path) {
|
||||
return path.isRoot() ? "/" : path.getParent().toUri().getPath();
|
||||
}
|
||||
|
||||
static int permissionToMode(FsPermission permission, boolean isDirectory) {
|
||||
int p = permission.toShort();
|
||||
if (isDirectory) {
|
||||
p = p | 1 << 31;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
public boolean createDirectory(final Path path, UserGroupInformation currentUser,
|
||||
final FsPermission permission, final FsPermission umask) {
|
||||
|
||||
LOG.debug("createDirectory path: {} permission: {} umask: {}",
|
||||
path,
|
||||
permission,
|
||||
umask);
|
||||
|
||||
return filerClient.mkdirs(
|
||||
path.toUri().getPath(),
|
||||
permissionToMode(permission, true),
|
||||
currentUser.getUserName(),
|
||||
currentUser.getGroupNames()
|
||||
);
|
||||
}
|
||||
|
||||
public FileStatus[] listEntries(final Path path) {
|
||||
LOG.debug("listEntries path: {}", path);
|
||||
|
||||
List<FileStatus> fileStatuses = new ArrayList<FileStatus>();
|
||||
|
||||
List<FilerProto.Entry> entries = filerClient.listEntries(path.toUri().getPath());
|
||||
|
||||
for (FilerProto.Entry entry : entries) {
|
||||
|
||||
FileStatus fileStatus = doGetFileStatus(new Path(path, entry.getName()), entry);
|
||||
|
||||
fileStatuses.add(fileStatus);
|
||||
}
|
||||
return fileStatuses.toArray(new FileStatus[0]);
|
||||
}
|
||||
|
||||
public FileStatus getFileStatus(final Path path) {
|
||||
|
||||
FilerProto.Entry entry = lookupEntry(path);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
LOG.debug("doGetFileStatus path:{} entry:{}", path, entry);
|
||||
|
||||
FileStatus fileStatus = doGetFileStatus(path, entry);
|
||||
return fileStatus;
|
||||
}
|
||||
|
||||
public boolean deleteEntries(final Path path, boolean isDirectory, boolean recursive) {
|
||||
LOG.debug("deleteEntries path: {} isDirectory {} recursive: {}",
|
||||
path,
|
||||
String.valueOf(isDirectory),
|
||||
String.valueOf(recursive));
|
||||
|
||||
if (path.isRoot()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (recursive && isDirectory) {
|
||||
List<FilerProto.Entry> entries = filerClient.listEntries(path.toUri().getPath());
|
||||
for (FilerProto.Entry entry : entries) {
|
||||
deleteEntries(new Path(path, entry.getName()), entry.getIsDirectory(), true);
|
||||
}
|
||||
}
|
||||
|
||||
return filerClient.deleteEntry(getParentDirectory(path), path.getName(), true, recursive);
|
||||
}
|
||||
|
||||
private FileStatus doGetFileStatus(Path path, FilerProto.Entry entry) {
|
||||
FilerProto.FuseAttributes attributes = entry.getAttributes();
|
||||
long length = SeaweedRead.totalSize(entry.getChunksList());
|
||||
boolean isDir = entry.getIsDirectory();
|
||||
int block_replication = 1;
|
||||
int blocksize = 512;
|
||||
long modification_time = attributes.getMtime() * 1000; // milliseconds
|
||||
long access_time = 0;
|
||||
FsPermission permission = FsPermission.createImmutable((short) attributes.getFileMode());
|
||||
String owner = attributes.getUserName();
|
||||
String group = attributes.getGroupNameCount() > 0 ? attributes.getGroupName(0) : "";
|
||||
return new FileStatus(length, isDir, block_replication, blocksize,
|
||||
modification_time, access_time, permission, owner, group, null, path);
|
||||
}
|
||||
|
||||
private FilerProto.Entry lookupEntry(Path path) {
|
||||
|
||||
return filerClient.lookupEntry(getParentDirectory(path), path.getName());
|
||||
|
||||
}
|
||||
|
||||
public void rename(Path source, Path destination) {
|
||||
|
||||
LOG.debug("rename source: {} destination:{}", source, destination);
|
||||
|
||||
if (source.isRoot()) {
|
||||
return;
|
||||
}
|
||||
LOG.warn("rename lookupEntry source: {}", source);
|
||||
FilerProto.Entry entry = lookupEntry(source);
|
||||
if (entry == null) {
|
||||
LOG.warn("rename non-existing source: {}", source);
|
||||
return;
|
||||
}
|
||||
LOG.warn("rename moveEntry source: {}", source);
|
||||
moveEntry(source.getParent(), entry, destination);
|
||||
}
|
||||
|
||||
private boolean moveEntry(Path oldParent, FilerProto.Entry entry, Path destination) {
|
||||
|
||||
LOG.debug("moveEntry: {}/{} => {}", oldParent, entry.getName(), destination);
|
||||
|
||||
FilerProto.Entry.Builder newEntry = entry.toBuilder().setName(destination.getName());
|
||||
boolean isDirectoryCreated = filerClient.createEntry(getParentDirectory(destination), newEntry.build());
|
||||
|
||||
if (!isDirectoryCreated) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entry.getIsDirectory()) {
|
||||
Path entryPath = new Path(oldParent, entry.getName());
|
||||
List<FilerProto.Entry> entries = filerClient.listEntries(entryPath.toUri().getPath());
|
||||
for (FilerProto.Entry ent : entries) {
|
||||
boolean isSucess = moveEntry(entryPath, ent, new Path(destination, ent.getName()));
|
||||
if (!isSucess) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filerClient.deleteEntry(
|
||||
oldParent.toUri().getPath(), entry.getName(), false, false);
|
||||
|
||||
}
|
||||
|
||||
public OutputStream createFile(final Path path,
|
||||
final boolean overwrite,
|
||||
FsPermission permission,
|
||||
int bufferSize,
|
||||
String replication) throws IOException {
|
||||
|
||||
permission = permission == null ? FsPermission.getFileDefault() : permission;
|
||||
|
||||
LOG.debug("createFile path: {} overwrite: {} permission: {}",
|
||||
path,
|
||||
overwrite,
|
||||
permission.toString());
|
||||
|
||||
UserGroupInformation userGroupInformation = UserGroupInformation.getCurrentUser();
|
||||
long now = System.currentTimeMillis() / 1000L;
|
||||
|
||||
FilerProto.Entry.Builder entry = null;
|
||||
long writePosition = 0;
|
||||
if (!overwrite) {
|
||||
FilerProto.Entry existingEntry = lookupEntry(path);
|
||||
LOG.debug("createFile merged entry path:{} existingEntry:{}", path, existingEntry);
|
||||
if (existingEntry != null) {
|
||||
entry = FilerProto.Entry.newBuilder();
|
||||
entry.mergeFrom(existingEntry);
|
||||
entry.getAttributesBuilder().setMtime(now);
|
||||
}
|
||||
LOG.debug("createFile merged entry path:{} entry:{} from:{}", path, entry, existingEntry);
|
||||
writePosition = SeaweedRead.totalSize(existingEntry.getChunksList());
|
||||
replication = existingEntry.getAttributes().getReplication();
|
||||
}
|
||||
if (entry == null) {
|
||||
entry = FilerProto.Entry.newBuilder()
|
||||
.setName(path.getName())
|
||||
.setIsDirectory(false)
|
||||
.setAttributes(FilerProto.FuseAttributes.newBuilder()
|
||||
.setFileMode(permissionToMode(permission, false))
|
||||
.setReplication(replication)
|
||||
.setCrtime(now)
|
||||
.setMtime(now)
|
||||
.setUserName(userGroupInformation.getUserName())
|
||||
.clearGroupName()
|
||||
.addAllGroupName(Arrays.asList(userGroupInformation.getGroupNames()))
|
||||
);
|
||||
}
|
||||
|
||||
return new SeaweedOutputStream(filerGrpcClient, path, entry, writePosition, bufferSize, replication);
|
||||
|
||||
}
|
||||
|
||||
public InputStream openFileForRead(final Path path, FileSystem.Statistics statistics,
|
||||
int bufferSize) throws IOException {
|
||||
|
||||
LOG.debug("openFileForRead path:{} bufferSize:{}", path, bufferSize);
|
||||
|
||||
int readAheadQueueDepth = 2;
|
||||
FilerProto.Entry entry = lookupEntry(path);
|
||||
|
||||
if (entry == null) {
|
||||
throw new FileNotFoundException("read non-exist file " + path);
|
||||
}
|
||||
|
||||
return new SeaweedInputStream(filerGrpcClient,
|
||||
statistics,
|
||||
path.toUri().getPath(),
|
||||
entry,
|
||||
bufferSize,
|
||||
readAheadQueueDepth);
|
||||
}
|
||||
|
||||
public void setOwner(Path path, String owner, String group) {
|
||||
|
||||
LOG.debug("setOwner path:{} owner:{} group:{}", path, owner, group);
|
||||
|
||||
FilerProto.Entry entry = lookupEntry(path);
|
||||
if (entry == null) {
|
||||
LOG.debug("setOwner path:{} entry:{}", path, entry);
|
||||
return;
|
||||
}
|
||||
|
||||
FilerProto.Entry.Builder entryBuilder = entry.toBuilder();
|
||||
FilerProto.FuseAttributes.Builder attributesBuilder = entry.getAttributes().toBuilder();
|
||||
|
||||
if (owner != null) {
|
||||
attributesBuilder.setUserName(owner);
|
||||
}
|
||||
if (group != null) {
|
||||
attributesBuilder.clearGroupName();
|
||||
attributesBuilder.addGroupName(group);
|
||||
}
|
||||
|
||||
entryBuilder.setAttributes(attributesBuilder);
|
||||
|
||||
LOG.debug("setOwner path:{} entry:{}", path, entryBuilder);
|
||||
|
||||
filerClient.updateEntry(getParentDirectory(path), entryBuilder.build());
|
||||
|
||||
}
|
||||
|
||||
public void setPermission(Path path, FsPermission permission) {
|
||||
|
||||
LOG.debug("setPermission path:{} permission:{}", path, permission);
|
||||
|
||||
FilerProto.Entry entry = lookupEntry(path);
|
||||
if (entry == null) {
|
||||
LOG.debug("setPermission path:{} entry:{}", path, entry);
|
||||
return;
|
||||
}
|
||||
|
||||
FilerProto.Entry.Builder entryBuilder = entry.toBuilder();
|
||||
FilerProto.FuseAttributes.Builder attributesBuilder = entry.getAttributes().toBuilder();
|
||||
|
||||
attributesBuilder.setFileMode(permissionToMode(permission, entry.getIsDirectory()));
|
||||
|
||||
entryBuilder.setAttributes(attributesBuilder);
|
||||
|
||||
LOG.debug("setPermission path:{} entry:{}", path, entryBuilder);
|
||||
|
||||
filerClient.updateEntry(getParentDirectory(path), entryBuilder.build());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,371 @@
|
||||
package seaweed.hdfs;
|
||||
|
||||
// based on org.apache.hadoop.fs.azurebfs.services.AbfsInputStream
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.apache.hadoop.fs.FSExceptionMessages;
|
||||
import org.apache.hadoop.fs.FSInputStream;
|
||||
import org.apache.hadoop.fs.FileSystem.Statistics;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import seaweedfs.client.FilerGrpcClient;
|
||||
import seaweedfs.client.FilerProto;
|
||||
import seaweedfs.client.SeaweedRead;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class SeaweedInputStream extends FSInputStream {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SeaweedInputStream.class);
|
||||
|
||||
private final FilerGrpcClient filerGrpcClient;
|
||||
private final Statistics statistics;
|
||||
private final String path;
|
||||
private final FilerProto.Entry entry;
|
||||
private final List<SeaweedRead.VisibleInterval> visibleIntervalList;
|
||||
private final long contentLength;
|
||||
private final int bufferSize; // default buffer size
|
||||
private final int readAheadQueueDepth; // initialized in constructor
|
||||
private final boolean readAheadEnabled; // whether enable readAhead;
|
||||
|
||||
private byte[] buffer = null; // will be initialized on first use
|
||||
|
||||
private long fCursor = 0; // cursor of buffer within file - offset of next byte to read from remote server
|
||||
private long fCursorAfterLastRead = -1;
|
||||
private int bCursor = 0; // cursor of read within buffer - offset of next byte to be returned from buffer
|
||||
private int limit = 0; // offset of next byte to be read into buffer from service (i.e., upper marker+1
|
||||
// of valid bytes in buffer)
|
||||
private boolean closed = false;
|
||||
|
||||
public SeaweedInputStream(
|
||||
final FilerGrpcClient filerGrpcClient,
|
||||
final Statistics statistics,
|
||||
final String path,
|
||||
final FilerProto.Entry entry,
|
||||
final int bufferSize,
|
||||
final int readAheadQueueDepth) {
|
||||
this.filerGrpcClient = filerGrpcClient;
|
||||
this.statistics = statistics;
|
||||
this.path = path;
|
||||
this.entry = entry;
|
||||
this.contentLength = SeaweedRead.totalSize(entry.getChunksList());
|
||||
this.bufferSize = bufferSize;
|
||||
this.readAheadQueueDepth = (readAheadQueueDepth >= 0) ? readAheadQueueDepth : Runtime.getRuntime().availableProcessors();
|
||||
this.readAheadEnabled = true;
|
||||
|
||||
this.visibleIntervalList = SeaweedRead.nonOverlappingVisibleIntervals(entry.getChunksList());
|
||||
|
||||
LOG.debug("new path:{} entry:{} visibleIntervalList:{}", path, entry, visibleIntervalList);
|
||||
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
byte[] b = new byte[1];
|
||||
int numberOfBytesRead = read(b, 0, 1);
|
||||
if (numberOfBytesRead < 0) {
|
||||
return -1;
|
||||
} else {
|
||||
return (b[0] & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int read(final byte[] b, final int off, final int len) throws IOException {
|
||||
int currentOff = off;
|
||||
int currentLen = len;
|
||||
int lastReadBytes;
|
||||
int totalReadBytes = 0;
|
||||
do {
|
||||
lastReadBytes = readOneBlock(b, currentOff, currentLen);
|
||||
if (lastReadBytes > 0) {
|
||||
currentOff += lastReadBytes;
|
||||
currentLen -= lastReadBytes;
|
||||
totalReadBytes += lastReadBytes;
|
||||
}
|
||||
if (currentLen <= 0 || currentLen > b.length - currentOff) {
|
||||
break;
|
||||
}
|
||||
} while (lastReadBytes > 0);
|
||||
return totalReadBytes > 0 ? totalReadBytes : lastReadBytes;
|
||||
}
|
||||
|
||||
private int readOneBlock(final byte[] b, final int off, final int len) throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
|
||||
}
|
||||
|
||||
Preconditions.checkNotNull(b);
|
||||
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (this.available() == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (off < 0 || len < 0 || len > b.length - off) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
//If buffer is empty, then fill the buffer.
|
||||
if (bCursor == limit) {
|
||||
//If EOF, then return -1
|
||||
if (fCursor >= contentLength) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
long bytesRead = 0;
|
||||
//reset buffer to initial state - i.e., throw away existing data
|
||||
bCursor = 0;
|
||||
limit = 0;
|
||||
if (buffer == null) {
|
||||
buffer = new byte[bufferSize];
|
||||
}
|
||||
|
||||
// Enable readAhead when reading sequentially
|
||||
if (-1 == fCursorAfterLastRead || fCursorAfterLastRead == fCursor || b.length >= bufferSize) {
|
||||
bytesRead = readInternal(fCursor, buffer, 0, bufferSize, false);
|
||||
} else {
|
||||
bytesRead = readInternal(fCursor, buffer, 0, b.length, true);
|
||||
}
|
||||
|
||||
if (bytesRead == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
limit += bytesRead;
|
||||
fCursor += bytesRead;
|
||||
fCursorAfterLastRead = fCursor;
|
||||
}
|
||||
|
||||
//If there is anything in the buffer, then return lesser of (requested bytes) and (bytes in buffer)
|
||||
//(bytes returned may be less than requested)
|
||||
int bytesRemaining = limit - bCursor;
|
||||
int bytesToRead = Math.min(len, bytesRemaining);
|
||||
System.arraycopy(buffer, bCursor, b, off, bytesToRead);
|
||||
bCursor += bytesToRead;
|
||||
if (statistics != null) {
|
||||
statistics.incrementBytesRead(bytesToRead);
|
||||
}
|
||||
return bytesToRead;
|
||||
}
|
||||
|
||||
|
||||
private int readInternal(final long position, final byte[] b, final int offset, final int length,
|
||||
final boolean bypassReadAhead) throws IOException {
|
||||
if (readAheadEnabled && !bypassReadAhead) {
|
||||
// try reading from read-ahead
|
||||
if (offset != 0) {
|
||||
throw new IllegalArgumentException("readahead buffers cannot have non-zero buffer offsets");
|
||||
}
|
||||
int receivedBytes;
|
||||
|
||||
// queue read-aheads
|
||||
int numReadAheads = this.readAheadQueueDepth;
|
||||
long nextSize;
|
||||
long nextOffset = position;
|
||||
while (numReadAheads > 0 && nextOffset < contentLength) {
|
||||
nextSize = Math.min((long) bufferSize, contentLength - nextOffset);
|
||||
ReadBufferManager.getBufferManager().queueReadAhead(this, nextOffset, (int) nextSize);
|
||||
nextOffset = nextOffset + nextSize;
|
||||
numReadAheads--;
|
||||
}
|
||||
|
||||
// try reading from buffers first
|
||||
receivedBytes = ReadBufferManager.getBufferManager().getBlock(this, position, length, b);
|
||||
if (receivedBytes > 0) {
|
||||
return receivedBytes;
|
||||
}
|
||||
|
||||
// got nothing from read-ahead, do our own read now
|
||||
receivedBytes = readRemote(position, b, offset, length);
|
||||
return receivedBytes;
|
||||
} else {
|
||||
return readRemote(position, b, offset, length);
|
||||
}
|
||||
}
|
||||
|
||||
int readRemote(long position, byte[] b, int offset, int length) throws IOException {
|
||||
if (position < 0) {
|
||||
throw new IllegalArgumentException("attempting to read from negative offset");
|
||||
}
|
||||
if (position >= contentLength) {
|
||||
return -1; // Hadoop prefers -1 to EOFException
|
||||
}
|
||||
if (b == null) {
|
||||
throw new IllegalArgumentException("null byte array passed in to read() method");
|
||||
}
|
||||
if (offset >= b.length) {
|
||||
throw new IllegalArgumentException("offset greater than length of array");
|
||||
}
|
||||
if (length < 0) {
|
||||
throw new IllegalArgumentException("requested read length is less than zero");
|
||||
}
|
||||
if (length > (b.length - offset)) {
|
||||
throw new IllegalArgumentException("requested read length is more than will fit after requested offset in buffer");
|
||||
}
|
||||
|
||||
long bytesRead = SeaweedRead.read(filerGrpcClient, visibleIntervalList, position, b, offset, length);
|
||||
if (bytesRead > Integer.MAX_VALUE) {
|
||||
throw new IOException("Unexpected Content-Length");
|
||||
}
|
||||
return (int) bytesRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seek to given position in stream.
|
||||
*
|
||||
* @param n position to seek to
|
||||
* @throws IOException if there is an error
|
||||
* @throws EOFException if attempting to seek past end of file
|
||||
*/
|
||||
@Override
|
||||
public synchronized void seek(long n) throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
|
||||
}
|
||||
if (n < 0) {
|
||||
throw new EOFException(FSExceptionMessages.NEGATIVE_SEEK);
|
||||
}
|
||||
if (n > contentLength) {
|
||||
throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF);
|
||||
}
|
||||
|
||||
if (n >= fCursor - limit && n <= fCursor) { // within buffer
|
||||
bCursor = (int) (n - (fCursor - limit));
|
||||
return;
|
||||
}
|
||||
|
||||
// next read will read from here
|
||||
fCursor = n;
|
||||
|
||||
//invalidate buffer
|
||||
limit = 0;
|
||||
bCursor = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized long skip(long n) throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
|
||||
}
|
||||
long currentPos = getPos();
|
||||
if (currentPos == contentLength) {
|
||||
if (n > 0) {
|
||||
throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF);
|
||||
}
|
||||
}
|
||||
long newPos = currentPos + n;
|
||||
if (newPos < 0) {
|
||||
newPos = 0;
|
||||
n = newPos - currentPos;
|
||||
}
|
||||
if (newPos > contentLength) {
|
||||
newPos = contentLength;
|
||||
n = newPos - currentPos;
|
||||
}
|
||||
seek(newPos);
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size of the remaining available bytes
|
||||
* if the size is less than or equal to {@link Integer#MAX_VALUE},
|
||||
* otherwise, return {@link Integer#MAX_VALUE}.
|
||||
* <p>
|
||||
* This is to match the behavior of DFSInputStream.available(),
|
||||
* which some clients may rely on (HBase write-ahead log reading in
|
||||
* particular).
|
||||
*/
|
||||
@Override
|
||||
public synchronized int available() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(
|
||||
FSExceptionMessages.STREAM_IS_CLOSED);
|
||||
}
|
||||
final long remaining = this.contentLength - this.getPos();
|
||||
return remaining <= Integer.MAX_VALUE
|
||||
? (int) remaining : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the file that this stream refers to. Note that the length returned is the length
|
||||
* as of the time the Stream was opened. Specifically, if there have been subsequent appends to the file,
|
||||
* they wont be reflected in the returned length.
|
||||
*
|
||||
* @return length of the file.
|
||||
* @throws IOException if the stream is closed
|
||||
*/
|
||||
public long length() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
|
||||
}
|
||||
return contentLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current offset from the start of the file
|
||||
*
|
||||
* @throws IOException throws {@link IOException} if there is an error
|
||||
*/
|
||||
@Override
|
||||
public synchronized long getPos() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
|
||||
}
|
||||
return fCursor - limit + bCursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeks a different copy of the data. Returns true if
|
||||
* found a new source, false otherwise.
|
||||
*
|
||||
* @throws IOException throws {@link IOException} if there is an error
|
||||
*/
|
||||
@Override
|
||||
public boolean seekToNewSource(long l) throws IOException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void close() throws IOException {
|
||||
closed = true;
|
||||
buffer = null; // de-reference the buffer so it can be GC'ed sooner
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported by this stream. Throws {@link UnsupportedOperationException}
|
||||
*
|
||||
* @param readlimit ignored
|
||||
*/
|
||||
@Override
|
||||
public synchronized void mark(int readlimit) {
|
||||
throw new UnsupportedOperationException("mark()/reset() not supported on this stream");
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported by this stream. Throws {@link UnsupportedOperationException}
|
||||
*/
|
||||
@Override
|
||||
public synchronized void reset() throws IOException {
|
||||
throw new UnsupportedOperationException("mark()/reset() not supported on this stream");
|
||||
}
|
||||
|
||||
/**
|
||||
* gets whether mark and reset are supported by {@code ADLFileInputStream}. Always returns false.
|
||||
*
|
||||
* @return always {@code false}
|
||||
*/
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
package seaweed.hdfs;
|
||||
|
||||
// adapted from org.apache.hadoop.fs.azurebfs.services.AbfsOutputStream
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.apache.hadoop.fs.FSExceptionMessages;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.fs.StreamCapabilities;
|
||||
import org.apache.hadoop.fs.Syncable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import seaweedfs.client.FilerGrpcClient;
|
||||
import seaweedfs.client.FilerProto;
|
||||
import seaweedfs.client.SeaweedWrite;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.ExecutorCompletionService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static seaweed.hdfs.SeaweedFileSystemStore.getParentDirectory;
|
||||
|
||||
public class SeaweedOutputStream extends OutputStream implements Syncable, StreamCapabilities {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SeaweedOutputStream.class);
|
||||
|
||||
private final FilerGrpcClient filerGrpcClient;
|
||||
private final Path path;
|
||||
private final int bufferSize;
|
||||
private final int maxConcurrentRequestCount;
|
||||
private final ThreadPoolExecutor threadExecutor;
|
||||
private final ExecutorCompletionService<Void> completionService;
|
||||
private FilerProto.Entry.Builder entry;
|
||||
private long position;
|
||||
private boolean closed;
|
||||
private boolean supportFlush = true;
|
||||
private volatile IOException lastError;
|
||||
private long lastFlushOffset;
|
||||
private long lastTotalAppendOffset = 0;
|
||||
private byte[] buffer;
|
||||
private int bufferIndex;
|
||||
private ConcurrentLinkedDeque<WriteOperation> writeOperations;
|
||||
private String replication = "000";
|
||||
|
||||
public SeaweedOutputStream(FilerGrpcClient filerGrpcClient, final Path path, FilerProto.Entry.Builder entry,
|
||||
final long position, final int bufferSize, final String replication) {
|
||||
this.filerGrpcClient = filerGrpcClient;
|
||||
this.replication = replication;
|
||||
this.path = path;
|
||||
this.position = position;
|
||||
this.closed = false;
|
||||
this.lastError = null;
|
||||
this.lastFlushOffset = 0;
|
||||
this.bufferSize = bufferSize;
|
||||
this.buffer = new byte[bufferSize];
|
||||
this.bufferIndex = 0;
|
||||
this.writeOperations = new ConcurrentLinkedDeque<>();
|
||||
|
||||
this.maxConcurrentRequestCount = 4 * Runtime.getRuntime().availableProcessors();
|
||||
|
||||
this.threadExecutor
|
||||
= new ThreadPoolExecutor(maxConcurrentRequestCount,
|
||||
maxConcurrentRequestCount,
|
||||
10L,
|
||||
TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<Runnable>());
|
||||
this.completionService = new ExecutorCompletionService<>(this.threadExecutor);
|
||||
|
||||
this.entry = entry;
|
||||
|
||||
}
|
||||
|
||||
private synchronized void flushWrittenBytesToServiceInternal(final long offset) throws IOException {
|
||||
|
||||
LOG.debug("SeaweedWrite.writeMeta path: {} entry:{}", path, entry);
|
||||
|
||||
try {
|
||||
SeaweedWrite.writeMeta(filerGrpcClient, getParentDirectory(path), entry);
|
||||
} catch (Exception ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
this.lastFlushOffset = offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(final int byteVal) throws IOException {
|
||||
write(new byte[]{(byte) (byteVal & 0xFF)});
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void write(final byte[] data, final int off, final int length)
|
||||
throws IOException {
|
||||
maybeThrowLastError();
|
||||
|
||||
Preconditions.checkArgument(data != null, "null data");
|
||||
|
||||
if (off < 0 || length < 0 || length > data.length - off) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
int currentOffset = off;
|
||||
int writableBytes = bufferSize - bufferIndex;
|
||||
int numberOfBytesToWrite = length;
|
||||
|
||||
while (numberOfBytesToWrite > 0) {
|
||||
if (writableBytes <= numberOfBytesToWrite) {
|
||||
System.arraycopy(data, currentOffset, buffer, bufferIndex, writableBytes);
|
||||
bufferIndex += writableBytes;
|
||||
writeCurrentBufferToService();
|
||||
currentOffset += writableBytes;
|
||||
numberOfBytesToWrite = numberOfBytesToWrite - writableBytes;
|
||||
} else {
|
||||
System.arraycopy(data, currentOffset, buffer, bufferIndex, numberOfBytesToWrite);
|
||||
bufferIndex += numberOfBytesToWrite;
|
||||
numberOfBytesToWrite = 0;
|
||||
}
|
||||
|
||||
writableBytes = bufferSize - bufferIndex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flushes this output stream and forces any buffered output bytes to be
|
||||
* written out. If any data remains in the payload it is committed to the
|
||||
* service. Data is queued for writing and forced out to the service
|
||||
* before the call returns.
|
||||
*/
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
if (supportFlush) {
|
||||
flushInternalAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to posix fsync, flush out the data in client's user buffer
|
||||
* all the way to the disk device (but the disk may have it in its cache).
|
||||
*
|
||||
* @throws IOException if error occurs
|
||||
*/
|
||||
@Override
|
||||
public void hsync() throws IOException {
|
||||
if (supportFlush) {
|
||||
flushInternal();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush out the data in client's user buffer. After the return of
|
||||
* this call, new readers will see the data.
|
||||
*
|
||||
* @throws IOException if any error occurs
|
||||
*/
|
||||
@Override
|
||||
public void hflush() throws IOException {
|
||||
if (supportFlush) {
|
||||
flushInternal();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the stream for a specific capability.
|
||||
*
|
||||
* @param capability string to query the stream support for.
|
||||
* @return true for hsync and hflush.
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCapability(String capability) {
|
||||
switch (capability.toLowerCase(Locale.ENGLISH)) {
|
||||
case StreamCapabilities.HSYNC:
|
||||
case StreamCapabilities.HFLUSH:
|
||||
return supportFlush;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Force all data in the output stream to be written to Azure storage.
|
||||
* Wait to return until this is complete. Close the access to the stream and
|
||||
* shutdown the upload thread pool.
|
||||
* If the blob was created, its lease will be released.
|
||||
* Any error encountered caught in threads and stored will be rethrown here
|
||||
* after cleanup.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void close() throws IOException {
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG.debug("close path: {}", path);
|
||||
try {
|
||||
flushInternal();
|
||||
threadExecutor.shutdown();
|
||||
} finally {
|
||||
lastError = new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
|
||||
buffer = null;
|
||||
bufferIndex = 0;
|
||||
closed = true;
|
||||
writeOperations.clear();
|
||||
if (!threadExecutor.isShutdown()) {
|
||||
threadExecutor.shutdownNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void writeCurrentBufferToService() throws IOException {
|
||||
if (bufferIndex == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
final byte[] bytes = buffer;
|
||||
final int bytesLength = bufferIndex;
|
||||
|
||||
buffer = new byte[bufferSize];
|
||||
bufferIndex = 0;
|
||||
final long offset = position;
|
||||
position += bytesLength;
|
||||
|
||||
if (threadExecutor.getQueue().size() >= maxConcurrentRequestCount * 2) {
|
||||
waitForTaskToComplete();
|
||||
}
|
||||
|
||||
final Future<Void> job = completionService.submit(new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
// originally: client.append(path, offset, bytes, 0, bytesLength);
|
||||
SeaweedWrite.writeData(entry, replication, filerGrpcClient, offset, bytes, 0, bytesLength);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
writeOperations.add(new WriteOperation(job, offset, bytesLength));
|
||||
|
||||
// Try to shrink the queue
|
||||
shrinkWriteOperationQueue();
|
||||
}
|
||||
|
||||
private void waitForTaskToComplete() throws IOException {
|
||||
boolean completed;
|
||||
for (completed = false; completionService.poll() != null; completed = true) {
|
||||
// keep polling until there is no data
|
||||
}
|
||||
|
||||
if (!completed) {
|
||||
try {
|
||||
completionService.take();
|
||||
} catch (InterruptedException e) {
|
||||
lastError = (IOException) new InterruptedIOException(e.toString()).initCause(e);
|
||||
throw lastError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void maybeThrowLastError() throws IOException {
|
||||
if (lastError != null) {
|
||||
throw lastError;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to remove the completed write operations from the beginning of write
|
||||
* operation FIFO queue.
|
||||
*/
|
||||
private synchronized void shrinkWriteOperationQueue() throws IOException {
|
||||
try {
|
||||
while (writeOperations.peek() != null && writeOperations.peek().task.isDone()) {
|
||||
writeOperations.peek().task.get();
|
||||
lastTotalAppendOffset += writeOperations.peek().length;
|
||||
writeOperations.remove();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
lastError = new IOException(e);
|
||||
throw lastError;
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void flushInternal() throws IOException {
|
||||
maybeThrowLastError();
|
||||
writeCurrentBufferToService();
|
||||
flushWrittenBytesToService();
|
||||
}
|
||||
|
||||
private synchronized void flushInternalAsync() throws IOException {
|
||||
maybeThrowLastError();
|
||||
writeCurrentBufferToService();
|
||||
flushWrittenBytesToServiceAsync();
|
||||
}
|
||||
|
||||
private synchronized void flushWrittenBytesToService() throws IOException {
|
||||
for (WriteOperation writeOperation : writeOperations) {
|
||||
try {
|
||||
writeOperation.task.get();
|
||||
} catch (Exception ex) {
|
||||
lastError = new IOException(ex);
|
||||
throw lastError;
|
||||
}
|
||||
}
|
||||
LOG.debug("flushWrittenBytesToService: {} position:{}", path, position);
|
||||
flushWrittenBytesToServiceInternal(position);
|
||||
}
|
||||
|
||||
private synchronized void flushWrittenBytesToServiceAsync() throws IOException {
|
||||
shrinkWriteOperationQueue();
|
||||
|
||||
if (this.lastTotalAppendOffset > this.lastFlushOffset) {
|
||||
this.flushWrittenBytesToServiceInternal(this.lastTotalAppendOffset);
|
||||
}
|
||||
}
|
||||
|
||||
private static class WriteOperation {
|
||||
private final Future<Void> task;
|
||||
private final long startOffset;
|
||||
private final long length;
|
||||
|
||||
WriteOperation(final Future<Void> task, final long startOffset, final long length) {
|
||||
Preconditions.checkNotNull(task, "task");
|
||||
Preconditions.checkArgument(startOffset >= 0, "startOffset");
|
||||
Preconditions.checkArgument(length >= 0, "length");
|
||||
|
||||
this.task = task;
|
||||
this.startOffset = startOffset;
|
||||
this.length = length;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.seaweedfs.s3</groupId>
|
||||
<artifactId>copier</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>copier</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-bom</artifactId>
|
||||
<version>1.11.327</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-s3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.seaweedfs.s3;
|
||||
|
||||
import com.amazonaws.AmazonServiceException;
|
||||
import com.amazonaws.ClientConfiguration;
|
||||
import com.amazonaws.SdkClientException;
|
||||
import com.amazonaws.auth.AWSCredentials;
|
||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
||||
import com.amazonaws.auth.BasicAWSCredentials;
|
||||
import com.amazonaws.client.builder.AwsClientBuilder;
|
||||
import com.amazonaws.regions.Regions;
|
||||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||
import com.amazonaws.services.s3.transfer.TransferManager;
|
||||
import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
|
||||
import com.amazonaws.services.s3.transfer.Upload;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class HighLevelMultipartUpload {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String bucketName = "javabucket";
|
||||
String filePath = args[0];
|
||||
File file = new File(filePath);
|
||||
String keyName = "path/to/" + file.getName();
|
||||
|
||||
try {
|
||||
AWSCredentials credentials = new BasicAWSCredentials("ANY-ACCESSKEYID", "ANY-SECRETACCESSKEY");
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration();
|
||||
clientConfiguration.setSignerOverride("AWSS3V4SignerType");
|
||||
|
||||
AmazonS3 s3Client = AmazonS3ClientBuilder
|
||||
.standard()
|
||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
|
||||
"http://localhost:8333", Regions.US_WEST_1.name()))
|
||||
.withPathStyleAccessEnabled(true)
|
||||
.withClientConfiguration(clientConfiguration)
|
||||
.withCredentials(new AWSStaticCredentialsProvider(credentials))
|
||||
.build();
|
||||
|
||||
TransferManager tm = TransferManagerBuilder.standard()
|
||||
.withS3Client(s3Client)
|
||||
.build();
|
||||
|
||||
// TransferManager processes all transfers asynchronously,
|
||||
// so this call returns immediately.
|
||||
Upload upload = tm.upload(bucketName, keyName, file);
|
||||
System.out.println("Object upload started");
|
||||
|
||||
// Optionally, wait for the upload to finish before continuing.
|
||||
upload.waitForCompletion();
|
||||
System.out.println("Object upload complete");
|
||||
} catch (AmazonServiceException e) {
|
||||
// The call was transmitted successfully, but Amazon S3 couldn't process
|
||||
// it, so it returned an error response.
|
||||
e.printStackTrace();
|
||||
} catch (SdkClientException e) {
|
||||
// Amazon S3 couldn't be contacted for a response, or the client
|
||||
// couldn't parse the response from Amazon S3.
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.seaweedfs.s3;
|
||||
|
||||
import com.amazonaws.AmazonServiceException;
|
||||
import com.amazonaws.ClientConfiguration;
|
||||
import com.amazonaws.SdkClientException;
|
||||
import com.amazonaws.auth.AWSCredentials;
|
||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
||||
import com.amazonaws.auth.BasicAWSCredentials;
|
||||
import com.amazonaws.client.builder.AwsClientBuilder;
|
||||
import com.amazonaws.regions.Regions;
|
||||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||
import com.amazonaws.services.s3.model.ObjectMetadata;
|
||||
import com.amazonaws.services.s3.model.PutObjectRequest;
|
||||
import com.amazonaws.services.s3.model.S3Object;
|
||||
import com.amazonaws.util.IOUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*/
|
||||
public class PutObject {
|
||||
|
||||
private static Log log = LogFactory.getLog(PutObject.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
AWSCredentials credentials = new BasicAWSCredentials("ANY-ACCESSKEYID", "ANY-SECRETACCESSKEY");
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration();
|
||||
clientConfiguration.setSignerOverride("AWSS3V4SignerType");
|
||||
|
||||
AmazonS3 s3Client = AmazonS3ClientBuilder
|
||||
.standard()
|
||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
|
||||
"http://localhost:8333", Regions.US_WEST_1.name()))
|
||||
.withPathStyleAccessEnabled(true)
|
||||
.withClientConfiguration(clientConfiguration)
|
||||
.withCredentials(new AWSStaticCredentialsProvider(credentials))
|
||||
.build();
|
||||
|
||||
String bucketName = "javabucket";
|
||||
String stringObjKeyName = "strObject2";
|
||||
String fileObjKeyName = "fileObject2";
|
||||
String fileName = args[0];
|
||||
|
||||
String stringContent = "Uploaded String Object v3";
|
||||
try {
|
||||
|
||||
// Upload a text string as a new object.
|
||||
s3Client.putObject(bucketName, stringObjKeyName, stringContent);
|
||||
|
||||
// Upload a file as a new object with ContentType and title specified.
|
||||
PutObjectRequest request = new PutObjectRequest(bucketName, fileObjKeyName, new File(fileName));
|
||||
ObjectMetadata metadata = new ObjectMetadata();
|
||||
metadata.setContentType("plain/text");
|
||||
metadata.addUserMetadata("x-amz-meta-title", "someTitle");
|
||||
request.setMetadata(metadata);
|
||||
s3Client.putObject(request);
|
||||
|
||||
// test reads
|
||||
S3Object written = s3Client.getObject(bucketName, stringObjKeyName);
|
||||
try {
|
||||
String expected = IOUtils.toString(written.getObjectContent());
|
||||
|
||||
if (!stringContent.equals(expected)){
|
||||
System.out.println("Failed to put and get back the content!");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new SdkClientException("Error streaming content from S3 during download");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(written, log);
|
||||
}
|
||||
|
||||
// test deletes
|
||||
s3Client.deleteObject(bucketName, stringObjKeyName);
|
||||
|
||||
|
||||
// delete bucket
|
||||
String tmpBucket = "tmpbucket";
|
||||
s3Client.createBucket(tmpBucket);
|
||||
s3Client.putObject(tmpBucket, stringObjKeyName, stringContent);
|
||||
s3Client.deleteBucket(tmpBucket);
|
||||
|
||||
} catch (AmazonServiceException e) {
|
||||
// The call was transmitted successfully, but Amazon S3 couldn't process
|
||||
// it, so it returned an error response.
|
||||
e.printStackTrace();
|
||||
} catch (SdkClientException e) {
|
||||
// Amazon S3 couldn't be contacted for a response, or the client
|
||||
// couldn't parse the response from Amazon S3.
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.seaweedfs.s3;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class PutObjectTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public PutObjectTest(String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( PutObjectTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
*.sh text eol=lf
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
# Model citations for mapped files
|
||||
|
||||
The spec-trace workflow reads `model-code-trace.tsv` and the validator from
|
||||
the target branch. A PR cannot replace its own mapping or checker.
|
||||
|
||||
Each non-comment line has two tab-separated columns: an exact repository
|
||||
path and `Module.Action`. Repeat a path to list alternative actions that
|
||||
cover it. Paths are case-sensitive; directories and glob patterns are not
|
||||
expanded. Missing, empty or malformed mappings refuse the check.
|
||||
|
||||
The reviewed map uses the neutral public module names: `SnapshotRemoval`,
|
||||
`RestoreTarget`, `HolderInterface`, `EngineAdapter`, `StopAndRestart`,
|
||||
`MoveAdmission`, `Promotion`, `ProbeRound`, `FencingRound`, `VolumeCreate`
|
||||
and `ReplicationPeer`.
|
||||
Actions name top-level definitions used by the corresponding model's `Next`.
|
||||
The mapping is the source of accepted citations; private model names and
|
||||
storage locations do not belong in the public map or PR description.
|
||||
|
||||
For every changed mapped path, including deletions, the PR's `Model:` line
|
||||
must contain a listed action or `NONE (pure function of Module)` for that
|
||||
module. Separate multiple citations with semicolons, for example:
|
||||
|
||||
```text
|
||||
Model: EngineAdapter.Begin; MoveAdmission.Revoke; NONE (pure function of RestoreTarget)
|
||||
```
|
||||
|
||||
Unmapped paths keep the existing spec-trace policy. The pure-function
|
||||
declaration is a review claim; CI checks its module, not its truth.
|
||||
|
||||
## Adding a model or file
|
||||
|
||||
1. Have the model owner confirm its neutral public module name and the
|
||||
top-level action definitions used by `Next`. Use those names in public
|
||||
code, mapping rows and PR descriptions.
|
||||
2. Add an exact-path TSV row for each implementation and enforcement file
|
||||
that the action covers. Split actions get separate rows. Include receiving
|
||||
guards as well as senders; a reviewer checks that each file really enforces
|
||||
the cited action. Environment actions without a Go site and mutant test
|
||||
obligations are not implementation mappings.
|
||||
3. Add controls for accepted and refused citations when extending the
|
||||
checker. For mapping additions, check the real map against representative
|
||||
affected paths. Run `python3 -B .github/scripts/model-trace-check-test.py`
|
||||
and `bash .github/scripts/spec-trace-check-test.sh` on Linux.
|
||||
4. Submit the map and its evidence for review with the model change or before
|
||||
its callers land. The PR description cites the applicable public actions.
|
||||
The new rows govern later PRs once they are on the target branch; changing
|
||||
a PR's own map never changes the check that evaluates that PR.
|
||||
-119
@@ -1,119 +0,0 @@
|
||||
# Exact repository-relative path<TAB>Module.Action; repeat a path for alternatives.
|
||||
core/authority/workspace.go HolderInterface.ForcedMove
|
||||
core/authority/workspace.go HolderInterface.PlannedMove
|
||||
core/authority/workspace.go MoveAdmission.Ack
|
||||
core/authority/workspace.go MoveAdmission.IssueClean
|
||||
core/authority/workspace.go MoveAdmission.IssueForced
|
||||
core/authority/workspace.go MoveAdmission.Lease2Ends
|
||||
core/authority/workspace.go MoveAdmission.LeaseEnds
|
||||
core/authority/workspace.go MoveAdmission.ReadForMove
|
||||
core/authority/workspace.go MoveAdmission.Revoke
|
||||
core/authority/workspace.go StopAndRestart.IssueClean
|
||||
core/authority/workspace.go StopAndRestart.IssueForced
|
||||
core/authority/workspace.go StopAndRestart.LeaseEnds
|
||||
core/authority/workspace.go StopAndRestart.ReadForced
|
||||
core/authority/workspace_delete_reservation.go MoveAdmission.DelCheck
|
||||
core/authority/workspace_delete_reservation.go MoveAdmission.Reserve
|
||||
core/authority/workspace_lease_view.go HolderInterface.Grant
|
||||
core/authority/workspace_lease_view.go HolderInterface.Regrant
|
||||
core/engine/apply.go ReplicationPeer.Reconcile
|
||||
core/frontend/chunkstore/layout/claim.go EngineAdapter.Takeover
|
||||
core/frontend/chunkstore/layout/claim.go MoveAdmission.ClaimB
|
||||
core/frontend/chunkstore/layout/claim.go SnapshotRemoval.Claim
|
||||
core/frontend/chunkstore/layout/claim.go StopAndRestart.ClaimB
|
||||
core/frontend/chunkstore/layout/clean.go EngineAdapter.MaintBegin
|
||||
core/frontend/chunkstore/layout/clean.go EngineAdapter.MaintEnd
|
||||
core/frontend/chunkstore/layout/clean.go SnapshotRemoval.BeginClean
|
||||
core/frontend/chunkstore/layout/clean.go SnapshotRemoval.EndClean
|
||||
core/frontend/chunkstore/layout/commit.go EngineAdapter.Apply
|
||||
core/frontend/chunkstore/layout/commit.go SnapshotRemoval.Commit
|
||||
core/frontend/chunkstore/layout/commit.go VolumeCreate.Commit
|
||||
core/frontend/chunkstore/layout/create.go RestoreTarget.CreateHead
|
||||
core/frontend/chunkstore/layout/create.go RestoreTarget.CreateVol
|
||||
core/frontend/chunkstore/layout/create.go VolumeCreate.Claim
|
||||
core/frontend/chunkstore/layout/delete.go MoveAdmission.DelMark
|
||||
core/frontend/chunkstore/layout/delete.go MoveAdmission.DelRead
|
||||
core/frontend/chunkstore/layout/delete.go RestoreTarget.OpRelease
|
||||
core/frontend/chunkstore/layout/delete.go RestoreTarget.OpTomb
|
||||
core/frontend/chunkstore/layout/head.go SnapshotRemoval.Abort
|
||||
core/frontend/chunkstore/layout/head.go SnapshotRemoval.Begin
|
||||
core/frontend/chunkstore/layout/head.go StopAndRestart.Apply
|
||||
core/frontend/chunkstore/layout/head.go StopAndRestart.Begin
|
||||
core/frontend/chunkstore/layout/objects.go SnapshotRemoval.Upload
|
||||
core/frontend/chunkstore/layout/remove.go SnapshotRemoval.Issue
|
||||
core/frontend/chunkstore/layout/remove.go SnapshotRemoval.Stat
|
||||
core/frontend/chunkstore/layout/remove.go SnapshotRemoval.Validate
|
||||
core/frontend/chunkstore/layout/snapshots.go EngineAdapter.OpWrite
|
||||
core/frontend/chunkstore/layout/snapshots.go MoveAdmission.OpWrite
|
||||
core/frontend/chunkstore/layout/snapshots.go RestoreTarget.AddDep
|
||||
core/frontend/chunkstore/layout/snapshots.go SnapshotRemoval.DeleteSnap
|
||||
core/frontend/chunkstore/layout/start.go HolderInterface.Start
|
||||
core/frontend/chunkstore/layout/start.go StopAndRestart.CrashRestart
|
||||
core/frontend/chunkstore/layout/start.go VolumeCreate.Claim
|
||||
core/frontend/chunkstore/layout_create.go VolumeCreate.IssueHead
|
||||
core/frontend/chunkstore/layout_create.go VolumeCreate.IssueVol
|
||||
core/frontend/chunkstore/layout_remote.go EngineAdapter.Begin
|
||||
core/frontend/chunkstore/layout_remote.go EngineAdapter.ReadHead
|
||||
core/frontend/chunkstore/layout_remote.go EngineAdapter.SendCommit
|
||||
core/frontend/chunkstore/layout_remote.go EngineAdapter.SettleAbort
|
||||
core/frontend/chunkstore/layout_remote.go EngineAdapter.TakeAbandon
|
||||
core/frontend/chunkstore/layout_remote.go StopAndRestart.SendCommit
|
||||
core/frontend/chunkstore/layout_remote.go StopAndRestart.SettleAbort
|
||||
core/frontend/chunkstore/layout_store.go SnapshotRemoval.ApplyDelete
|
||||
core/frontend/chunkstore/layout_store.go SnapshotRemoval.ApplyMark
|
||||
core/frontend/chunkstore/swfs.go VolumeCreate.Land
|
||||
core/frontend/durable/provider_chunk.go EngineAdapter.SettleResume
|
||||
core/frontend/durable/provider_chunk.go EngineAdapter.StartStop
|
||||
core/frontend/durable/provider_chunk.go HolderInterface.StopBegin
|
||||
core/frontend/durable/provider_chunk.go StopAndRestart.SendDetach
|
||||
core/frontend/durable/provider_chunk.go StopAndRestart.SettleResume
|
||||
core/frontend/durable/provider_layout.go EngineAdapter.SettleDown
|
||||
core/frontend/durable/provider_layout.go StopAndRestart.SettleDown
|
||||
core/frontend/durable/storage_adapter.go EngineAdapter.GuestWrite
|
||||
core/frontend/durable/storage_adapter.go HolderInterface.Write
|
||||
core/host/master/layout_ready.go VolumeCreate.Place
|
||||
core/host/master/probe_round.go FencingRound.Deliver
|
||||
core/host/master/probe_round.go FencingRound.Open
|
||||
core/host/master/product_loop.go FencingRound.Decide
|
||||
core/host/master/product_loop.go Promotion.Decide
|
||||
core/host/master/store_attestation.go ReplicationPeer.Attest
|
||||
core/host/master/workspace_service.go MoveAdmission.ReadForMove
|
||||
core/host/master/workspace_service.go StopAndRestart.ReadClean
|
||||
core/host/volume/primary_evidence.go FencingRound.Adopt
|
||||
core/host/volume/primary_evidence.go Promotion.Adopt
|
||||
core/host/volume/primary_evidence.go Promotion.Refuse
|
||||
core/host/volume/probe_round.go FencingRound.Answer
|
||||
core/host/volume/workspace_lease.go HolderInterface.Expire
|
||||
core/host/volume/workspace_lease.go MoveAdmission.StopOnExpiry
|
||||
core/host/volume/workspace_lease.go MoveAdmission.Write
|
||||
core/host/volume/workspace_lease.go SnapshotRemoval.Expire
|
||||
core/host/volume/workspace_lease.go StopAndRestart.Write
|
||||
core/lifecycle/store.go VolumeCreate.MarkReady
|
||||
core/lifecycle/store.go VolumeCreate.Record
|
||||
core/replication/peer.go Promotion.Ship1
|
||||
core/replication/peer.go Promotion.Ship2
|
||||
core/replication/peer.go ReplicationPeer.Barrier
|
||||
core/replication/peer.go ReplicationPeer.Fail
|
||||
core/replication/peer.go ReplicationPeer.Heal
|
||||
core/replication/peer.go ReplicationPeer.Ship
|
||||
core/replication/volume.go FencingRound.Ack
|
||||
core/replication/volume.go Promotion.Ack1
|
||||
core/replication/volume.go Promotion.Rejoin
|
||||
core/replication/volume.go Promotion.Write1
|
||||
core/replication/volume.go Promotion.Write2
|
||||
core/replication/volume.go ReplicationPeer.Ack
|
||||
core/replication/volume.go ReplicationPeer.Write
|
||||
core/storage/chunk_head_belt.go HolderInterface.Fence
|
||||
core/storage/chunk_layer.go EngineAdapter.EngineReRead
|
||||
core/storage/chunk_layer.go EngineAdapter.NoOpCut
|
||||
core/storage/chunk_layer.go HolderInterface.Commit
|
||||
core/storage/chunk_layer.go HolderInterface.StopCommit
|
||||
core/storage/chunk_layer.go MoveAdmission.Detach
|
||||
core/storage/chunk_layer.go MoveAdmission.Publish
|
||||
core/storage/chunk_layer.go SnapshotRemoval.Write
|
||||
core/transport/catchup_sender.go ReplicationPeer.CatchUp
|
||||
core/transport/rebuild_sender.go ReplicationPeer.Rebuild
|
||||
core/transport/replica.go FencingRound.Recv
|
||||
core/transport/replica.go ReplicationPeer.CatchUp
|
||||
core/transport/replica.go ReplicationPeer.Rebuild
|
||||
core/transport/replica.go ReplicationPeer.Ship
|
||||
|
@@ -1,94 +0,0 @@
|
||||
# What a PR labelled "post-merge-review" may touch.
|
||||
#
|
||||
# A labelled PR passes the "post-merge-review paths" check only if EVERY
|
||||
# changed file (both names of a rename) matches an allow line and no "!"
|
||||
# line. Anything not allowed is denied: new files start denied. A PR that
|
||||
# fails keeps the full review before merge. Without the label the check
|
||||
# passes and nothing changes.
|
||||
#
|
||||
# One bash glob per line, matched against the repo-relative path; "*" also
|
||||
# matches "/". A line starting with "!" denies, and wins over any allow line.
|
||||
# Blank lines and text after "#" are ignored. The check reads this file from
|
||||
# the base branch, so a PR cannot loosen its own check; a missing or empty
|
||||
# file fails the check.
|
||||
|
||||
# ---- Allowed ----
|
||||
|
||||
# Docs.
|
||||
docs/*
|
||||
*.md
|
||||
|
||||
# Tests: added or modified, never deleted or moved (the check enforces
|
||||
# that); a test file in a denied directory stays denied.
|
||||
*_test.go
|
||||
|
||||
# Status, metrics and observation files, by name.
|
||||
core/host/master/observation_service.go
|
||||
core/host/master/observation_snapshot.go
|
||||
core/host/volume/memory_status.go
|
||||
core/ops/observation.go
|
||||
core/ops/observation_bundle.go
|
||||
core/ops/observation_dashboard.go
|
||||
core/ops/observation_report.go
|
||||
core/ops/volume_status_artifacts.go
|
||||
core/ops/volume_status_report.go
|
||||
core/ops/volume_status_report_collector.go
|
||||
core/ops/volume_status_summary.go
|
||||
|
||||
# ---- Denied even if allowed above ----
|
||||
|
||||
# The check itself and CI.
|
||||
!.github/*
|
||||
|
||||
# The test gates: the testops engine, its CLI and the gate definitions
|
||||
# (their docs stay allowed).
|
||||
!internal/testops/*.go
|
||||
!internal/testops/*.json
|
||||
!cmd/sw-testops/*
|
||||
|
||||
# Data path and replication.
|
||||
!core/storage/*
|
||||
!core/frontend/*
|
||||
!core/transport/*
|
||||
!core/replication/*
|
||||
!core/recovery/*
|
||||
!core/engine/*
|
||||
!core/adapter/*
|
||||
|
||||
# Authority: lease, epoch, fencing, move.
|
||||
!core/authority/*
|
||||
!core/host/master/workspace_*
|
||||
!core/host/volume/workspace_*
|
||||
!cmd/blockvolume/workspace_lease*
|
||||
|
||||
# Wire and persisted formats.
|
||||
!*.proto
|
||||
!*.pb.go
|
||||
!core/host/master/journal_isolation*
|
||||
!core/lifecycle/store*
|
||||
!cmd/sparrow/persist*
|
||||
|
||||
# GC and delete paths.
|
||||
!cmd/sw-block/chunk_gc*
|
||||
!cmd/sw-block/chunk_volume_delete*
|
||||
!core/lifecycle/deletion_reservations*
|
||||
!core/ops/delete_safety_contract*
|
||||
!*/gc[_.]*
|
||||
!*_gc[_.]*
|
||||
|
||||
# Lease, epoch, claim, admission, GC, delete or format code (tests included)
|
||||
# wherever it lives, by file name.
|
||||
!*/lease*.go
|
||||
!*_lease*.go
|
||||
!*epoch*.go
|
||||
!*fenc*.go
|
||||
!*claim*.go
|
||||
!*admission*.go
|
||||
!*/gc_*.go
|
||||
!*_gc.go
|
||||
!*_gc_*.go
|
||||
!*delet*.go
|
||||
!*purge*.go
|
||||
!*persist*.go
|
||||
!*journal*.go
|
||||
!*format*.go
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
# Seconds each process-level test took on the CI runner (main 032eb197, run 45972669823),
|
||||
# used only to balance the parallel shards (.github/scripts/shard-named-tests.py). A test
|
||||
# missing here counts as 60 s; a stale time unbalances the shards but never skips a test.
|
||||
TestAVolumeThatServedBeforeItsFirstGateTickFailsOver 31.4
|
||||
TestClaimedTargetAfterAMasterRestartIsNotNeverStarted 18.7
|
||||
TestCutoverCreateFromSnapshot 25.4
|
||||
TestCutoverWriteSnapshotKillRestartRestore 34.1
|
||||
TestDoubleFailoverReadsBackEveryAckedWrite 10.2
|
||||
TestFencingRoundHealContinuesThePrimary 13.4
|
||||
TestFencingRoundSurvivorRejoins 17.0
|
||||
TestKnownZeroAcceptance 27.1
|
||||
TestKnownZeroTargetReservesBeforeHarness 0.0
|
||||
TestNeverAttachedRestoreTargetIsDeletable 16.5
|
||||
TestNeverStartedDeleteAfterAMasterRestart 166.8
|
||||
TestNeverStartedDeleteFencesALateStart 53.6
|
||||
TestNeverStartedDeleteRacesAStart 42.4
|
||||
TestNeverStartedLineDeleteFencesALateStart 240.3
|
||||
TestNeverStartedLineDeleteRacesAStart 458.9
|
||||
TestNeverStartedLineIsDeletableWithoutARevoke 335.1
|
||||
TestProcedureDeleteAVolume 79.1
|
||||
TestProcedureDeleteAfterASignalStop 116.1
|
||||
TestProcedureForcedMoveWithTheOldHostReturning 100.2
|
||||
TestProcedureMasterKilledAfterMoveBeforeTargetStarts 23.2
|
||||
TestProcedureMasterUnreachableFencesBeforeForcedMove 159.4
|
||||
TestProcedurePlannedHandoffToAnotherHost 16.8
|
||||
TestProcedureReturnAfterALapsedLease 81.4
|
||||
TestProcedureRevokeWithoutACKThenForcedMove 79.6
|
||||
TestProcedureSameHostCrashRestartInsideTheLease 17.5
|
||||
TestProcedureSameHostRestartInsideTheLease 17.5
|
||||
TestProcedureStartInsideTheBarrierWaitIsReGranted 80.0
|
||||
TestSnapshotLadderA1OneBlockOneSnapshot 18.8
|
||||
TestSnapshotLadderA2IncrementalSnapshot 20.9
|
||||
TestSnapshotLadderA3WritesDuringASnapshot 26.1
|
||||
TestSnapshotLadderA4ContentReturnsToAnOldValue 23.6
|
||||
TestSnapshotLadderB1SnapshotQuery 19.1
|
||||
TestSnapshotLadderC1FullRestore 18.8
|
||||
TestSnapshotLadderC2IncrementalRestore 21.3
|
||||
TestSnapshotLadderC3KilledHydrating 35.6
|
||||
TestSnapshotLadderC3RestoreThenWriteThenSnapshotIt 21.3
|
||||
TestSnapshotLadderD1DeleteTheNewest 21.4
|
||||
TestSnapshotLadderD2DeleteAMiddleOne 23.9
|
||||
TestSnapshotLadderD3DeleteWhenContentRecurs 21.3
|
||||
TestSnapshotLadderD4DeleteAllButOneThenCollect 19.4
|
||||
TestSnapshotLadderE1CrashDuringASnapshot 31.1
|
||||
TestSnapshotLadderF1VolumesOneHost 528.4
|
||||
TestStandaloneCleanMoveWithoutTheACKIsRefused 16.6
|
||||
TestStandalonePlannedHandoffToTheSameHost 17.7
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
# Process-level tests (cmd/blockvolume, build tags subprocess and
|
||||
# chunkstore_integration, linux) named as release evidence. CI runs them
|
||||
# against real blockmaster, blockvolume and sw-block binaries and the pinned
|
||||
# SeaweedFS release. Every name here must PASS: a skip, a failure or a test
|
||||
# that never ran fails the job (.github/scripts/required-tests-check.py).
|
||||
#
|
||||
# Not here, and why: the three headroom tests (TestHeadroom*), the power-loss
|
||||
# replay (TestPowerLossReplayChunkVolume, a dm-log-writes harness) and the
|
||||
# tests tagged systemd_integration need root, a loop or mapped device, or
|
||||
# systemd; the CI runners have none of these. They run as root outside CI,
|
||||
# and their counts are recorded there.
|
||||
|
||||
# Known-zero acceptance, small shape in CI (KZ_RUN=1 KZ_SIZE=1G, user-space
|
||||
# client, no device); the 1 TiB run is lab only.
|
||||
TestKnownZeroAcceptance
|
||||
TestKnownZeroTargetReservesBeforeHarness
|
||||
|
||||
# The procedure gate, delete and master loss.
|
||||
TestProcedurePlannedHandoffToAnotherHost
|
||||
TestProcedureSameHostRestartInsideTheLease
|
||||
TestProcedureSameHostCrashRestartInsideTheLease
|
||||
TestProcedureReturnAfterALapsedLease
|
||||
TestProcedureForcedMoveWithTheOldHostReturning
|
||||
TestProcedureRevokeWithoutACKThenForcedMove
|
||||
TestProcedureStartInsideTheBarrierWaitIsReGranted
|
||||
TestProcedureDeleteAVolume
|
||||
TestProcedureDeleteAfterASignalStop
|
||||
TestProcedureMasterKilledAfterMoveBeforeTargetStarts
|
||||
TestProcedureMasterUnreachableFencesBeforeForcedMove
|
||||
TestStandalonePlannedHandoffToTheSameHost
|
||||
TestStandaloneCleanMoveWithoutTheACKIsRefused
|
||||
|
||||
# Failover and the fencing round.
|
||||
TestDoubleFailoverReadsBackEveryAckedWrite
|
||||
TestFencingRoundHealContinuesThePrimary
|
||||
TestFencingRoundSurvivorRejoins
|
||||
TestAVolumeThatServedBeforeItsFirstGateTickFailsOver
|
||||
|
||||
# Many volumes on one host (F1_RUN=1).
|
||||
TestSnapshotLadderF1VolumesOneHost
|
||||
|
||||
# Never-started delete.
|
||||
TestNeverAttachedRestoreTargetIsDeletable
|
||||
TestNeverStartedDeleteFencesALateStart
|
||||
TestNeverStartedDeleteRacesAStart
|
||||
TestNeverStartedLineIsDeletableWithoutARevoke
|
||||
TestNeverStartedLineDeleteFencesALateStart
|
||||
TestNeverStartedLineDeleteRacesAStart
|
||||
TestNeverStartedDeleteAfterAMasterRestart
|
||||
TestClaimedTargetAfterAMasterRestartIsNotNeverStarted
|
||||
|
||||
# Snapshot ladders and cutover.
|
||||
TestSnapshotLadderA1OneBlockOneSnapshot
|
||||
TestSnapshotLadderA2IncrementalSnapshot
|
||||
TestSnapshotLadderA3WritesDuringASnapshot
|
||||
TestSnapshotLadderA4ContentReturnsToAnOldValue
|
||||
TestSnapshotLadderB1SnapshotQuery
|
||||
TestSnapshotLadderC1FullRestore
|
||||
TestSnapshotLadderC2IncrementalRestore
|
||||
TestSnapshotLadderC3RestoreThenWriteThenSnapshotIt
|
||||
TestSnapshotLadderC3KilledHydrating
|
||||
TestSnapshotLadderD1DeleteTheNewest
|
||||
TestSnapshotLadderD2DeleteAMiddleOne
|
||||
TestSnapshotLadderD3DeleteWhenContentRecurs
|
||||
TestSnapshotLadderD4DeleteAllButOneThenCollect
|
||||
TestSnapshotLadderE1CrashDuringASnapshot
|
||||
TestCutoverCreateFromSnapshot
|
||||
TestCutoverWriteSnapshotKillRestartRestore
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
Feature: <roadmap item>
|
||||
Machine/INV: <kind> / <INV rows>
|
||||
Model: <Module.Action; OtherModule.Action, or NONE (pure function of Module) for mapped files>
|
||||
Red-first: <commit + test that failed on the base, or NONE: reason>
|
||||
Simplest: <the simplest version, and what this PR did not add>
|
||||
|
||||
<!--
|
||||
The spec-trace check reads the lines above.
|
||||
|
||||
Machine/INV starts with exactly one kind:
|
||||
IMPL <machine>.<transition> implements an existing transition; no new state, flag or reason.
|
||||
FIX <INV-ID> the red test is that invariant failing on the base.
|
||||
CHANGE <machine> new or changed states, transitions or invariants; the automaton
|
||||
text and rows land with or before the code.
|
||||
A fix without an invariant, or a guard term without a transition, is a CHANGE.
|
||||
|
||||
A PR that changes no behaviour uses one of these instead, checked against its files:
|
||||
DOCS docs (not docs/spec), tests, and Go whose tokens are unchanged
|
||||
(comments only; directive comments count as code).
|
||||
TEST only tests, testdata and test helpers.
|
||||
CI only .github/ (scripts/ ships install and deploy scripts).
|
||||
DOCS may still change contract text (docs/design/invariants.md): the reviewer is the gate for that.
|
||||
|
||||
NONE needs a reason of at least 10 characters. Simplest is required when the PR
|
||||
changes non-test Go under core/ or cmd/.
|
||||
|
||||
Mapped files in .github/model-code-trace.tsv require a listed Module.Action
|
||||
or NONE (pure function of Module). Separate citations for multiple modules
|
||||
with semicolons. Unmapped files retain the existing Model trace policy.
|
||||
-->
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tests docs-only-scope.sh against real commits, and that test.yml applies it
|
||||
# only to the process suite of a pull request. Any failure exits nonzero.
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
scope="$here/docs-only-scope.sh"
|
||||
workflow="$here/../workflows/test.yml"
|
||||
fail=0
|
||||
check() { # name want got
|
||||
if [ "$2" = "$3" ]; then echo "ok $1"; else echo "FAIL $1: want [$2], got [$3]"; fail=1; fi
|
||||
}
|
||||
repo=$(mktemp -d)
|
||||
trap 'rm -rf "$repo"' EXIT
|
||||
cd "$repo"
|
||||
git init -q
|
||||
git config user.email t@example.invalid
|
||||
git config user.name t
|
||||
git config core.autocrlf false
|
||||
mkdir -p docs cmd
|
||||
echo a >docs/a.md
|
||||
echo r >README.md
|
||||
echo g >cmd/main.go
|
||||
git add -A
|
||||
git commit -qm base
|
||||
base=$(git rev-parse HEAD)
|
||||
case_of() { # name want: commit the current tree, classify against base, reset
|
||||
git add -A
|
||||
git commit -qm "$1" --allow-empty
|
||||
check "$1" "$2" "$(bash "$scope" "$base" HEAD)"
|
||||
git reset -q --hard "$base"
|
||||
}
|
||||
echo b >docs/b.md; echo a2 >docs/a.md
|
||||
case_of "two docs files" "docs_only 2"
|
||||
echo b >docs/b.md; echo t >cmd/x_test.go
|
||||
case_of "docs and a test file" "run 2 cmd/x_test.go"
|
||||
case_of "no file changed" "run 0"
|
||||
mkdir -p docs-old; echo x >docs-old/x.md
|
||||
case_of "a docs-like prefix" "run 1 docs-old/x.md"
|
||||
echo r2 >README.md
|
||||
case_of "README outside docs" "run 1 README.md"
|
||||
git mv docs/a.md cmd/a.md
|
||||
case_of "a move out of docs" "run 2 cmd/a.md"
|
||||
git rm -q docs/a.md
|
||||
case_of "a docs deletion" "docs_only 1"
|
||||
for i in $(seq 1 20000); do printf 'x\n' >"docs/f$i.md"; done
|
||||
echo late >zz-late.go
|
||||
case_of "20000 docs files and one other, listed last" "run 20001 zz-late.go"
|
||||
if out=$(bash "$scope" "$base" no-such-revision 2>/dev/null); then
|
||||
check "an unknown revision is an error" "nonzero exit" "exit 0: $out"
|
||||
else
|
||||
check "an unknown revision is an error" "nonzero exit" "nonzero exit"
|
||||
fi
|
||||
# test.yml: the scope step runs only for a pull request's process suite, and
|
||||
# every process step it can skip names its output.
|
||||
step=$(grep -n -A3 'name: Docs-only pull request' "$workflow" | grep "if:" || true)
|
||||
check "scope step condition" "1" "$(printf '%s' "$step" | grep -c "matrix.suite == 'process' && github.event_name == 'pull_request'" || true)"
|
||||
check "process steps gated" "4" "$(grep -c "if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'" "$workflow" || true)"
|
||||
check "no ungated process step" "0" "$(grep -c "if: matrix.suite == 'process'$" "$workflow" || true)"
|
||||
exit "$fail"
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# docs-only-scope.sh BASE HEAD: classifies the files changed between BASE and
|
||||
# HEAD for the process-level suite. It prints one line:
|
||||
# "docs_only N" every one of the N changed files is under docs/
|
||||
# "run N [FIRST-OTHER]" no file changed, or at least one is elsewhere
|
||||
# and exits 0. Any error (git fails, the list cannot be read) exits nonzero,
|
||||
# and the caller then runs the tests: an error never selects docs_only.
|
||||
#
|
||||
# The NUL-delimited list is written to a file first and read to its end, so
|
||||
# no pipe can stop early and leave a writer's error looking like an answer.
|
||||
set -euo pipefail
|
||||
[ "$#" -eq 2 ] || { echo "usage: docs-only-scope.sh BASE HEAD" >&2; exit 2; }
|
||||
list=$(mktemp)
|
||||
trap 'rm -f "$list"' EXIT
|
||||
if ! git diff --name-only --no-renames -z "$1" "$2" >"$list"; then
|
||||
echo "docs-only-scope: git diff $1 $2 failed" >&2
|
||||
exit 2
|
||||
fi
|
||||
n=0
|
||||
other=""
|
||||
while IFS= read -r -d '' f; do
|
||||
n=$((n + 1))
|
||||
case $f in
|
||||
docs/*) ;;
|
||||
*) [ -n "$other" ] || other=$f ;;
|
||||
esac
|
||||
done <"$list"
|
||||
if [ "$n" -gt 0 ] && [ -z "$other" ]; then
|
||||
echo "docs_only $n"
|
||||
else
|
||||
echo "run $n${other:+ $other}"
|
||||
fi
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
SCRIPT = Path(__file__).with_name("model-trace-check.py")
|
||||
spec = importlib.util.spec_from_file_location("model_trace", SCRIPT)
|
||||
checker = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(checker)
|
||||
|
||||
|
||||
class ModelTraceTests(unittest.TestCase):
|
||||
mapping = {"core/a.go": {"EngineAdapter.Begin", "EngineAdapter.NoOpCut"}, "core/b.go": {"MoveAdmission.Revoke"}}
|
||||
|
||||
def test_each_mapped_file_needs_its_own_citation(self):
|
||||
problems = checker.check("EngineAdapter.Begin", ["core/a.go", "core/b.go"], self.mapping)
|
||||
self.assertEqual(len(problems), 1)
|
||||
self.assertIn("core/b.go", problems[0])
|
||||
self.assertEqual(checker.check("EngineAdapter.Begin; MoveAdmission.Revoke", list(self.mapping), self.mapping), [])
|
||||
|
||||
def test_mapped_file_refuses_free_text_wrong_actions_and_lookalikes(self):
|
||||
for model in ("exhausted", "EngineAdapter.Unknown", "Other.Begin", "EngineAdapter.BeginExtra",
|
||||
"docs/EngineAdapter.Begin", "example: EngineAdapter.Begin", "NONE: no state changes",
|
||||
"NONE (pure function of Other)", "NONE (pure function of EngineAdapter) extra"):
|
||||
with self.subTest(model=model):
|
||||
self.assertEqual(len(checker.check(model, ["core/a.go"], self.mapping)), 1)
|
||||
|
||||
def test_pure_function_exception_is_module_specific(self):
|
||||
self.assertEqual(checker.check("NONE (pure function of EngineAdapter)", ["core/a.go"], self.mapping), [])
|
||||
self.assertEqual(len(checker.check("NONE (pure function of EngineAdapter)", ["core/b.go"], self.mapping)), 1)
|
||||
|
||||
def test_unmapped_files_keep_existing_policy(self):
|
||||
self.assertEqual(checker.check("existing prose", ["docs/a.md", "core/a.go.bak"], self.mapping), [])
|
||||
|
||||
def test_repository_map_covers_claimed_head_create(self):
|
||||
mapping = checker.read_mapping(SCRIPT.parent.parent / "model-code-trace.tsv")
|
||||
paths = ["core/frontend/chunkstore/layout/create.go"]
|
||||
self.assertEqual(checker.check("VolumeCreate.Claim", paths, mapping), [])
|
||||
self.assertEqual(len(checker.check("VolumeCreate.Unknown", paths, mapping)), 1)
|
||||
|
||||
def test_repository_map_covers_the_replica_receiver(self):
|
||||
mapping = checker.read_mapping(SCRIPT.parent.parent / "model-code-trace.tsv")
|
||||
paths = ["core/transport/replica.go"]
|
||||
self.assertEqual(checker.check("ReplicationPeer.Ship", paths, mapping), [])
|
||||
self.assertEqual(len(checker.check("VolumeCreate.Claim", paths, mapping)), 1)
|
||||
|
||||
def test_cli_checks_nul_paths_and_model_citations(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
mapping = Path(tmp) / "map.tsv"
|
||||
mapping.write_text("# exact paths\ncore/a.go\tEngineAdapter.Begin\n", encoding="utf-8")
|
||||
def run(model, paths):
|
||||
return subprocess.run([sys.executable, str(SCRIPT), str(mapping), model],
|
||||
input=paths, capture_output=True).returncode
|
||||
self.assertEqual(run("EngineAdapter.Begin", b"core/a.go\0"), 0)
|
||||
self.assertEqual(run("unstructured prose", b"core/a.go\0"), 1)
|
||||
self.assertEqual(run("EngineAdapter.Begin", b"core/a.go"), 2)
|
||||
self.assertEqual(run("EngineAdapter.Begin", b"\0"), 2)
|
||||
|
||||
def test_mapping_refuses_missing_empty_and_malformed_data(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
mapping = Path(tmp) / "map.tsv"
|
||||
with self.assertRaises(OSError):
|
||||
checker.read_mapping(mapping)
|
||||
for content in ("# not populated\n", "core/a.go EngineAdapter.Begin\n",
|
||||
"../core/a.go\tEngineAdapter.Begin\n", "core//a.go\tEngineAdapter.Begin\n",
|
||||
"core/a.go\tKernel\n", "core/a.go\tEngineAdapter.Begin extra\n"):
|
||||
with self.subTest(content=content):
|
||||
mapping.write_text(content, encoding="utf-8")
|
||||
with self.assertRaises(ValueError):
|
||||
checker.read_mapping(mapping)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check Model citations against a base-owned, exact-path TSV mapping."""
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path, PurePosixPath
|
||||
|
||||
IDENT = r"[A-Za-z_][A-Za-z0-9_]*"
|
||||
ACTION = re.compile(rf"{IDENT}\.{IDENT}")
|
||||
PURE = re.compile(rf"NONE \(pure function of ({IDENT})\)")
|
||||
|
||||
|
||||
def read_mapping(path):
|
||||
mapping = {}
|
||||
for number, line in enumerate(Path(path).read_text(encoding="utf-8").splitlines(), 1):
|
||||
if not line.strip() or line.startswith("#"):
|
||||
continue
|
||||
columns = line.split("\t")
|
||||
if len(columns) != 2:
|
||||
raise ValueError(f"mapping line {number}: expected PATH<TAB>Module.Action")
|
||||
file, action = columns
|
||||
parts = PurePosixPath(file).parts
|
||||
if (not file or file.startswith("/") or "\\" in file or ":" in file
|
||||
or any(part in (".", "..") for part in file.split("/"))
|
||||
or str(PurePosixPath(file)) != file or not parts):
|
||||
raise ValueError(f"mapping line {number}: expected a repository-relative exact path")
|
||||
if not ACTION.fullmatch(action):
|
||||
raise ValueError(f"mapping line {number}: invalid Module.Action")
|
||||
mapping.setdefault(file, set()).add(action)
|
||||
if not mapping:
|
||||
raise ValueError("model mapping is empty; populate it before enabling this gate")
|
||||
return mapping
|
||||
|
||||
|
||||
def check(model, paths, mapping):
|
||||
# A list permits one citation for each mapped file in a multi-module PR.
|
||||
# Full matches prevent prose, quoted examples, or a prefixed NONE excuse
|
||||
# from accidentally satisfying a mapped-file obligation.
|
||||
citations = {part.strip() for part in model.split(";")}
|
||||
actions = {part for part in citations if ACTION.fullmatch(part)}
|
||||
pure = {match.group(1) for part in citations if (match := PURE.fullmatch(part))}
|
||||
problems = []
|
||||
for file in sorted(set(paths)):
|
||||
expected = mapping.get(file)
|
||||
if expected and not (actions & expected or any(a.split(".")[0] in pure for a in expected)):
|
||||
names = "; ".join(sorted(expected))
|
||||
problems.append(f"{file}: Model must cite {names} or NONE (pure function of its module)")
|
||||
return problems
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
print("usage: model-trace-check.py MAPPING MODEL < nul-separated-paths", file=sys.stderr)
|
||||
return 2
|
||||
try:
|
||||
mapping = read_mapping(sys.argv[1])
|
||||
raw = sys.stdin.buffer.read()
|
||||
if raw and not raw.endswith(b"\0"):
|
||||
raise ValueError("unterminated changed path")
|
||||
paths = [p.decode("utf-8") for p in raw.split(b"\0")[:-1]]
|
||||
if any(not p for p in paths):
|
||||
raise ValueError("empty changed path")
|
||||
problems = check(sys.argv[2], paths, mapping)
|
||||
except (OSError, UnicodeError, ValueError) as error:
|
||||
print(f"spec-trace: {error}", file=sys.stderr)
|
||||
return 2
|
||||
for problem in problems:
|
||||
print(f"spec-trace: {problem}")
|
||||
return int(bool(problems))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: post-merge-review-changed.sh BASE HEAD
|
||||
#
|
||||
# Writes what a PR changes (BASE...HEAD) as NUL-separated STATUS, PATH pairs,
|
||||
# unquoted, so any byte in a name reaches the check as itself. --no-renames
|
||||
# reports a move as a delete of the old name and an add of the new one.
|
||||
set -euo pipefail
|
||||
base=${1:?usage: post-merge-review-changed.sh BASE HEAD}
|
||||
head=${2:?usage: post-merge-review-changed.sh BASE HEAD}
|
||||
exec git diff -z --name-status --no-renames "$base...$head"
|
||||
@@ -1,197 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Self-test of the post-merge-review check: the matcher against the checked-in
|
||||
# allow list, the real Git diff it consumes, and the workflow's triggers.
|
||||
set -euo pipefail
|
||||
shopt -s inherit_errexit
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
check=$here/post-merge-review-check.sh
|
||||
changed=$here/post-merge-review-changed.sh
|
||||
allow=$here/../post-merge-review-allow.txt
|
||||
workflow=$here/../workflows/post-merge-review.yml
|
||||
fail=0
|
||||
|
||||
expect_changes() { # expect_changes WANT_EXIT NAME [STATUS PATH]...
|
||||
local want=$1 name=$2
|
||||
shift 2
|
||||
local got=0
|
||||
if (($#)); then printf '%s\0' "$@"; fi | bash "$check" "$allow" >/dev/null || got=$?
|
||||
if [[ $got != "$want" ]]; then
|
||||
echo "FAIL $name: exit $got, want $want"
|
||||
fail=1
|
||||
fi
|
||||
}
|
||||
expect() { # expect WANT_EXIT NAME PATH... : each path modified
|
||||
local want=$1 name=$2 p
|
||||
shift 2
|
||||
local args=()
|
||||
for p in "$@"; do args+=(M "$p"); done
|
||||
expect_changes "$want" "$name" ${args[@]+"${args[@]}"}
|
||||
}
|
||||
|
||||
# Allowed.
|
||||
expect 0 "docs" docs/README.md README.md cmd/sw-block/NOTES.md
|
||||
expect 0 "testops docs" internal/testops/registry-overview.md
|
||||
expect 0 "test outside denied dirs" core/ops/cleanup_projection_test.go cmd/blockmaster/topology_test.go
|
||||
expect 0 "named status files" core/host/master/observation_service.go core/host/volume/memory_status.go
|
||||
expect 0 "release is not lease" cmd/sw-block/release_test.go
|
||||
expect 0 "names with a space, tab or newline" "docs/a b.md" $'docs/a\tb.md' $'docs/a\nb.md'
|
||||
expect 0 "no paths"
|
||||
expect_changes 0 "test added" A cmd/foo/new_test.go
|
||||
expect_changes 0 "doc deleted" D docs/old.md
|
||||
|
||||
# Denied by default: not on the allow list.
|
||||
expect 1 "new file anywhere" core/newpkg/decide.go
|
||||
expect 1 "decision code by name" core/host/master/product_loop.go core/lifecycle/planner.go
|
||||
expect 1 "go.mod" go.mod
|
||||
expect 1 "go.sum" go.sum
|
||||
expect 1 "status-like but not named" core/ops/operator_status_controller.go
|
||||
expect 1 "status server: registers a mutating endpoint" core/host/volume/status_server.go
|
||||
|
||||
# Denied explicitly, even where an allow line matches.
|
||||
expect 1 "storage" core/storage/walstore.go
|
||||
expect 1 "unicode name in storage" $'core/storage/\xc3\xa9_test.go'
|
||||
expect 1 "durable test file" core/frontend/durable/provider_chunk_detach_abort_test.go
|
||||
expect 1 "doc inside a denied dir" core/storage/NOTES.md
|
||||
expect 1 "authority test" core/authority/lease_stats_test.go
|
||||
expect 1 "master workspace test" core/host/master/workspace_binding_review_test.go
|
||||
expect 1 "volume workspace runtime" core/host/volume/workspace_runtime.go
|
||||
expect 1 "volume workspace runtime test" core/host/volume/workspace_runtime_test.go
|
||||
expect 1 "proto" core/rpc/proto/control.proto
|
||||
expect 1 "lease test by name" cmd/foo/lease_table_test.go
|
||||
expect 1 "gc test by name" cmd/sw-block/chunk_gc_test.go
|
||||
expect 1 "the check itself" .github/post-merge-review-allow.txt
|
||||
expect 1 "a workflow" .github/workflows/test.yml
|
||||
expect 1 "PR template under .github" .github/pull_request_template.md
|
||||
expect 1 "mixed: allowed plus denied" docs/README.md core/storage/walstore.go
|
||||
expect 1 "mixed: allowed plus unlisted" docs/README.md go.mod
|
||||
|
||||
# Persisted-format, GC and delete paths stay denied, tests included.
|
||||
expect 1 "lifecycle store test" core/lifecycle/store_test.go
|
||||
expect 1 "journal isolation test" core/host/master/journal_isolation_test.go
|
||||
expect 1 "sparrow persist test" cmd/sparrow/persist_sidecar_test.go
|
||||
expect 1 "chunk volume delete test" cmd/sw-block/chunk_volume_delete_test.go
|
||||
expect 1 "deletion reservations test" core/lifecycle/deletion_reservations_test.go
|
||||
expect 1 "delete safety contract test" core/ops/delete_safety_contract_test.go
|
||||
expect 1 "gc doc" docs/spec/cfg/RED_gc_ageonly.cfg
|
||||
|
||||
# The test gates: engine, CLI and gate definitions (and their tests).
|
||||
expect 1 "testops engine" internal/testops/control.go
|
||||
expect 1 "testops engine test" internal/testops/control_test.go
|
||||
expect 1 "testops gate definition" internal/testops/registry/iscsi-p2-os-smoke.json
|
||||
expect 1 "testops CLI" cmd/sw-testops/main.go
|
||||
|
||||
# A test may be added or modified, never deleted or replaced.
|
||||
expect_changes 1 "test deleted" D cmd/foo/guard_test.go
|
||||
expect_changes 1 "test type changed" T cmd/foo/guard_test.go
|
||||
expect_changes 1 "test moved (delete plus add)" D cmd/foo/guard_test.go A cmd/foo/renamed_test.go
|
||||
|
||||
# A malformed change list or a missing or empty allow list fails closed.
|
||||
malformed() { # malformed NAME PRINTF-FORMAT
|
||||
local got=0
|
||||
printf "$2" | bash "$check" "$allow" >/dev/null 2>&1 || got=$?
|
||||
[[ $got == 2 ]] || { echo "FAIL malformed list, $1: exit $got, want 2"; fail=1; }
|
||||
}
|
||||
malformed "status without a path" 'M\0'
|
||||
malformed "bare unterminated status" 'M'
|
||||
malformed "trailing partial status after a valid pair" 'M\0docs/x.md\0D'
|
||||
malformed "unterminated path" 'M\0docs/x.md'
|
||||
malformed "unknown status" 'BOGUS\0docs/x.md\0'
|
||||
malformed "rename status (renames are off)" 'R100\0docs/x.md\0'
|
||||
malformed "empty status" '\0docs/x.md\0'
|
||||
malformed "empty path" 'M\0\0'
|
||||
empty=$(mktemp)
|
||||
for bad in "$empty" "/nonexistent/post-merge-review-allow.txt"; do
|
||||
got=0
|
||||
printf 'M\0docs/README.md\0' | bash "$check" "$bad" >/dev/null 2>&1 || got=$?
|
||||
[[ $got == 2 ]] || { echo "FAIL allow list $bad: exit $got, want 2"; fail=1; }
|
||||
done
|
||||
rm -f "$empty"
|
||||
|
||||
# A list whose last line has no newline keeps that line (here a denial).
|
||||
unterminated=$(mktemp)
|
||||
printf '*_test.go\n!core/workspace/*' >"$unterminated"
|
||||
got=0
|
||||
printf 'M\0core/workspace/orch_test.go\0' | bash "$check" "$unterminated" >/dev/null 2>&1 || got=$?
|
||||
[[ $got == 1 ]] || { echo "FAIL allow list with an unterminated last line: exit $got, want 1"; fail=1; }
|
||||
got=0
|
||||
printf 'M\0cmd/foo/a_test.go\0' | bash "$check" "$unterminated" >/dev/null 2>&1 || got=$?
|
||||
[[ $got == 0 ]] || { echo "FAIL allow list with an unterminated last line, allowed path: exit $got, want 0"; fail=1; }
|
||||
rm -f "$unterminated"
|
||||
|
||||
# Real Git: names that git quotes in its default output, a rename out of a
|
||||
# denied directory, a retarget onto a base that differs, and test deletes.
|
||||
repo=$(mktemp -d)
|
||||
trap 'rm -rf "$repo" "${changes:-}"' EXIT
|
||||
g() { git -C "$repo" -c user.name=t -c user.email=t@t -c core.quotePath=true -c core.protectNTFS=false "$@"; }
|
||||
blob=
|
||||
commit() { # commit PARENT PATH... : PARENT's tree plus PATHs (-PATH removes)
|
||||
local parent=$1
|
||||
shift
|
||||
g read-tree "$parent"
|
||||
local p
|
||||
for p in "$@"; do
|
||||
if [[ $p == -* ]]; then
|
||||
g update-index --force-remove -- "${p#-}"
|
||||
else
|
||||
g update-index --add --cacheinfo "100644,$blob,$p"
|
||||
fi
|
||||
done
|
||||
g commit-tree "$(g write-tree)" -p "$parent" -m c
|
||||
}
|
||||
changes=$(mktemp)
|
||||
expect_diff() { # expect_diff WANT_EXIT NAME BASE HEAD
|
||||
local got=0
|
||||
if ! (cd "$repo" && bash "$changed" "$3" "$4") >"$changes"; then
|
||||
echo "FAIL $2: listing the changes failed"
|
||||
fail=1
|
||||
return
|
||||
fi
|
||||
bash "$check" "$allow" <"$changes" >/dev/null || got=$?
|
||||
if [[ $got != "$1" ]]; then
|
||||
echo "FAIL $2: exit $got, want $1"
|
||||
fail=1
|
||||
fi
|
||||
}
|
||||
g init -q
|
||||
blob=$(printf x | g hash-object -w --stdin)
|
||||
g read-tree --empty
|
||||
root=$(g commit-tree "$(g write-tree)" -m root)
|
||||
main=$(commit "$root" core/storage/old.go docs/x.md cmd/foo/guard_test.go)
|
||||
unicode=$(commit "$main" $'core/storage/\xc3\xa9_test.go')
|
||||
oddnames=$(commit "$main" $'docs/tab\there.md' $'docs/new\nline.md' $'docs/\xc3\xa9.md')
|
||||
moved=$(commit "$main" -core/storage/old.go docs/moved.md)
|
||||
parent=$(commit "$main" core/storage/parent.go)
|
||||
stacked=$(commit "$parent" docs/child.md)
|
||||
later=$(commit "$main" core/storage/later.go)
|
||||
testadd=$(commit "$main" cmd/foo/extra_test.go)
|
||||
testdel=$(commit "$main" -cmd/foo/guard_test.go)
|
||||
testmove=$(commit "$main" -cmd/foo/guard_test.go cmd/foo/renamed_test.go)
|
||||
n=$( (cd "$repo" && bash "$changed" "$main" "$oddnames") | tr -cd '\000' | wc -c | tr -d ' ')
|
||||
[[ $n == 6 ]] || { echo "FAIL fixture: $n NULs for 3 odd names, want 6"; fail=1; }
|
||||
if ! (cd "$repo" && git diff --name-only "$main...$unicode") | grep -q '^"'; then
|
||||
echo "FAIL fixture: expected git to quote the unicode name in its default output"
|
||||
fail=1
|
||||
fi
|
||||
expect_diff 1 "git: unicode test file in storage" "$main" "$unicode"
|
||||
expect_diff 0 "git: tab, newline and unicode names in docs" "$main" "$oddnames"
|
||||
expect_diff 1 "git: moved out of storage into docs" "$main" "$moved"
|
||||
expect_diff 0 "git: stacked PR against its parent" "$parent" "$stacked"
|
||||
expect_diff 1 "git: the same PR retargeted to main" "$main" "$stacked"
|
||||
expect_diff 0 "git: the base moved on with denied changes; the PR did not" "$later" "$oddnames"
|
||||
expect_diff 0 "git: a test added" "$main" "$testadd"
|
||||
expect_diff 1 "git: a test deleted" "$main" "$testdel"
|
||||
expect_diff 1 "git: a test moved" "$main" "$testmove"
|
||||
if (cd "$repo" && bash "$changed" 0000000000000000000000000000000000000001 "$main") >/dev/null 2>&1; then
|
||||
echo "FAIL git: listing against an unknown base succeeded"
|
||||
fail=1
|
||||
fi
|
||||
|
||||
# The workflow reruns on every change that can change the verdict, including
|
||||
# a retarget (edited).
|
||||
types=$(sed -n 's/^ *types: *\[\(.*\)\].*/\1/p' "$workflow" | tr -d ' ')
|
||||
for want in opened synchronize reopened labeled unlabeled edited; do
|
||||
[[ ",$types," == *",$want,"* ]] || { echo "FAIL workflow does not run on $want"; fail=1; }
|
||||
done
|
||||
|
||||
if ((fail)); then exit 1; fi
|
||||
echo "post-merge-review check: self-test ok"
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: post-merge-review-check.sh ALLOW_FILE < changes
|
||||
#
|
||||
# changes are NUL-separated STATUS, PATH pairs (post-merge-review-changed.sh).
|
||||
# A path passes only if it matches an allow pattern and no "!" pattern, and
|
||||
# a test file may be added or modified but not deleted (a move deletes its
|
||||
# old name). Prints every change that does not pass and exits 1 if there is
|
||||
# one; exits 0 if all pass, 2 on a usage error, a malformed change or a
|
||||
# missing or empty allow list.
|
||||
set -euo pipefail
|
||||
|
||||
allow_file=${1:?usage: post-merge-review-check.sh ALLOW_FILE < changes}
|
||||
if [[ ! -f $allow_file ]]; then
|
||||
echo "post-merge-review: allow list $allow_file missing" >&2
|
||||
exit 2
|
||||
fi
|
||||
allow=()
|
||||
deny=()
|
||||
# A last line without a newline is read too: dropping it could drop a "!".
|
||||
while IFS= read -r line || [[ -n $line ]]; do
|
||||
line=${line%%#*}
|
||||
line=${line%"${line##*[![:space:]]}"}
|
||||
line=${line#"${line%%[![:space:]]*}"}
|
||||
[[ -n $line ]] || continue
|
||||
if [[ $line == '!'* ]]; then
|
||||
deny+=("${line#!}")
|
||||
else
|
||||
allow+=("$line")
|
||||
fi
|
||||
done <"$allow_file"
|
||||
if ((${#allow[@]} == 0)); then
|
||||
echo "post-merge-review: empty allow list $allow_file" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
denied=0
|
||||
checked=0
|
||||
malformed() {
|
||||
echo "post-merge-review: malformed change list: $1" >&2
|
||||
exit 2
|
||||
}
|
||||
while :; do
|
||||
# Every field ends in NUL: a field cut off at the end is malformed, not
|
||||
# skipped, and only the statuses git diff --no-renames writes are known.
|
||||
if ! IFS= read -r -d '' status; then
|
||||
[[ -z $status ]] || malformed "unterminated status ${status@Q}"
|
||||
break
|
||||
fi
|
||||
[[ $status == [ADMT] ]] || malformed "unknown status ${status@Q}"
|
||||
IFS= read -r -d '' path || malformed "status $status without a terminated path"
|
||||
[[ -n $path ]] || malformed "status $status with an empty path"
|
||||
checked=$((checked + 1))
|
||||
why="not on the allow list"
|
||||
for p in "${allow[@]}"; do
|
||||
# Unquoted on the right: a glob, where * also matches /.
|
||||
if [[ $path == $p ]]; then
|
||||
why=""
|
||||
break
|
||||
fi
|
||||
done
|
||||
for p in ${deny[@]+"${deny[@]}"}; do
|
||||
if [[ $path == $p ]]; then
|
||||
why="matches !$p"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# A labelled PR may not delete a test (or turn it into something else).
|
||||
if [[ -z $why && $path == *_test.go && $status != [AM] ]]; then
|
||||
why="test file status $status: only adding or modifying a test is allowed"
|
||||
fi
|
||||
if [[ -n $why ]]; then
|
||||
printf 'DENY %s %q (%s)\n' "$status" "$path" "$why"
|
||||
denied=1
|
||||
fi
|
||||
done
|
||||
echo "post-merge-review: $checked changed path(s) checked against ${#allow[@]} allow and ${#deny[@]} deny pattern(s)"
|
||||
exit "$denied"
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Self-test of public-text-check.sh in a throwaway repository.
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
t=$(mktemp -d); trap 'rm -rf "$t"' EXIT
|
||||
cd "$t"; git init -q .; git config user.email t@example.invalid; git config user.name t
|
||||
echo base > a.txt; git add a.txt; git commit -q -m "base"
|
||||
mb=$(git rev-parse HEAD)
|
||||
: > title; : > body
|
||||
run() { bash "$here/public-text-check.sh" "$@" >out 2>&1; }
|
||||
expect() { # expect RC NAME
|
||||
local want=$1 name=$2 rc=0
|
||||
shift 2
|
||||
run "$@" || rc=$?
|
||||
[ "$rc" = "$want" ] || { echo "public-text-check-test: $name: exit $rc, want $want"; cat out; exit 1; }
|
||||
}
|
||||
echo "plain line" >> a.txt; git commit -q -am "add a plain line"
|
||||
expect 0 "clean change" "$mb" HEAD title body
|
||||
seat="clau""de06"; path="V:/sha""re/x"; nas="share/rd""ma/y"
|
||||
echo "// asked by $seat" >> a.txt; git commit -q -am "comment"
|
||||
expect 1 "seat name in an added line" "$mb" HEAD title body
|
||||
grep -q "a.txt:3" out || { echo "public-text-check-test: hit does not name file and line"; cat out; exit 1; }
|
||||
git reset -q --hard HEAD~1
|
||||
echo "ok" >> a.txt; git commit -q -am "review by $seat"
|
||||
expect 1 "seat name in a commit subject" "$mb" HEAD title body
|
||||
git reset -q --hard HEAD~1
|
||||
echo "see $path" > title; expect 1 "share path in the title" "$mb" HEAD title body; : > title
|
||||
echo "results under $nas" > body; expect 1 "share path in the description" "$mb" HEAD title body; : > body
|
||||
echo "an old line with $seat" >> a.txt; git commit -q -am "old"; mb2=$(git rev-parse HEAD)
|
||||
echo "new clean line" >> a.txt; git commit -q -am "new"
|
||||
expect 0 "an existing line is not this change's" "$mb2" HEAD title body
|
||||
# A file line that begins with "++ " shows in the diff as "+++ ...": an added line, not a header.
|
||||
printf '%s
|
||||
' "++ $seat" >> a.txt; git commit -q -am "plus line"
|
||||
expect 1 "an added line that looks like a diff header" "$mb2" HEAD title body
|
||||
git reset -q --hard HEAD~1
|
||||
bs=$(printf '\')
|
||||
printf '%s
|
||||
' "${bs}${bs}nas${bs}sha""re${bs}rd""ma${bs}z" > title
|
||||
expect 1 "backslash form of the share path in the title" "$mb2" HEAD title body; : > title
|
||||
expect 2 "a missing title file is an error, not clean" "$mb2" HEAD no-such-title body
|
||||
expect 2 "a missing description file is an error, not clean" "$mb2" HEAD title no-such-body
|
||||
expect 2 "an unknown commit is an error, not clean" 0000000000000000000000000000000000000000 HEAD title body
|
||||
# A grep that fails (exit 2) is an error: the check must refuse and never print "clean".
|
||||
mkdir -p fakebin; printf '#!/bin/sh
|
||||
exit 2
|
||||
' > fakebin/grep; chmod +x fakebin/grep
|
||||
rc=0; PATH="$PWD/fakebin:$PATH" bash "$here/public-text-check.sh" "$mb2" HEAD title body >out 2>&1 || rc=$?
|
||||
[ "$rc" = 2 ] || { echo "public-text-check-test: failing grep: exit $rc, want 2"; cat out; exit 1; }
|
||||
if PATH=/usr/bin:/bin grep -q "clean" out; then echo "public-text-check-test: failing grep printed clean"; cat out; exit 1; fi
|
||||
echo "public-text-check-test: ok"
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Refuses internal names in what a pull request makes public: the lines it
|
||||
# adds, its commit messages, its title and its description. This repository is
|
||||
# public; internal seat names and internal file-share paths do not belong in it.
|
||||
#
|
||||
# Usage: public-text-check.sh MERGE_BASE HEAD TITLE_FILE BODY_FILE
|
||||
# Exit 0: clean. Exit 1: at least one hit (each printed). Exit 2: usage.
|
||||
#
|
||||
# The patterns live only here and in this check's own test; both files are
|
||||
# excluded from the scan of added lines.
|
||||
set -euo pipefail
|
||||
[ "$#" -eq 4 ] || { echo "usage: public-text-check.sh MERGE_BASE HEAD TITLE_FILE BODY_FILE" >&2; exit 2; }
|
||||
mb=$1; head=$2; title=$3; body=$4
|
||||
for f in "$title" "$body"; do
|
||||
[ -f "$f" ] && [ -r "$f" ] || { echo "public-text: cannot read $f" >&2; exit 2; }
|
||||
done
|
||||
git rev-parse -q --verify "$mb^{commit}" >/dev/null && git rev-parse -q --verify "$head^{commit}" >/dev/null ||
|
||||
{ echo "public-text: unknown commit $mb or $head" >&2; exit 2; }
|
||||
# match: a grep error fails the check instead of reading as "no hit".
|
||||
match() { local rc=0; grep -E -i -- "$pat" "$@" || rc=$?; [ "$rc" -le 1 ] || { echo "public-text: grep failed ($rc)" >&2; exit 2; }; }
|
||||
pat='(claude|codex)0[0-9]|share[/\]rdma|V:[/\]share|diskstation'
|
||||
out=$(mktemp); trap 'rm -f "$out"' EXIT
|
||||
report() { # report WHERE < matching lines
|
||||
local where=$1 line
|
||||
while IFS= read -r line; do
|
||||
printf 'public-text: %s: %s
|
||||
' "$where" "${line:0:160}" >>"$out"
|
||||
done
|
||||
}
|
||||
# Added lines of the diff, with file and line number.
|
||||
git diff --no-color --no-renames -U0 "$mb" "$head" -- . \
|
||||
':(exclude).github/scripts/public-text-check.sh' ':(exclude).github/scripts/public-text-check-test.sh' |
|
||||
awk '
|
||||
/^diff --git / { hdr = 1; next }
|
||||
hdr && /^\+\+\+ / { f = substr($0, 7); next }
|
||||
/^@@ / { hdr = 0; split($3, a, ","); n = substr(a[1], 2) + 0; next }
|
||||
!hdr && /^\+/ { print f ":" n ": " substr($0, 2); n++ }
|
||||
' | match | report "added line"
|
||||
# Commit messages (subjects and bodies) of the pull request.
|
||||
git log --format='%h %s%n%b' "$mb..$head" | match | report "commit message"
|
||||
match "$title" | report "title"
|
||||
match "$body" | report "description"
|
||||
hits=$(wc -l <"$out" | tr -d ' ')
|
||||
if [ "$hits" -gt 0 ]; then
|
||||
cat "$out"
|
||||
echo "public-text: $hits hit(s). Say what the code or test does instead of who asked for it; keep internal paths out." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "public-text: clean"
|
||||
@@ -1,102 +0,0 @@
|
||||
"""Self-test of required-tests-check.py: event streams against the exit code
|
||||
they must give. A gate that cannot fail is the defect this check exists to
|
||||
prevent, so every way a named test can fail to pass is here."""
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
CHECK = os.path.join(HERE, 'required-tests-check.py')
|
||||
|
||||
|
||||
def ev(action, test=None, elapsed=None):
|
||||
e = {'Action': action, 'Package': 'example/cmd/blockvolume'}
|
||||
if test:
|
||||
e['Test'] = test
|
||||
if elapsed is not None:
|
||||
e['Elapsed'] = elapsed
|
||||
return json.dumps(e)
|
||||
|
||||
|
||||
def ran(test, end='pass', secs=1.5):
|
||||
return [ev('run', test), ev('output', test), ev(end, test, secs)]
|
||||
|
||||
|
||||
def run(names, *streams, status=None):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
nf = os.path.join(d, 'names')
|
||||
with open(nf, 'w', encoding='utf-8') as f:
|
||||
f.write(names)
|
||||
files = []
|
||||
for i, lines in enumerate(streams):
|
||||
p = os.path.join(d, 'events%d' % i)
|
||||
with open(p, 'w', encoding='utf-8') as f:
|
||||
f.write('\n'.join(lines) + '\n')
|
||||
files.append(p)
|
||||
extra = []
|
||||
if status is not None:
|
||||
sf = os.path.join(d, 'status')
|
||||
with open(sf, 'w', encoding='utf-8') as f:
|
||||
f.write(status)
|
||||
extra = ['--status', sf]
|
||||
r = subprocess.run([sys.executable, '-I', CHECK] + extra + [nf] + files, capture_output=True, text=True)
|
||||
return r.returncode, r.stdout + r.stderr
|
||||
|
||||
|
||||
CASES = [
|
||||
# (name, want exit, names file, streams)
|
||||
('every named test passed', 0, 'TestA\nTestB # a comment\n', [ran('TestA') + ran('TestB')]),
|
||||
('passes spread over two streams', 0, 'TestA\nTestB\n', [ran('TestA'), ran('TestB')]),
|
||||
('an unnamed test may fail', 0, 'TestA\n', [ran('TestA') + ran('TestOther', 'fail')]),
|
||||
('a passing subtest does not stand for a skipped parent', 1, 'TestA\n',
|
||||
[[ev('run', 'TestA'), ev('pass', 'TestA/sub', 1), ev('skip', 'TestA', 0)]]),
|
||||
('a skip is a failure', 1, 'TestA\nTestB\n', [ran('TestA') + ran('TestB', 'skip', 0)]),
|
||||
('a failed test', 1, 'TestA\n', [ran('TestA', 'fail')]),
|
||||
('a test that never ran', 1, 'TestA\nTestB\n', [ran('TestA')]),
|
||||
('a test that started and never ended (killed by the timeout)', 1, 'TestA\n', [[ev('run', 'TestA'), ev('output', 'TestA')]]),
|
||||
('passed in one stream, failed in another', 1, 'TestA\n', [ran('TestA'), ran('TestA', 'fail')]),
|
||||
('no events at all (the build failed)', 1, 'TestA\n', [['# example/cmd/blockvolume', 'build failed']]),
|
||||
('a package-level failure after every named test passed', 1, 'TestA\n', [ran('TestA') + [ev('fail', None, 3)]]),
|
||||
('a name listed twice', 2, 'TestA\nTestA\n', [ran('TestA')]),
|
||||
('a subtest name in the list', 2, 'TestA/sub\n', [ran('TestA')]),
|
||||
('an empty names file', 2, '# nothing\n', [ran('TestA')]),
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
fail = 0
|
||||
for name, want, names, streams in CASES:
|
||||
got, out = run(names, *streams)
|
||||
if got != want:
|
||||
print('FAIL %s: exit %d, want %d\n%s' % (name, got, want, out))
|
||||
fail = 1
|
||||
STATUS = [
|
||||
('PASS events and every process exited 0', 0, 'TestA 0\nTestB 0\n'),
|
||||
('PASS, then the process exited 1', 1, 'TestA 0\nTestB 1\n'),
|
||||
('PASS, then the process was killed by the timeout', 1, 'TestA 0\nTestB 124\n'),
|
||||
('a named test with no exit status', 1, 'TestA 0\n'),
|
||||
('a named test ran twice', 1, 'TestA 0\nTestB 0\nTestB 0\n'),
|
||||
('a malformed status line', 2, 'TestA 0\nTestB\n'),
|
||||
]
|
||||
for name, want, status in STATUS:
|
||||
got, out = run('TestA\nTestB\n', ran('TestA') + ran('TestB'), status=status)
|
||||
if got != want:
|
||||
print('FAIL %s: exit %d, want %d\n%s' % (name, got, want, out))
|
||||
fail = 1
|
||||
got, out = run('TestA\n', [ev('run', 'TestA'), json.dumps({'Action': 'output', 'Test': 'TestA', 'Output': ' x_test.go:7: the reason\n'})] + [json.dumps({'Action': 'output', 'Test': 'TestA', 'Output': ' h_test.go:578: blockvolume-r%d log:\n' % i}) for i in range(20)] + [json.dumps({'Action': 'output', 'Test': 'TestA', 'Output': ' w_test.go:128: ---- master log tail ----\n'})] + [json.dumps({'Action': 'output', 'Test': 'TestA', 'Output': ' I1126 harness log line %d\n' % i}) for i in range(60)] + [ev('fail', 'TestA', 1)])
|
||||
if got != 1 or 'x_test.go:7: the reason' not in out:
|
||||
print('FAIL a failed test''s output is shown: %s' % out)
|
||||
fail = 1
|
||||
got, out = run('TestA\n', ran('TestA', secs=2.25))
|
||||
if got != 0 or '2.2s' not in out and '2.3s' not in out:
|
||||
print('FAIL the elapsed time is reported: %s' % out)
|
||||
fail = 1
|
||||
if not fail:
|
||||
print('required-tests-check: %d cases ok' % (len(CASES) + len(STATUS) + 2))
|
||||
return fail
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -1,153 +0,0 @@
|
||||
"""Every named test must have run and passed.
|
||||
|
||||
Usage: required-tests-check.py [--status STATUS_FILE] NAMES_FILE EVENTS_FILE...
|
||||
|
||||
NAMES_FILE holds one top-level test name per line (# starts a comment).
|
||||
EVENTS_FILE is `go test -json` (or `go tool test2json`) output. A named test
|
||||
that skipped, failed, never started or never ended is a failure: a test that
|
||||
cannot start proves nothing, so it is not allowed to read as a pass. A name
|
||||
listed twice, or a test that passed in one stream and failed in another, is a
|
||||
failure too. A package-level failure event fails the run.
|
||||
|
||||
STATUS_FILE (run-named-tests.sh) holds one line per named test, NAME and the
|
||||
exit status of the process that ran it. With it, a named test passes only if it
|
||||
also has exactly one line and that status is 0: a test that reports PASS and
|
||||
then fails, panics or hangs on its way out is not a pass. Prints one line per named test with its outcome and elapsed
|
||||
seconds, then the total.
|
||||
|
||||
For every named test that did not pass, its own reported lines (the test's
|
||||
file:line messages, not the harness's log dumps) and its last lines follow the
|
||||
table, so a run's log carries its own reasons.
|
||||
|
||||
Exit 0: every named test passed. 1: at least one did not. 2: usage or an
|
||||
unreadable input.
|
||||
"""
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
|
||||
OWN = 12 # a failed test's own file:line messages shown (the last ones)
|
||||
TAIL = 5 # and its last output lines
|
||||
OWN_LINE = re.compile(r'^ [^ \t]+\.go:\d+: ') # the test's own t.Log/t.Error lines
|
||||
# Not reasons: the harness's cleanup headers ("<process> log:", "---- <x> log
|
||||
# tail ----") and the echo of a command that succeeded ("...: exit 0").
|
||||
NOISE = re.compile(r' log:\s*$|---- .* ----\s*$|: exit 0\s*$')
|
||||
|
||||
|
||||
def names_of(path):
|
||||
names, seen = [], set()
|
||||
with open(path, encoding='utf-8') as f:
|
||||
for n, raw in enumerate(f, 1):
|
||||
line = raw.split('#', 1)[0].strip()
|
||||
if not line:
|
||||
continue
|
||||
if not line.startswith('Test') or '/' in line or ' ' in line:
|
||||
raise ValueError('%s:%d: %r is not a top-level test name' % (path, n, line))
|
||||
if line in seen:
|
||||
raise ValueError('%s:%d: %s is listed twice' % (path, n, line))
|
||||
seen.add(line)
|
||||
names.append(line)
|
||||
if not names:
|
||||
raise ValueError('%s: no test names' % path)
|
||||
return names
|
||||
|
||||
|
||||
def statuses_of(path):
|
||||
"""Test name -> list of exit statuses."""
|
||||
out = {}
|
||||
with open(path, encoding='utf-8') as f:
|
||||
for n, raw in enumerate(f, 1):
|
||||
parts = raw.split()
|
||||
if not parts:
|
||||
continue
|
||||
if len(parts) != 2 or not parts[1].lstrip('-').isdigit():
|
||||
raise ValueError('%s:%d: %r is not NAME EXIT_STATUS' % (path, n, raw.strip()))
|
||||
out.setdefault(parts[0], []).append(int(parts[1]))
|
||||
return out
|
||||
|
||||
|
||||
def outcomes(paths):
|
||||
"""Test name -> list of (action, elapsed) for its terminal events, the
|
||||
names that started (action run), and the number of package-level
|
||||
failure events."""
|
||||
ends, started, pkg_fail, output = {}, set(), 0, {}
|
||||
for path in paths:
|
||||
with open(path, encoding='utf-8', errors='replace') as f:
|
||||
for raw in f:
|
||||
raw = raw.strip()
|
||||
if not raw.startswith('{'):
|
||||
continue # build output or a panic line between events
|
||||
try:
|
||||
ev = json.loads(raw)
|
||||
except ValueError:
|
||||
continue
|
||||
test = ev.get('Test')
|
||||
if not test:
|
||||
if ev.get('Action') == 'fail':
|
||||
pkg_fail += 1 # the binary failed outside any test (or after one)
|
||||
continue # other package events; a subtest's name never matches a top-level one
|
||||
action = ev.get('Action')
|
||||
if action == 'output':
|
||||
output.setdefault(test.split('/')[0], []).append(ev.get('Output', ''))
|
||||
continue
|
||||
if action == 'run':
|
||||
started.add(test)
|
||||
elif action in ('pass', 'fail', 'skip'):
|
||||
ends.setdefault(test, []).append((action, ev.get('Elapsed')))
|
||||
return ends, started, pkg_fail, output
|
||||
|
||||
|
||||
def main(argv):
|
||||
args = argv[1:]
|
||||
status_file = None
|
||||
if args[:1] == ['--status']:
|
||||
if len(args) < 2:
|
||||
print(__doc__.strip().splitlines()[2], file=sys.stderr)
|
||||
return 2
|
||||
status_file, args = args[1], args[2:]
|
||||
if len(args) < 2:
|
||||
print(__doc__.strip().splitlines()[2], file=sys.stderr)
|
||||
return 2
|
||||
try:
|
||||
names = names_of(args[0])
|
||||
ends, started, pkg_fail, output = outcomes(args[1:])
|
||||
statuses = statuses_of(status_file) if status_file else None
|
||||
except (OSError, ValueError) as e:
|
||||
print('required-tests: %s' % e, file=sys.stderr)
|
||||
return 2
|
||||
bad, total, failed = 0, 0.0, []
|
||||
for name in names:
|
||||
got = ends.get(name, [])
|
||||
actions = {a for a, _ in got}
|
||||
secs = sum(e for _, e in got if isinstance(e, (int, float)))
|
||||
total += secs
|
||||
rcs = statuses.get(name, []) if statuses is not None else [0]
|
||||
if actions == {'pass'} and len(got) == 1 and rcs == [0]:
|
||||
print('PASS %-70s %7.1fs' % (name, secs))
|
||||
continue
|
||||
bad += 1
|
||||
failed.append(name)
|
||||
if actions == {'pass'} and len(got) == 1:
|
||||
why = ('NO EXIT STATUS' if not rcs else
|
||||
'PASSED, THEN EXIT %s' % ','.join(str(r) for r in rcs))
|
||||
elif not got:
|
||||
why = 'STARTED, NEVER ENDED' if name in started else 'NEVER RAN'
|
||||
elif len(got) > 1:
|
||||
why = 'RAN %d TIMES (%s)' % (len(got), ', '.join(a for a, _ in got))
|
||||
else:
|
||||
why = got[0][0].upper()
|
||||
print('%-8s %-70s %7.1fs' % ('FAIL', name, secs) + ' ' + why)
|
||||
for name in failed:
|
||||
text = ''.join(output.get(name, [])).splitlines()
|
||||
own = [l for l in text if OWN_LINE.match(l) and not NOISE.search(l)][-OWN:]
|
||||
print('---- %s: its own messages (%d), then its last %d lines' % (name, len(own), min(TAIL, len(text))))
|
||||
for line in own + [' ...'] + text[-TAIL:]:
|
||||
print(' ' + line[:300])
|
||||
if pkg_fail:
|
||||
print('FAIL the test binary reported %d package-level failure(s)' % pkg_fail)
|
||||
print('required-tests: %d named, %d not passed, %.1fs in named tests' % (len(names), bad, total))
|
||||
return 1 if bad or pkg_fail else 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Self-test of run-named-tests.sh with the gate (required-tests-check.py
|
||||
# --status), through a real shell and test2json, with fake test binaries:
|
||||
# a test that reports PASS and then exits nonzero, or hangs until the
|
||||
# timeout, must fail the gate; an honest pass must not. Needs go (test2json).
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
fail=0
|
||||
|
||||
# fake NAME BEHAVIOUR: a test binary that prints a passing verbose run of
|
||||
# whatever -test.run names, then behaves as told.
|
||||
fake() {
|
||||
local f=$tmp/$1
|
||||
cat >"$f" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
for a in "\$@"; do case "\$a" in -test.run=*) re=\${a#-test.run=} ;; esac; done
|
||||
prev=""
|
||||
for a in "\$@"; do [ "\$prev" = -test.run ] && re=\$a; prev=\$a; done
|
||||
name=\${re#^}; name=\${name%\\\$}
|
||||
echo "=== RUN \$name"
|
||||
echo "--- PASS: \$name (0.01s)"
|
||||
echo "PASS"
|
||||
$2
|
||||
EOF
|
||||
chmod +x "$f"
|
||||
echo "$f"
|
||||
}
|
||||
|
||||
# expect WANT_EXIT NAME BINARY
|
||||
expect() {
|
||||
local want=$1 name=$2 bin=$3 got=0
|
||||
printf 'TestA\nTestB\n' >"$tmp/names"
|
||||
TEST_PKG=example/fake bash "$here/run-named-tests.sh" "$bin" "$tmp/names" "$tmp/events" "$tmp/status" 3s "$tmp" >/dev/null
|
||||
"${PYTHON:-python3}" -I "$here/required-tests-check.py" --status "$tmp/status" "$tmp/names" "$tmp/events" >"$tmp/out" || got=$?
|
||||
if [[ $got != "$want" ]]; then
|
||||
echo "FAIL $name: exit $got, want $want"
|
||||
cat "$tmp/out"
|
||||
fail=1
|
||||
fi
|
||||
}
|
||||
|
||||
expect 0 "PASS and exit 0" "$(fake ok 'exit 0')"
|
||||
expect 1 "PASS, then exit 1" "$(fake exit1 'exit 1')"
|
||||
expect 1 "PASS, then a hang until the timeout" "$(fake hang 'sleep 30')"
|
||||
|
||||
if ((fail == 0)); then echo "run-named-tests: 3 cases ok"; fi
|
||||
exit "$fail"
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs each test named in NAMES_FILE in its own process of TEST_BINARY, in
|
||||
# sequence, so a panic or a hang in one cannot hide the others. Each process
|
||||
# is bounded by TIMEOUT (the test binary's own timeout, then killed). Every
|
||||
# process's exit status is kept: a test that reports PASS and then fails or
|
||||
# hangs on its way out is not a pass (required-tests-check.py --status).
|
||||
#
|
||||
# Usage: run-named-tests.sh TEST_BINARY NAMES_FILE EVENTS_OUT STATUS_OUT TIMEOUT [DIR]
|
||||
# TEST_BINARY absolute path of a binary built with go test -c
|
||||
# EVENTS_OUT go test -json events of every process, appended in order
|
||||
# STATUS_OUT one line per named test: NAME EXIT_STATUS
|
||||
# DIR the directory each process runs in (default .)
|
||||
# TEST_PKG names the package in the events (default the blockvolume command).
|
||||
# Exits 0 once every named test has run; the verdict is the checker's.
|
||||
set -euo pipefail
|
||||
[ "$#" -ge 5 ] || { echo "usage: run-named-tests.sh TEST_BINARY NAMES_FILE EVENTS_OUT STATUS_OUT TIMEOUT [DIR]" >&2; exit 2; }
|
||||
bin=$1 names=$2 out=$3 status=$4 to=$5 dir=${6:-.}
|
||||
case "$bin" in /*) ;; *) echo "run-named-tests: TEST_BINARY must be absolute" >&2; exit 2 ;; esac
|
||||
pkg=${TEST_PKG:-github.com/seaweedfs/seaweed-block/cmd/blockvolume}
|
||||
: >"$out"
|
||||
: >"$status"
|
||||
while read -r name; do
|
||||
start=$(date +%s)
|
||||
rc=0
|
||||
(cd "$dir" && timeout -k 30 "$to" "$bin" -test.v=test2json -test.count=1 \
|
||||
-test.timeout "$to" -test.run "^${name}\$" 2>&1) |
|
||||
go tool test2json -t -p "$pkg" >>"$out" || rc=$?
|
||||
echo "$name $rc" >>"$status"
|
||||
echo "$name: exit $rc, $(($(date +%s) - start))s"
|
||||
done < <(sed 's/#.*//' "$names" | tr -d ' \t' | grep .)
|
||||
-111
@@ -1,111 +0,0 @@
|
||||
// Command sametokens reports whether two versions of a Go source file have the
|
||||
// same tokens in the same order, ignoring comments that the compiler ignores.
|
||||
//
|
||||
// Usage: go run sametokens.go OLD NEW
|
||||
//
|
||||
// A missing file counts as empty. Directive comments are compared as tokens:
|
||||
// //go:..., // +build, //line, /*line, //export; in a file that uses cgo
|
||||
// (any "C" string literal, as in import "C"), every comment counts, since the
|
||||
// preamble is code. Exit 0: same tokens; 1: different
|
||||
// (the first difference is printed); 2: usage error or a file that does not scan.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/scanner"
|
||||
"go/token"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type tok struct {
|
||||
t token.Token
|
||||
lit string
|
||||
}
|
||||
|
||||
func main() {
|
||||
if len(os.Args) != 3 {
|
||||
fmt.Fprintln(os.Stderr, "usage: sametokens OLD NEW")
|
||||
os.Exit(2)
|
||||
}
|
||||
a, err := tokens(os.Args[1])
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(2)
|
||||
}
|
||||
b, err := tokens(os.Args[2])
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(2)
|
||||
}
|
||||
for i := 0; i < len(a) || i < len(b); i++ {
|
||||
if i >= len(a) || i >= len(b) || a[i] != b[i] {
|
||||
fmt.Printf("token %d differs: %v vs %v\n", i, at(a, i), at(b, i))
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func at(ts []tok, i int) string {
|
||||
if i >= len(ts) {
|
||||
return "end of file"
|
||||
}
|
||||
return fmt.Sprintf("%s %q", ts[i].t, ts[i].lit)
|
||||
}
|
||||
|
||||
// tokens scans a file and keeps every token except comments the compiler
|
||||
// ignores. An automatic semicolon is compared by kind only.
|
||||
func tokens(path string) ([]tok, error) {
|
||||
src, err := os.ReadFile(path)
|
||||
if os.IsNotExist(err) {
|
||||
return nil, nil
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fset := token.NewFileSet()
|
||||
file := fset.AddFile(path, -1, len(src))
|
||||
var s scanner.Scanner
|
||||
var scanErr error
|
||||
s.Init(file, src, func(pos token.Position, msg string) {
|
||||
if scanErr == nil {
|
||||
scanErr = fmt.Errorf("%s: %s", pos, msg)
|
||||
}
|
||||
}, scanner.ScanComments)
|
||||
var all []tok
|
||||
for {
|
||||
_, t, lit := s.Scan()
|
||||
if t == token.EOF {
|
||||
break
|
||||
}
|
||||
if t == token.SEMICOLON {
|
||||
lit = ""
|
||||
}
|
||||
all = append(all, tok{t, lit})
|
||||
}
|
||||
if scanErr != nil {
|
||||
return nil, scanErr
|
||||
}
|
||||
cgo := false
|
||||
for _, x := range all {
|
||||
if x.t == token.STRING && x.lit == "\"C\"" {
|
||||
cgo = true
|
||||
}
|
||||
}
|
||||
var out []tok
|
||||
for _, x := range all {
|
||||
if x.t == token.COMMENT && !cgo && !directive(x.lit) {
|
||||
continue
|
||||
}
|
||||
out = append(out, x)
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func directive(c string) bool {
|
||||
for _, p := range []string{"//go:", "// +build", "//+build", "//line ", "/*line ", "//export "} {
|
||||
if strings.HasPrefix(c, p) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
"""Tests shard-named-tests.py: every name in exactly one shard, longest first
|
||||
into the least-loaded shard, the same split on every run, unknown names
|
||||
counted, and a duplicate or empty list refused."""
|
||||
import importlib.util
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
SCRIPT = os.path.join(HERE, "shard-named-tests.py")
|
||||
spec = importlib.util.spec_from_file_location("shard", SCRIPT)
|
||||
shard = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(shard)
|
||||
|
||||
fail = 0
|
||||
|
||||
|
||||
def check(name, ok):
|
||||
global fail
|
||||
print(("ok " if ok else "FAIL ") + name)
|
||||
if not ok:
|
||||
fail = 1
|
||||
|
||||
|
||||
secs = {"A": 500, "B": 400, "C": 300, "D": 100, "E": 100}
|
||||
parts, load = shard.shard(list(secs), secs, 2)
|
||||
check("every name once", sorted(sum(parts, [])) == sorted(secs))
|
||||
check("longest first, least loaded", parts == [["A", "D", "E"], ["B", "C"]] and load == [700, 700])
|
||||
check("same split on every run", shard.shard(list(secs), secs, 2) == (parts, load))
|
||||
parts, load = shard.shard(["A", "Z"], {"A": 10}, 2)
|
||||
check("an unknown name counts as the default", load == [shard.DEFAULT, 10.0])
|
||||
parts, _ = shard.shard(["A", "B"], {}, 4)
|
||||
check("more shards than names leaves some empty", sum(len(p) for p in parts) == 2 and [] in parts)
|
||||
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
names = os.path.join(d, "names.txt")
|
||||
seconds = os.path.join(d, "seconds.txt")
|
||||
with open(seconds, "w") as f:
|
||||
f.write("# times\nTestA 30\nTestB 20\n")
|
||||
with open(names, "w") as f:
|
||||
f.write("# list\nTestA\nTestB # note\n\nTestC\n")
|
||||
rc = subprocess.run([sys.executable, "-I", SCRIPT, names, seconds, "2", os.path.join(d, "out")], capture_output=True, text=True).returncode
|
||||
got = sorted(open(os.path.join(d, "out", f)).read().split() for f in ("1.txt", "2.txt"))
|
||||
check("the files hold every name once", rc == 0 and sorted(sum(got, [])) == ["TestA", "TestB", "TestC"])
|
||||
with open(names, "w") as f:
|
||||
f.write("TestA\nTestA\n")
|
||||
rc = subprocess.run([sys.executable, "-I", SCRIPT, names, seconds, "2", os.path.join(d, "o2")], capture_output=True, text=True).returncode
|
||||
check("a name listed twice is refused", rc == 2)
|
||||
with open(names, "w") as f:
|
||||
f.write("# nothing\n")
|
||||
rc = subprocess.run([sys.executable, "-I", SCRIPT, names, seconds, "2", os.path.join(d, "o3")], capture_output=True, text=True).returncode
|
||||
check("an empty list is refused", rc == 2)
|
||||
|
||||
sys.exit(fail)
|
||||
@@ -1,69 +0,0 @@
|
||||
"""Split the named process-level tests into N balanced shards.
|
||||
|
||||
Usage: shard-named-tests.py NAMES_FILE SECONDS_FILE N OUT_DIR
|
||||
|
||||
Writes OUT_DIR/1.txt .. OUT_DIR/N.txt, one test name per line. Every name in
|
||||
NAMES_FILE (# starts a comment) lands in exactly one shard. SECONDS_FILE holds
|
||||
"Name seconds" lines from an earlier run; a name missing there counts as
|
||||
DEFAULT seconds. Longest first, each into the shard with the least time so
|
||||
far (ties to the lowest shard), so the result is the same on every run.
|
||||
Prints each shard's names count and its estimated seconds.
|
||||
|
||||
Exit 0, or 2 on a usage error, a duplicate name or an empty names list.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
DEFAULT = 60.0
|
||||
|
||||
|
||||
def names_of(path):
|
||||
out = []
|
||||
for line in open(path, encoding="utf-8"):
|
||||
name = line.split("#", 1)[0].strip()
|
||||
if name:
|
||||
out.append(name)
|
||||
return out
|
||||
|
||||
|
||||
def seconds_of(path):
|
||||
out = {}
|
||||
for line in open(path, encoding="utf-8"):
|
||||
fields = line.split("#", 1)[0].split()
|
||||
if len(fields) == 2:
|
||||
out[fields[0]] = float(fields[1])
|
||||
return out
|
||||
|
||||
|
||||
def shard(names, seconds, n):
|
||||
load = [0.0] * n
|
||||
shards = [[] for _ in range(n)]
|
||||
for name in sorted(names, key=lambda x: (-seconds.get(x, DEFAULT), x)):
|
||||
k = min(range(n), key=lambda i: (load[i], i))
|
||||
shards[k].append(name)
|
||||
load[k] += seconds.get(name, DEFAULT)
|
||||
return shards, load
|
||||
|
||||
|
||||
def main(argv):
|
||||
if len(argv) != 5:
|
||||
print(__doc__.strip().splitlines()[2], file=sys.stderr)
|
||||
return 2
|
||||
names = names_of(argv[1])
|
||||
if not names or len(set(names)) != len(names):
|
||||
print("shard-named-tests: empty names list or a name listed twice", file=sys.stderr)
|
||||
return 2
|
||||
n = int(argv[3])
|
||||
if n < 1:
|
||||
return 2
|
||||
shards, load = shard(names, seconds_of(argv[2]), n)
|
||||
os.makedirs(argv[4], exist_ok=True)
|
||||
for i, part in enumerate(shards, 1):
|
||||
with open(os.path.join(argv[4], "%d.txt" % i), "w", encoding="utf-8") as f:
|
||||
f.write("".join(x + "\n" for x in part))
|
||||
print("shard %d: %d tests, about %d s" % (i, len(part), load[i - 1]))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -1,151 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Self-test of the spec-trace check: PR descriptions and change lists against
|
||||
# the exit code they must give.
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
check=$here/spec-trace-check.sh
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
fail=0
|
||||
|
||||
# expect WANT_EXIT NAME BODY [STATUS PATH]...
|
||||
expect() {
|
||||
local want=$1 name=$2 body=$3 got=0
|
||||
shift 3
|
||||
printf '%s' "$body" >"$tmp/body"
|
||||
if (($#)); then printf '%s\0' "$@"; fi | bash "$check" "$tmp/body" >/dev/null || got=$?
|
||||
if [[ $got != "$want" ]]; then
|
||||
echo "FAIL $name: exit $got, want $want"
|
||||
fail=1
|
||||
fi
|
||||
}
|
||||
|
||||
ok='Feature: O-SNAP-2
|
||||
Machine/INV: IMPL M5.Quiesce>Copy / INV-MAINT-ONE-OWNER
|
||||
Model: docs/spec/MaintenanceOwner.tla, exhausted
|
||||
Red-first: 7f542dbc TestMaintenanceHeldPass failed on base'
|
||||
simplest='Simplest: one owner per volume on the existing cut path; no new machine.'
|
||||
|
||||
expect 0 "all four lines, docs only" "$ok" M docs/a.md
|
||||
expect 0 "FIX kind" "${ok/IMPL M5.Quiesce>Copy/FIX INV-GC-SKEW-001}"
|
||||
expect 0 "CHANGE kind" "${ok/IMPL M5.Quiesce>Copy/CHANGE M5}"
|
||||
expect 0 "core change with Simplest" "$ok
|
||||
$simplest" M core/storage/gc.go
|
||||
expect 0 "core test only needs no Simplest" "$ok" M core/storage/gc_test.go
|
||||
expect 0 "CRLF body" "$(printf '%s\n' "$ok" | sed 's/$/\r/')"
|
||||
expect 0 "CHANGE of two machines" "${ok/IMPL M5.Quiesce>Copy/CHANGE M4, M6}"
|
||||
expect 0 "list markers and bold keys" "$(printf '%s\n' "$ok" | sed "s/^Feature:/- **Feature:**/; s/^Model:/* Model:/")"
|
||||
expect 0 "Model NONE with a reason" "${ok/Model: docs\/spec\/MaintenanceOwner.tla, exhausted/Model: NONE: CI wiring only, no state}"
|
||||
|
||||
expect 1 "empty body" ""
|
||||
expect 1 "missing Red-first" "$(printf '%s\n' "$ok" | grep -v Red-first)"
|
||||
expect 1 "short NONE" "${ok/Model: docs\/spec\/MaintenanceOwner.tla, exhausted/Model: NONE: n/a}"
|
||||
expect 1 "no kind" "${ok/IMPL M5.Quiesce>Copy/B,D,E}"
|
||||
expect 1 "IMPL without transition" "${ok/IMPL M5.Quiesce>Copy/IMPL M5}"
|
||||
expect 1 "NONE is not a kind" "${ok/IMPL M5.Quiesce>Copy \/ INV-MAINT-ONE-OWNER/NONE: tooling only, no machine}"
|
||||
expect 1 "core file deleted without Simplest" "$ok" D core/storage/old.go
|
||||
expect 1 "two kinds" "${ok/IMPL M5.Quiesce>Copy/IMPL M5.Quiesce>Copy FIX INV-MAINT-ONE-OWNER}"
|
||||
expect 1 "second Machine/INV line with another kind" "$ok
|
||||
Machine/INV: FIX INV-MAINT-ONE-OWNER"
|
||||
expect 1 "second Machine/INV line in list and bold form" "$ok
|
||||
- **Machine/INV:** CHANGE M5"
|
||||
expect 1 "Simplest declared twice" "$ok
|
||||
$simplest
|
||||
$simplest" M core/storage/gc.go
|
||||
expect 1 "kind token with a trailing junk" "${ok/IMPL M5.Quiesce>Copy/FIX INV-GC-SKEW-001x}"
|
||||
expect 1 "transition with a stray character" "${ok/IMPL M5.Quiesce>Copy/IMPL M5.Quiesce>Copy;x}"
|
||||
expect 1 "key inside another word" "${ok/Feature: O-SNAP-2/Not-Feature: O-SNAP-2}"
|
||||
expect 1 "placeholder left in Feature" "${ok/Feature: O-SNAP-2/Feature: <roadmap item>}"
|
||||
expect 1 "placeholder left in Red-first" "$(printf '%s\n' "$ok" | sed "s/^Red-first:.*/Red-first: <commit + test>/")"
|
||||
expect 1 "placeholder left in Simplest" "$ok
|
||||
Simplest: <the simplest version, and what this PR did not add>" M core/storage/gc.go
|
||||
expect 1 "unfilled template" "$(cat "$here/../pull_request_template.md")"
|
||||
expect 1 "core change without Simplest" "$ok" M core/storage/gc.go
|
||||
expect 1 "cmd change, short Simplest" "$ok
|
||||
Simplest: small" A cmd/sw-block/new.go
|
||||
|
||||
# expect_raw WANT_EXIT NAME BYTES: a change list given as printf format.
|
||||
expect_raw() {
|
||||
local want=$1 name=$2 got=0
|
||||
printf "%s" "$ok" >"$tmp/body"
|
||||
printf "$3" | bash "$check" "$tmp/body" >/dev/null 2>&1 || got=$?
|
||||
if [[ $got != "$want" ]]; then
|
||||
echo "FAIL $name: exit $got, want $want"
|
||||
fail=1
|
||||
fi
|
||||
}
|
||||
expect_raw 2 "record cut off before its NUL" "M\0core/storage/gc.go"
|
||||
expect_raw 2 "status without a path" "M\0"
|
||||
expect_raw 2 "status cut off before its NUL" "M\0docs/a.md\0M"
|
||||
expect_raw 2 "unknown status" "R100\0core/a.go\0"
|
||||
expect_raw 0 "well-formed docs change" "M\0docs/a.md\0"
|
||||
|
||||
|
||||
# Kinds for PRs that change no behaviour: each is checked against its paths;
|
||||
# DOCS also compares the old and new tokens of each changed non-test Go file.
|
||||
# expect_kind WANT_EXIT NAME KIND OLD_GO NEW_GO [STATUS PATH]...
|
||||
# OLD_GO/NEW_GO are core/x/s.go before and after ("-" = no blob for that side).
|
||||
expect_kind() {
|
||||
local want=$1 name=$2 k=$3 old=$4 new=$5 got=0
|
||||
shift 5
|
||||
printf '%s' "${ok/IMPL M5.Quiesce>Copy/$k}
|
||||
$simplest" >"$tmp/body"
|
||||
rm -rf "$tmp/blobs"; mkdir -p "$tmp/blobs/old/core/x" "$tmp/blobs/new/core/x"
|
||||
[[ $old == - ]] || printf '%s' "$old" >"$tmp/blobs/old/core/x/s.go"
|
||||
[[ $new == - ]] || printf '%s' "$new" >"$tmp/blobs/new/core/x/s.go"
|
||||
if (($#)); then printf '%s\0' "$@"; fi | bash "$check" "$tmp/body" "$tmp/blobs" >/dev/null || got=$?
|
||||
if [[ $got != "$want" ]]; then
|
||||
echo "FAIL $name: exit $got, want $want"
|
||||
fail=1
|
||||
fi
|
||||
}
|
||||
P=$'package x\n'
|
||||
expect_kind 0 "DOCS: comment-only Go" DOCS "${P}var A = 1"$'\n' "${P}"$'// A is one.\nvar A = 1 // one\n' M docs/a.md M core/x/s.go A core/x/s_test.go
|
||||
expect_kind 0 "DOCS: gofmt realignment" DOCS "${P}var A = 1"$'\n' "${P}var A = 1"$'\n' M core/x/s.go
|
||||
expect_kind 0 "DOCS: block comment" DOCS "${P}var A = 1"$'\n' "${P}"$'/* doc */\nvar A = 1\n' M core/x/s.go
|
||||
expect_kind 1 "DOCS: reorder" DOCS "${P}func f() { u(); p() }"$'\n' "${P}func f() { p(); u() }"$'\n' M core/x/s.go
|
||||
expect_kind 1 "DOCS: build constraint comment" DOCS "$P" $'//go:build never\n\npackage x\n' M core/x/s.go
|
||||
expect_kind 1 "DOCS: rune quote then // in a string" DOCS "${P}var _ = f('\"', \"http://a\")"$'\n' "${P}var _ = f('\"', \"http://b\")"$'\n' M core/x/s.go
|
||||
expect_kind 1 "DOCS: line inside a raw string" DOCS "${P}var s = \`a"$'\n'"curl http://old | sh"$'\n'"\`"$'\n' "${P}var s = \`a"$'\n'"curl http://new | sh"$'\n'"\`"$'\n' M core/x/s.go
|
||||
expect_kind 1 "DOCS: spaces inside a string" DOCS "${P}var s = \"a b\""$'\n' "${P}var s = \"a b\""$'\n' M core/x/s.go
|
||||
expect_kind 1 "DOCS: cgo preamble" DOCS "${P}// #include <a.h>"$'\nimport "C"\n' "${P}// #include <b.h>"$'\nimport "C"\n' M core/x/s.go
|
||||
expect_kind 1 "DOCS: cgo preamble, grouped import" DOCS "${P}// #include <a.h>"$'\nimport (\n\t"C"\n)\n' "${P}// #include <b.h>"$'\nimport (\n\t"C"\n)\n' M core/x/s.go
|
||||
expect_kind 1 "DOCS: Go changed, no blob" DOCS - - M core/x/s.go
|
||||
expect_kind 1 "DOCS: a model under docs/spec" DOCS - - M docs/spec/X.tla
|
||||
expect_kind 1 "DOCS: a non-docs, non-Go file" DOCS - - M deploy/x.env
|
||||
expect_kind 0 "TEST: tests and testdata" TEST - - M core/x/s_test.go A core/x/testdata/in.bin
|
||||
expect_kind 1 "TEST: production Go" TEST - - M core/x/s.go
|
||||
expect_kind 0 "TEST: a runner scenario only" TEST - - A testops/scenarios/gate.yaml
|
||||
expect_kind 0 "TEST: a scenario next to tests" TEST - - M testops/scenarios/gate.yaml M core/x/s_test.go
|
||||
expect_kind 1 "TEST: a scenario next to production Go" TEST - - M testops/scenarios/gate.yaml M core/x/s.go
|
||||
expect_kind 1 "TEST: a script beside the scenarios" TEST - - A testops/scenarios/run.sh
|
||||
expect_kind 1 "TEST: a yaml outside testops/scenarios" TEST - - M testops/gate.yaml
|
||||
expect_kind 0 "CI: workflow" CI - - M .github/workflows/w.yml
|
||||
expect_kind 1 "CI: scripts/ is shipped" CI - - A scripts/install.sh
|
||||
expect_kind 1 "DOCS next to another kind" "DOCS FIX INV-X-001" - - M docs/a.md
|
||||
|
||||
# The workflow supplies its base-owned map as the third argument.
|
||||
expect_map() {
|
||||
local want=$1 name=$2 model=$3 got=0
|
||||
shift 3
|
||||
printf '%s\n%s\n' "${ok/Model: docs\/spec\/MaintenanceOwner.tla, exhausted/Model: $model}" "$simplest" >"$tmp/body"
|
||||
if (($#)); then printf '%s\0' "$@"; fi |
|
||||
bash "$check" "$tmp/body" "" "$tmp/map.tsv" >/dev/null 2>&1 || got=$?
|
||||
if [[ $got != "$want" ]]; then
|
||||
echo "FAIL $name: exit $got, want $want"
|
||||
fail=1
|
||||
fi
|
||||
}
|
||||
printf 'core/x/s.go\tEngineAdapter.Begin\ncore/y/s.go\tMoveAdmission.Revoke\n' >"$tmp/map.tsv"
|
||||
expect_map 0 "mapped action" "EngineAdapter.Begin" M core/x/s.go
|
||||
expect_map 0 "mapped pure function" "NONE (pure function of EngineAdapter)" M core/x/s.go
|
||||
expect_map 0 "all mapped modules cited" "EngineAdapter.Begin; MoveAdmission.Revoke" M core/x/s.go M core/y/s.go
|
||||
expect_map 1 "mapped file rejects old prose" "docs/spec/EngineAdapter.tla, exhausted" M core/x/s.go
|
||||
expect_map 1 "deleted mapped file still needs model" "NONE: deletion has no new code" D core/x/s.go
|
||||
expect_map 1 "one citation cannot cover another module" "EngineAdapter.Begin" M core/x/s.go M core/y/s.go
|
||||
expect_map 0 "unmapped file keeps old policy" "docs/spec/EngineAdapter.tla, exhausted" M core/z/s.go
|
||||
printf '# no canonical rows yet\n' >"$tmp/map.tsv"
|
||||
expect_map 2 "empty map is not silently disabled" "EngineAdapter.Begin" M core/x/s.go
|
||||
|
||||
[[ $fail == 0 ]] && echo "spec-trace self-test: ok"
|
||||
exit $fail
|
||||
-171
@@ -1,171 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: spec-trace-check.sh BODY_FILE [BLOBS] [MODEL_MAP] < changes
|
||||
#
|
||||
# Checks the spec trace in a PR description. changes are NUL-separated
|
||||
# STATUS, PATH pairs (post-merge-review-changed.sh).
|
||||
#
|
||||
# - Feature:, Machine/INV:, Model: and Red-first: each start a line (after
|
||||
# optional indentation, a list marker or bold) and carry a value that is not
|
||||
# a template placeholder; "NONE:" needs a reason of at least 10 characters.
|
||||
# - Machine/INV: starts with exactly one PR kind: "IMPL <machine>.<transition>",
|
||||
# "FIX <INV-ID>", "CHANGE <machine>", or one of the kinds a PR that changes
|
||||
# no behaviour may use, each checked against what it changes:
|
||||
# DOCS (docs outside docs/spec/, tests, and non-test Go whose tokens are
|
||||
# unchanged: BLOBS holds old/<path> and new/<path> for each changed non-test
|
||||
# Go file, compared by sametokens.go), TEST (only tests, testdata, test
|
||||
# helpers and runner scenarios, testops/scenarios/*.yaml), CI (only
|
||||
# .github/). NONE is not a kind. Known limit: a docs file that is
|
||||
# go:embed-ed into a binary changes behaviour under DOCS (none today).
|
||||
# - Simplest: (20+ characters) is present when the PR adds, modifies or
|
||||
# deletes non-test Go under core/ or cmd/.
|
||||
#
|
||||
# Prints every problem and exits 1 if there is one; exits 0 if none, 2 on a
|
||||
# usage error or a malformed change list.
|
||||
set -euo pipefail
|
||||
|
||||
body_file=${1:?usage: spec-trace-check.sh BODY_FILE [BLOBS] < changes}
|
||||
blobs=${2-}
|
||||
model_map=${3-}
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
[[ -f $body_file ]] || { echo "spec-trace: body file $body_file missing" >&2; exit 2; }
|
||||
body=$(tr -d '\r' <"$body_file")
|
||||
|
||||
# value KEY: the text after KEY on the first line that starts with KEY,
|
||||
# trimmed. A key inside another word ("Not-Feature:") does not count.
|
||||
value() {
|
||||
local line
|
||||
line=$(printf '%s\n' "$body" | grep -m1 -E "^[[:space:]]*([-*][[:space:]]+)?(\*\*)?$1" || true)
|
||||
[[ -n $line ]] || return 0
|
||||
line=${line#*"$1"}
|
||||
line=${line#\*\*}
|
||||
line=${line#"${line%%[![:space:]]*}"}
|
||||
printf '%s' "${line%"${line##*[![:space:]]}"}"
|
||||
}
|
||||
|
||||
bad=0
|
||||
problem() { echo "spec-trace: $1"; bad=1; }
|
||||
|
||||
# Each trace line is declared once: a second Machine/INV line could carry a
|
||||
# second kind past the check.
|
||||
for key in Feature: Machine/INV: Model: Red-first: Simplest:; do
|
||||
n=$(printf '%s\n' "$body" | grep -cE "^[[:space:]]*([-*][[:space:]]+)?(\*\*)?$key" || true)
|
||||
((n <= 1)) || problem "$key is declared $n times; declare it once"
|
||||
done
|
||||
|
||||
for key in Feature: Machine/INV: Model: Red-first:; do
|
||||
v=$(value "$key")
|
||||
if [[ -z $v ]]; then
|
||||
problem "missing or empty $key"
|
||||
elif [[ $v == '<'* ]]; then
|
||||
problem "$key still holds the template placeholder"
|
||||
elif [[ $v == NONE:* ]]; then
|
||||
r=${v#NONE:}
|
||||
r=${r#"${r%%[![:space:]]*}"}
|
||||
((${#r} >= 10)) || problem "$key NONE needs a reason of at least 10 characters"
|
||||
fi
|
||||
done
|
||||
|
||||
# One kind token, ending at the line end, a space, a comma or a slash.
|
||||
end='($|[[:space:],/])'
|
||||
kind_re="^(IMPL [A-Za-z0-9_]+[.][A-Za-z0-9_>.-]+|FIX INV-[A-Z0-9]+(-[A-Z0-9]+)*|CHANGE [A-Za-z0-9_]+|DOCS|TEST|CI)$end"
|
||||
kind=""
|
||||
mi=$(value Machine/INV:)
|
||||
if [[ -n $mi && $mi != '<'* ]]; then
|
||||
if [[ ! $mi =~ $kind_re ]]; then
|
||||
problem "Machine/INV: must start with IMPL <machine>.<transition>, FIX <INV-ID>, CHANGE <machine>, DOCS, TEST or CI"
|
||||
else
|
||||
token=${BASH_REMATCH[1]}
|
||||
if [[ ${mi#"${BASH_REMATCH[0]}"} =~ (^|[^A-Za-z0-9_])(IMPL|FIX|CHANGE|DOCS|TEST|CI)([^A-Za-z0-9_]|$) ]]; then
|
||||
problem "Machine/INV: names more than one kind; a PR is exactly one kind"
|
||||
else
|
||||
kind=${token%% *}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# A runner scenario under testops/scenarios/ is a test definition.
|
||||
is_test() { [[ $1 == *_test.go || $1 == testdata/* || $1 == */testdata/* || $1 == */testutil/* || $1 == testops/scenarios/*.yaml ]]; }
|
||||
# docs/spec holds the models: changing one is not a docs change.
|
||||
is_doc() { [[ $1 != docs/spec/* ]] && [[ $1 == *.md || $1 == docs/* ]]; }
|
||||
core=0
|
||||
paths=()
|
||||
while IFS= read -r -d '' status; do
|
||||
[[ $status == [ADMT] ]] || { echo "spec-trace: malformed change list: status ${status@Q}" >&2; exit 2; }
|
||||
IFS= read -r -d '' path || { echo "spec-trace: malformed change list: status $status without a path" >&2; exit 2; }
|
||||
[[ -n $path ]] || { echo "spec-trace: malformed change list: empty path" >&2; exit 2; }
|
||||
paths+=("$path")
|
||||
if [[ $path == core/*.go || $path == cmd/*.go ]] && [[ $path != *_test.go ]]; then
|
||||
core=1
|
||||
fi
|
||||
done
|
||||
# A record cut off before its NUL is malformed, not skipped.
|
||||
[[ -z ${status-} ]] || { echo "spec-trace: malformed change list: unterminated record" >&2; exit 2; }
|
||||
if [[ -n $model_map ]]; then
|
||||
model_status=0
|
||||
{ if ((${#paths[@]})); then printf '%s\0' "${paths[@]}"; fi; } |
|
||||
"${PYTHON:-python3}" -B "$here/model-trace-check.py" "$model_map" "$(value Model:)" || model_status=$?
|
||||
case $model_status in
|
||||
0) ;;
|
||||
1) bad=1 ;;
|
||||
*) exit "$model_status" ;;
|
||||
esac
|
||||
fi
|
||||
if ((core)); then
|
||||
s=$(value Simplest:)
|
||||
if ((${#s} < 20)) || [[ $s == '<'* ]]; then
|
||||
problem "Simplest: (20+ characters) is required when non-test Go under core/ or cmd/ changes"
|
||||
fi
|
||||
fi
|
||||
|
||||
case $kind in
|
||||
CI)
|
||||
for p in ${paths[@]+"${paths[@]}"}; do
|
||||
[[ $p == .github/* ]] || problem "kind CI: $p is outside .github/ (scripts/ holds shipped install and deploy scripts)"
|
||||
done
|
||||
;;
|
||||
TEST)
|
||||
for p in ${paths[@]+"${paths[@]}"}; do
|
||||
is_test "$p" || problem "kind TEST: $p is not a test, testdata or test helper"
|
||||
done
|
||||
;;
|
||||
DOCS)
|
||||
gofiles=()
|
||||
for p in ${paths[@]+"${paths[@]}"}; do
|
||||
if is_doc "$p" || is_test "$p"; then continue; fi
|
||||
if [[ $p == *.go ]]; then gofiles+=("$p"); continue; fi
|
||||
problem "kind DOCS: $p is neither docs, a test, nor Go"
|
||||
done
|
||||
if ((${#gofiles[@]})); then
|
||||
if [[ -z $blobs || ! -d $blobs ]]; then
|
||||
problem "kind DOCS: non-test Go changed but no old/new blobs were given to compare"
|
||||
else
|
||||
# Built here, not run with "go run": that would take the .go
|
||||
# arguments as more source files of the program.
|
||||
bin=$(mktemp -d)
|
||||
trap 'rm -rf "$bin"' EXIT
|
||||
if ! go build -o "$bin/sametokens" "$here/sametokens.go"; then
|
||||
echo "spec-trace: could not build sametokens.go; the DOCS check did not run" >&2
|
||||
exit 2
|
||||
fi
|
||||
for p in "${gofiles[@]}"; do
|
||||
if [[ ! -e $blobs/old/$p && ! -e $blobs/new/$p ]]; then
|
||||
problem "kind DOCS: $p has no old or new blob, so it was not compared"
|
||||
continue
|
||||
fi
|
||||
rc=0
|
||||
"$bin/sametokens" "$blobs/old/$p" "$blobs/new/$p" >/dev/null || rc=$?
|
||||
case $rc in
|
||||
0) ;;
|
||||
1) problem "kind DOCS: $p changes more than comments (its Go tokens differ)" ;;
|
||||
*)
|
||||
echo "spec-trace: sametokens failed on $p (exit $rc); the DOCS check did not run" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $bad
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
name: Known bugs
|
||||
|
||||
# Nightly: every open-issue reproduction that is skipped by default (t.Skip unless
|
||||
# SEAWEED_KNOWN_BUGS=1) runs and is EXPECTED TO FAIL. If one passes, its bug is
|
||||
# fixed but its skip is still in place: this job fails and names it, so the skip
|
||||
# is removed in the fix PR (or right after). A fix PR removes the test's line here
|
||||
# together with its skip.
|
||||
on:
|
||||
schedule:
|
||||
- cron: "17 6 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
known-bugs:
|
||||
name: known-bug reproductions still fail
|
||||
runs-on: tp04-seaweed-block
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
CGO_ENABLED: "0"
|
||||
SEAWEED_KNOWN_BUGS: "1"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- name: Each reproduction still fails
|
||||
run: |
|
||||
set -u
|
||||
ok=1
|
||||
while read -r issue pkg test; do
|
||||
[ -n "$issue" ] || continue
|
||||
if go test -count=1 -run "^${test}\$" "$pkg" > "out-${test}.txt" 2>&1; then
|
||||
echo "::error::${test} (${pkg}) now PASSES: ${issue} looks fixed, remove its skip"
|
||||
ok=0
|
||||
elif grep -q "^--- FAIL: ${test} " "out-${test}.txt"; then
|
||||
echo "${test} (${issue}) still fails, as expected"
|
||||
else
|
||||
echo "::error::${test} (${pkg}) did not run or failed to build:"; tail -20 "out-${test}.txt"
|
||||
ok=0
|
||||
fi
|
||||
done <<'LIST'
|
||||
#186 ./cmd/blockmaster/ TestChartOptInLoopbackFlagIsAcceptedByBlockmaster
|
||||
#187 ./cmd/blockmaster/ TestChartDefaultAuthorityStateSurvivesPodReplacement
|
||||
#188 ./core/ops/ TestDeleteSafety_UntimedCleanupCannotProveFreshness
|
||||
#189 ./core/storage/ TestMultiBlockRecordsRequireDistinctOnDiskImplVersion
|
||||
LIST
|
||||
[ "$ok" = 1 ]
|
||||
@@ -1,51 +0,0 @@
|
||||
name: post-merge-review paths
|
||||
|
||||
# A PR labelled "post-merge-review" may merge before its full review only if
|
||||
# every changed file is allowed by .github/post-merge-review-allow.txt.
|
||||
# This check fails such a PR otherwise; without the label it passes.
|
||||
#
|
||||
# pull_request_target: the workflow, the allow list and the script all come
|
||||
# from the base branch, so a PR cannot change its own check. The PR's code is
|
||||
# never checked out or run: only its commit is fetched, for the file list.
|
||||
on:
|
||||
pull_request_target:
|
||||
# edited: a retarget changes the base, and with it the diff.
|
||||
types: [opened, synchronize, reopened, labeled, unlabeled, edited]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: post-merge-review-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
paths:
|
||||
name: post-merge-review paths
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Not labelled
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'post-merge-review') }}
|
||||
run: echo "no post-merge-review label; nothing to check"
|
||||
|
||||
- name: Checkout base
|
||||
if: ${{ contains(github.event.pull_request.labels.*.name, 'post-merge-review') }}
|
||||
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.base.sha }}
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check changed paths
|
||||
if: ${{ contains(github.event.pull_request.labels.*.name, 'post-merge-review') }}
|
||||
env:
|
||||
BASE: ${{ github.event.pull_request.base.sha }}
|
||||
HEAD: ${{ github.event.pull_request.head.sha }}
|
||||
PR: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash .github/scripts/post-merge-review-check-test.sh
|
||||
git fetch --no-tags origin "+refs/pull/${PR}/head:refs/remotes/pr/head"
|
||||
bash .github/scripts/post-merge-review-changed.sh "$BASE" "$HEAD" >changed.bin
|
||||
bash .github/scripts/post-merge-review-check.sh .github/post-merge-review-allow.txt <changed.bin
|
||||
@@ -1,84 +0,0 @@
|
||||
name: Publish alpha images
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
BLOCK_IMAGE: ghcr.io/seaweedfs/seaweed-block
|
||||
CSI_IMAGE: ghcr.io/seaweedfs/seaweed-block-csi
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Compute image tags
|
||||
id: tags
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
short_sha="${GITHUB_SHA::12}"
|
||||
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
|
||||
version="${GITHUB_REF_NAME}"
|
||||
{
|
||||
echo "block_tags<<EOF"
|
||||
echo "${BLOCK_IMAGE}:${version}"
|
||||
echo "${BLOCK_IMAGE}:alpha"
|
||||
echo "${BLOCK_IMAGE}:sha-${short_sha}"
|
||||
echo "EOF"
|
||||
echo "csi_tags<<EOF"
|
||||
echo "${CSI_IMAGE}:${version}"
|
||||
echo "${CSI_IMAGE}:alpha"
|
||||
echo "${CSI_IMAGE}:sha-${short_sha}"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
{
|
||||
echo "block_tags<<EOF"
|
||||
echo "${BLOCK_IMAGE}:alpha"
|
||||
echo "${BLOCK_IMAGE}:sha-${short_sha}"
|
||||
echo "EOF"
|
||||
echo "csi_tags<<EOF"
|
||||
echo "${CSI_IMAGE}:alpha"
|
||||
echo "${CSI_IMAGE}:sha-${short_sha}"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Build and push block image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: deploy/k8s/g15b/Dockerfile.sw-block
|
||||
push: true
|
||||
tags: ${{ steps.tags.outputs.block_tags }}
|
||||
|
||||
- name: Build and push CSI image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: deploy/k8s/g15b/Dockerfile.blockcsi
|
||||
push: true
|
||||
tags: ${{ steps.tags.outputs.csi_tags }}
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
name: spec trace
|
||||
|
||||
# Every PR description carries the spec trace (see the PR template); this
|
||||
# check fails a PR whose description does not.
|
||||
#
|
||||
# pull_request_target: the workflow and the script come from the base branch,
|
||||
# so a PR cannot change its own check. The PR's code is never checked out or
|
||||
# run: only its commit is fetched, for the file list. The description is read
|
||||
# from the event through an environment variable, never interpolated.
|
||||
on:
|
||||
pull_request_target:
|
||||
# edited: the check reads the description and the base.
|
||||
types: [opened, synchronize, reopened, edited]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: spec-trace-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
trace:
|
||||
name: spec trace
|
||||
# Same-repository PRs use the project's self-hosted runners, as the test
|
||||
# workflow does; fork PRs stay on a GitHub-hosted runner, whose shared queue
|
||||
# can wait for hours. No PR code runs here either way.
|
||||
runs-on: ${{ github.event.pull_request.head.repo.full_name == github.repository && 'tp04-seaweed-block' || 'ubuntu-latest' }}
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
# github.sha is the tip of the base branch when the event fires; the
|
||||
# PR's base.sha can predate this workflow's own scripts.
|
||||
ref: ${{ github.sha }}
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check spec trace
|
||||
env:
|
||||
BASE: ${{ github.event.pull_request.base.sha }}
|
||||
HEAD: ${{ github.event.pull_request.head.sha }}
|
||||
PR: ${{ github.event.pull_request.number }}
|
||||
BODY: ${{ github.event.pull_request.body }}
|
||||
TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash .github/scripts/spec-trace-check-test.sh
|
||||
python3 -B .github/scripts/model-trace-check-test.py
|
||||
git fetch --no-tags origin "+refs/pull/${PR}/head:refs/remotes/pr/head"
|
||||
printf '%s' "$BODY" >body.txt
|
||||
bash .github/scripts/post-merge-review-changed.sh "$BASE" "$HEAD" >changed.bin
|
||||
# Old and new blobs of each changed non-test Go file, for kind DOCS
|
||||
# (objects only; nothing from the PR is built or run).
|
||||
mb=$(git merge-base "$BASE" "$HEAD")
|
||||
git diff --name-only --no-renames -z "$mb" "$HEAD" -- "*.go" ":(exclude)*_test.go" |
|
||||
while IFS= read -r -d "" p; do
|
||||
mkdir -p "blobs/old/$(dirname "$p")" "blobs/new/$(dirname "$p")"
|
||||
git show "$mb:$p" >"blobs/old/$p" 2>/dev/null || rm -f "blobs/old/$p"
|
||||
git show "$HEAD:$p" >"blobs/new/$p" 2>/dev/null || rm -f "blobs/new/$p"
|
||||
done
|
||||
mkdir -p blobs
|
||||
# Mapping and validator come from the trusted base checkout above.
|
||||
bash .github/scripts/spec-trace-check.sh body.txt blobs .github/model-code-trace.tsv <changed.bin
|
||||
# Internal names stay out of this public repository: added lines,
|
||||
# commit messages, title and description (no PR code is run).
|
||||
bash .github/scripts/public-text-check-test.sh
|
||||
printf '%s' "$TITLE" >title.txt
|
||||
bash .github/scripts/public-text-check.sh "$mb" "$HEAD" title.txt body.txt
|
||||
-210
@@ -1,210 +0,0 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# ready_for_review: a Draft runs no Go suite (below); marking it ready starts one.
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# One run per PR (or per branch for pushes). A new push to a PR cancels the
|
||||
# superseded run; runs on main are never cancelled so every merge gets a result.
|
||||
concurrency:
|
||||
group: test-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
# One job, two suites, one runner selection. 'unit' is the Go suite below;
|
||||
# 'process' runs the process-level tests: real blockmaster, blockvolume and
|
||||
# sw-block against a pinned SeaweedFS release. Those tests are named in
|
||||
# .github/process-level-tests.txt, and every one must PASS, so a test that
|
||||
# skips, fails, never starts or is cut off by the timeout fails the suite.
|
||||
# Tests that need root or systemd are not in the list (see its header).
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
suite: [unit, process]
|
||||
name: ${{ matrix.suite == 'unit' && 'go test (linux)' || 'process-level tests (real binaries)' }}
|
||||
# The suite writes heavily to the runner disk (real files, fsync), so a
|
||||
# Draft PR skips it; its author tests locally until the PR is ready.
|
||||
if: github.event_name == 'push' || !github.event.pull_request.draft
|
||||
# Pushes and same-repo PRs run on the team's tp04 runner (seaweed.slice,
|
||||
# capped at 8 cores / 8 GiB). Fork PRs never reach it: they stay on a
|
||||
# GitHub-hosted runner.
|
||||
runs-on: ${{ (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && 'tp04-seaweed-block' || 'ubuntu-latest' }}
|
||||
# process: 44 tests in 4 parallel shards of about 13 min each (55 min in sequence).
|
||||
timeout-minutes: ${{ matrix.suite == 'unit' && 40 || 90 }}
|
||||
env:
|
||||
# Pure-Go build: no package in the default build needs cgo, and the
|
||||
# hosted runner should not depend on a C toolchain being present.
|
||||
CGO_ENABLED: "0"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
# Two commits: the PR merge commit and its base parent, so the test
|
||||
# step can see which packages the PR touches.
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Docs-only pull request
|
||||
id: scope
|
||||
if: matrix.suite == 'process' && github.event_name == 'pull_request'
|
||||
# A pull request that changes only files under docs/ runs no product
|
||||
# code the process-level tests could exercise, so they are skipped and
|
||||
# the job still reports success. HEAD is the merge commit, HEAD^1 its
|
||||
# base parent (fetch-depth 2 above). Pushes to main always run them, and
|
||||
# so does any error of the check (.github/scripts/docs-only-scope.sh).
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash .github/scripts/docs-only-scope-test.sh
|
||||
if out=$(bash .github/scripts/docs-only-scope.sh HEAD^1 HEAD); then
|
||||
case $out in
|
||||
"docs_only "*)
|
||||
echo "skipped: docs only (${out#docs_only } files under docs/); the process-level tests run on the merge to main"
|
||||
echo "docs_only=1" >>"$GITHUB_OUTPUT" ;;
|
||||
*) echo "process-level tests run: $out" ;;
|
||||
esac
|
||||
else
|
||||
echo "process-level tests run: the docs-only check failed"
|
||||
fi
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
# The self-hosted runner keeps GOCACHE/GOMODCACHE on its own disk;
|
||||
# uploading them as an Actions cache (~4 GB) in the post step
|
||||
# outlasted the job timeout after every test had passed. Only the
|
||||
# GitHub-hosted (fork PR) runner uses the Actions cache.
|
||||
cache: ${{ runner.environment == 'github-hosted' }}
|
||||
cache-dependency-path: go.sum
|
||||
|
||||
- name: Go version
|
||||
if: matrix.suite == 'unit'
|
||||
run: go version
|
||||
|
||||
- name: Build
|
||||
if: matrix.suite == 'unit'
|
||||
run: go build ./...
|
||||
|
||||
- name: Vet
|
||||
if: matrix.suite == 'unit'
|
||||
run: go vet ./...
|
||||
|
||||
- name: Test default configuration
|
||||
if: matrix.suite == 'unit'
|
||||
# The runner disk is shared, so the long, disk-heavy, timing-sensitive
|
||||
# packages do not run here on main or on train PRs: every train runs the
|
||||
# whole suite (both configurations) on a separate test VM before it
|
||||
# merges, and main moves only by those trains. A PR runs the light set
|
||||
# plus every heavy package its own diff touches.
|
||||
env:
|
||||
EVENT: ${{ github.event_name }}
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
pkgs=$(go list ./... | grep -vE '/core/(storage|frontend/durable|host/master|authority)$')
|
||||
if [ "$EVENT" != push ] && [[ "$HEAD_REF" != train/* ]]; then
|
||||
mod=$(go list -m)
|
||||
changed=$(git diff --name-only HEAD^1 HEAD)
|
||||
for p in core/storage core/frontend/durable core/host/master core/authority; do
|
||||
if printf '%s\n' "$changed" | grep -qE "^$p/[^/]+$"; then
|
||||
pkgs="$pkgs $mod/$p"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# 20m per package: core/storage alone took 602 s on tp04 on main
|
||||
# (2026-11-22), past the old 10m, so any PR touching it failed.
|
||||
go test -p=1 -short -count=1 -timeout 20m $pkgs
|
||||
|
||||
- name: Self-test of the required-tests gate
|
||||
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
|
||||
# The gate must fail on a skip, a failure, a test that never ran, one
|
||||
# cut off mid-run, and one that reports PASS and then exits nonzero or
|
||||
# hangs; this proves it before it judges the real run.
|
||||
run: |
|
||||
python3 -I .github/scripts/required-tests-check-test.py
|
||||
bash .github/scripts/run-named-tests-test.sh
|
||||
python3 -I .github/scripts/shard-named-tests-test.py
|
||||
|
||||
- name: Pinned SeaweedFS
|
||||
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
|
||||
# The release archive is checked against its sha256 before every use,
|
||||
# also when taken from the runner's cache; a mismatch fails the step.
|
||||
# Nothing else is fetched.
|
||||
env:
|
||||
WEED_VERSION: "4.53"
|
||||
WEED_SHA256: d1a7dec9f48d8b33895a0ea8951971defc2dc5312906dcc76fa5a5f74a6ee90d
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cache="${RUNNER_TOOL_CACHE:-$RUNNER_TEMP}/seaweedfs-weed/$WEED_VERSION"
|
||||
tgz="$cache/linux_amd64.tar.gz"
|
||||
mkdir -p "$cache"
|
||||
if ! echo "$WEED_SHA256 $tgz" | sha256sum -c --status - 2>/dev/null; then
|
||||
part="$tgz.$$.part"
|
||||
curl -fsSL --retry 3 -o "$part" "https://github.com/seaweedfs/seaweedfs/releases/download/$WEED_VERSION/linux_amd64.tar.gz"
|
||||
echo "$WEED_SHA256 $part" | sha256sum -c - || { rm -f "$part"; exit 1; }
|
||||
mv -f "$part" "$tgz"
|
||||
fi
|
||||
bin="$RUNNER_TEMP/weed-$WEED_VERSION"
|
||||
mkdir -p "$bin"
|
||||
tar -xzf "$tgz" -C "$bin" weed
|
||||
echo "CHUNKSTORE_WEED=$bin/weed" >>"$GITHUB_ENV"
|
||||
|
||||
- name: Build the binaries and the test binary once
|
||||
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bins="$RUNNER_TEMP/swblock-bins"
|
||||
mkdir -p "$bins"
|
||||
for b in blockmaster blockvolume sw-block; do go build -o "$bins/$b" "./cmd/$b"; done
|
||||
go test -c -tags 'subprocess chunkstore_integration' -o "$bins/blockvolume.test" ./cmd/blockvolume
|
||||
# The known-zero acceptance's first-start crash step holds a test-only
|
||||
# blockvolume (build tag kzhold, never released) at a chosen point.
|
||||
go build -tags kzhold -o "$RUNNER_TEMP/blockvolume-kzhold" ./cmd/blockvolume
|
||||
echo "SWBLOCK_TEST_BINS=$bins" >>"$GITHUB_ENV"
|
||||
echo "KZ_HOLD_BIN=$RUNNER_TEMP/blockvolume-kzhold" >>"$GITHUB_ENV"
|
||||
|
||||
- name: Run the named process-level tests
|
||||
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
|
||||
# Each named test in its own process of the one test binary, in
|
||||
# sequence, so a panic or a hang in one cannot hide the others; each
|
||||
# is bounded (TEST_TIMEOUT, then killed) and its exit status is kept:
|
||||
# the gate needs a PASS event AND exit 0 for every named test. The known-zero acceptance
|
||||
# runs its small shape (1 GiB, user-space client, no device); the
|
||||
# 1 TiB run is lab only.
|
||||
env:
|
||||
KZ_RUN: "1"
|
||||
KZ_SIZE: 1G
|
||||
F1_RUN: "1"
|
||||
TEST_TIMEOUT: 15m
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# SHARDS parallel shards, balanced by their last measured times
|
||||
# (.github/process-level-seconds.txt). Each shard is its own sequence
|
||||
# of test processes with its own slice of the test port ranges
|
||||
# (SWBLOCK_TEST_PORT_SHARD) and its own TMPDIR; the gate judges every
|
||||
# named test from all the shards together.
|
||||
names=.github/process-level-tests.txt
|
||||
shards=4
|
||||
python3 -I .github/scripts/shard-named-tests.py "$names" .github/process-level-seconds.txt "$shards" "$RUNNER_TEMP/shard"
|
||||
pids=()
|
||||
for k in $(seq 1 "$shards"); do
|
||||
mkdir -p "$RUNNER_TEMP/tmp-$k"
|
||||
SWBLOCK_TEST_PORT_SHARD=$k SWBLOCK_TEST_PORT_SHARDS=$shards TMPDIR="$RUNNER_TEMP/tmp-$k" \
|
||||
bash .github/scripts/run-named-tests.sh "$SWBLOCK_TEST_BINS/blockvolume.test" "$RUNNER_TEMP/shard/$k.txt" \
|
||||
"$RUNNER_TEMP/process-level-$k.json" "$RUNNER_TEMP/process-level-$k.status" "$TEST_TIMEOUT" cmd/blockvolume \
|
||||
>"$RUNNER_TEMP/process-level-$k.log" 2>&1 &
|
||||
pids+=($!)
|
||||
done
|
||||
for p in "${pids[@]}"; do wait "$p" || true; done
|
||||
for k in $(seq 1 "$shards"); do sed "s/^/[shard $k] /" "$RUNNER_TEMP/process-level-$k.log"; done
|
||||
cat "$RUNNER_TEMP"/process-level-*.status >"$RUNNER_TEMP/process-level.status"
|
||||
python3 -I .github/scripts/required-tests-check.py --status "$RUNNER_TEMP/process-level.status" \
|
||||
"$names" "$RUNNER_TEMP"/process-level-*.json
|
||||
@@ -1,35 +0,0 @@
|
||||
# Go toolchain caches (if GOCACHE/GOTMPDIR is pointed at the workspace)
|
||||
.gocache/
|
||||
.gotmp/
|
||||
|
||||
# Built binaries at repo root (sparrow is a command; tests build their own
|
||||
# transient copies). Anchored with / so these do NOT match the cmd/sparrow/
|
||||
# source directory's files.
|
||||
/sparrow
|
||||
/sparrow.exe
|
||||
|
||||
# Test coverage artifacts
|
||||
*.test
|
||||
*.out
|
||||
coverage.out
|
||||
|
||||
# G5-5* cross-compile artifacts (m01 hardware iteration script
|
||||
# stages binaries into _g5_bin/ before scp to the test host; root-
|
||||
# level *.exe are Windows-side build outputs that go build leaves
|
||||
# behind on iteration runs).
|
||||
/_g5_bin/
|
||||
/blockmaster
|
||||
/blockmaster.exe
|
||||
/blockvolume
|
||||
/blockvolume.exe
|
||||
|
||||
# Local test runner outputs and ad-hoc Windows builds. Formal QA evidence lives
|
||||
# under internal/docs/qa-assignments or external shared artifacts, not here.
|
||||
/results/
|
||||
/sw-testops.exe
|
||||
|
||||
# MkDocs engineering wiki build output
|
||||
/site/
|
||||
|
||||
# Windows builds of the binaries (never committed)
|
||||
/*.exe
|
||||
@@ -1,89 +0,0 @@
|
||||
# Agent Guidelines
|
||||
|
||||
Behavioral guidelines to reduce common LLM coding mistakes. Merge with
|
||||
project-specific instructions as needed.
|
||||
|
||||
Tradeoff: these guidelines bias toward caution over speed. For trivial tasks,
|
||||
use judgment.
|
||||
|
||||
## 1. Think Before Coding
|
||||
|
||||
Do not assume. Do not hide confusion. Surface tradeoffs.
|
||||
|
||||
Before implementing:
|
||||
|
||||
- State assumptions explicitly. If uncertain, ask.
|
||||
- If multiple interpretations exist, present them; do not pick silently.
|
||||
- If a simpler approach exists, say so. Push back when warranted.
|
||||
- If something is unclear, stop, name what is confusing, and ask.
|
||||
|
||||
## 2. Simplicity First
|
||||
|
||||
Minimum code that solves the problem. Nothing speculative.
|
||||
|
||||
- No features beyond what was asked.
|
||||
- No abstractions for single-use code.
|
||||
- No flexibility or configurability that was not requested.
|
||||
- No error handling for impossible scenarios.
|
||||
- If 200 lines could be 50, rewrite it.
|
||||
|
||||
Ask: would a senior engineer say this is overcomplicated? If yes, simplify.
|
||||
|
||||
## 3. Surgical Changes
|
||||
|
||||
Touch only what you must. Clean up only your own mess.
|
||||
|
||||
When editing existing code:
|
||||
|
||||
- Do not improve adjacent code, comments, or formatting.
|
||||
- Do not refactor things that are not broken.
|
||||
- Match existing style, even if you would do it differently.
|
||||
- If you notice unrelated dead code, mention it; do not delete it.
|
||||
|
||||
When your changes create orphans:
|
||||
|
||||
- Remove imports, variables, and functions that your changes made unused.
|
||||
- Do not remove pre-existing dead code unless asked.
|
||||
|
||||
Every changed line should trace directly to the user's request.
|
||||
|
||||
## 4. Goal-Driven Execution
|
||||
|
||||
Define success criteria. Loop until verified.
|
||||
|
||||
Transform tasks into verifiable goals:
|
||||
|
||||
- "Add validation" -> "Write tests for invalid inputs, then make them pass."
|
||||
- "Fix the bug" -> "Write a test that reproduces it, then make it pass."
|
||||
- "Refactor X" -> "Ensure tests pass before and after."
|
||||
|
||||
For multi-step tasks, state a brief plan:
|
||||
|
||||
```text
|
||||
1. [Step] -> verify: [check]
|
||||
2. [Step] -> verify: [check]
|
||||
3. [Step] -> verify: [check]
|
||||
```
|
||||
|
||||
Strong success criteria let agents loop independently. Weak criteria such as
|
||||
"make it work" require clarification.
|
||||
|
||||
These guidelines are working if there are fewer unnecessary changes in diffs,
|
||||
fewer rewrites due to overcomplication, and clarifying questions come before
|
||||
implementation rather than after mistakes.
|
||||
|
||||
## Protocol contract
|
||||
|
||||
Seaweed Block's state machines and invariants are in
|
||||
[`docs/design/invariants.md`](docs/design/invariants.md). Read it before
|
||||
changing a protocol path: the storage engines, durability and `Sync`,
|
||||
authority and epochs, replication and replica roles, the chunk layer and the
|
||||
cut, the catalog, GC and volume delete, or the workspace lease.
|
||||
|
||||
- Find the machine and transition (Part A) and the invariant IDs (Part B)
|
||||
your change touches, and name them in the PR.
|
||||
- Follow the change rules (Part C): a new or changed state or transition
|
||||
updates Part A, the design-doc diagram, the ledger and the TLA+ spec that
|
||||
covers it; an ACTIVE row never loses its test; a bug found by tests, soak
|
||||
or TLA+ becomes a regression test plus a ledger row.
|
||||
- Do not weaken a guard listed under "Enforced in" without updating its row.
|
||||
@@ -1,263 +0,0 @@
|
||||
# Seaweed Block
|
||||
|
||||
Block storage written in Go: a local-speed block device whose ownership is
|
||||
fenced by epochs. It serves agent workspace disks backed by
|
||||
[SeaweedFS](https://github.com/seaweedfs/seaweedfs) snapshots, and Kubernetes
|
||||
block volumes (alpha).
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/assets/seaweed-block-hero.svg" alt="Seaweed Block: a shared core (blockvolume with ublk, NVMe/TCP and iSCSI frontends and the walstore WAL engine, plus blockmaster as the epoch authority) used for agent workspace disks with chunk snapshots in SeaweedFS and for Kubernetes PVCs, with optional RF=2 or RF=3 replication" width="100%">
|
||||
</p>
|
||||
|
||||
## What it is
|
||||
|
||||
| | Agent workspace disks | Kubernetes block volumes |
|
||||
|---|---|---|
|
||||
| Consumer | an agent sandbox or microVM, as a plain virtio block device | an app pod, through a PVC and the CSI driver |
|
||||
| Frontend | NVMe/TCP loopback or ublk | iSCSI, or NVMe/TCP (source-gated) |
|
||||
| Durability | one local replica, with cuts to SeaweedFS | RF=1 with best-effort ack by default; synchronous RF=2 or RF=3 (`sync-quorum`, `sync-all`) when configured, in a supported lab |
|
||||
| Maturity | proof of concept | alpha |
|
||||
|
||||
Both uses share one core. `blockvolume` serves one volume replica; its
|
||||
frontends turn block requests into a single Read / Write / Sync contract, and
|
||||
`Sync` is the only durability point. Writes land in a local WAL engine,
|
||||
`walstore` (a WAL plus an extent). `blockvolume --durable-impl` defaults to
|
||||
auto: a new volume is created as `walstore` and an existing one opens with its
|
||||
on-disk format; auto refuses a `walstore-chunk` root, which needs
|
||||
`--durable-impl=walstore-chunk` with its remote configuration. `smartwal` is
|
||||
experimental. `blockmaster` is the only component that mints epochs. Each
|
||||
`blockvolume` admits I/O only while its local view of the assignment is
|
||||
current: a deposed primary refuses I/O once it observes the new assignment or
|
||||
a fence, or once its workspace lease expires. That is a local admission rule,
|
||||
not an instant global revocation. Separately, every remote HEAD publish is a
|
||||
conditional update on `{gen, epoch}`, so the store refuses a stale holder's
|
||||
publish even before that holder notices it was replaced. The design is in
|
||||
three documents: the [core design](docs/design/block-design.md), the [agent
|
||||
workspace design](docs/design/agent-workspace-design.md) and the [Kubernetes
|
||||
block design](docs/design/kubernetes-block-design.md). Each covers its parts,
|
||||
their invariants, the tests behind them and the known issues.
|
||||
|
||||
## Highlights
|
||||
|
||||
**Agent workspace disks**
|
||||
|
||||
- **Local-speed disk.** Writes and `fsync` complete against the local WAL;
|
||||
nothing on the write path waits on the network.
|
||||
- **Incremental snapshots.** A cut uploads only the changed 4 MiB chunks.
|
||||
Chunks are immutable; the volume's state is a HEAD root of about 2 KB, and
|
||||
every publish is a conditional update on `{gen, epoch}`.
|
||||
- **Cheap snapshot and restore.** A snapshot copies only the HEAD root; chunks
|
||||
are shared. A restore makes a new volume that reads the snapshot's chunks.
|
||||
A two-phase, graced GC reclaims unreferenced chunks.
|
||||
- **Move to any host.** Another host takes over with a higher epoch and fetches
|
||||
chunks lazily on first read. A stale holder cannot publish.
|
||||
- **Single replica by design.** Losing a host loses at most the writes since
|
||||
the last cut. Cut at semantic points: after an agent step, before a risky
|
||||
command, on detach.
|
||||
|
||||
**Kubernetes block volumes (alpha)**: Helm install, dynamic PVCs, RF=3
|
||||
recovery gates in a supported lab, support-bundle replay, and negative-first
|
||||
read-only status (stale evidence is `Ready=Unknown`, never a false ready).
|
||||
|
||||
## Measured results
|
||||
|
||||
Lab runs, median of 3; not SLOs. Workloads: Firecracker microVMs (4 vCPU,
|
||||
4 GiB) on one bare-metal host over NVMe/TCP loopback, against a local
|
||||
file-backed disk. The two `fsync` rows marked "ublk" come from a later run on
|
||||
the same host with the ublk frontend, after the group-commit fix
|
||||
([#173](https://github.com/seaweedfs/seaweed-block/pull/173)). Snapshot and
|
||||
fork: a host-side proxy without network latency, guest `fsync` or the block
|
||||
frontend. Fork was measured before it was removed from this release.
|
||||
|
||||
| Measurement | Seaweed Block | Local disk |
|
||||
|---|---|---|
|
||||
| `npm ci` (617 packages, offline) / `git clone` (Go 1.23, local) | 2.14 s / 7.10 s | 2.14 s / 6.99 s |
|
||||
| Untar 100,000 files / cold `find` + `stat` over them | 1.10 s / 0.32 s | 1.06 s / 0.33 s |
|
||||
| 2,000 × create + write + `fsync` (ublk) | 8.48 s | 6.11 s |
|
||||
| Guest `fsync` median, fio 4 KiB random write, one at a time (ublk) | 3.23 ms | 2.74 ms |
|
||||
| Snapshot / fork of a 10 GiB volume (2,560 chunks) | 0.18 ms / 0.29 ms | |
|
||||
| Two-host lifecycle: create, snapshot, fork, move, stale holder, delete, GC | 35 of 35 checks | |
|
||||
|
||||
Metadata-heavy workloads run at local-disk speed. The remaining cost is
|
||||
`fsync`: a median of 3.23 ms against 2.74 ms local with the ublk frontend
|
||||
(3.59 ms over NVMe/TCP loopback), down from about 7 ms before the group-commit
|
||||
fix. Every guest `fsync` still reaches the backend sync; no write cache is
|
||||
turned off to get there.
|
||||
[Workspace measurements](docs/workspace-measurements.md) has every number and
|
||||
how each was measured.
|
||||
|
||||
## Install
|
||||
|
||||
The binaries are `blockmaster`, `blockvolume` and the `sw-block` CLI; there is
|
||||
no versioned release yet. **Option 1:** copy them from the image that every
|
||||
push to `main` publishes (`sha-<12-character commit>`; this one is `04e76603`,
|
||||
not a release):
|
||||
|
||||
```bash
|
||||
TAG=sha-04e7660398c3
|
||||
docker create --name swb-extract ghcr.io/seaweedfs/seaweed-block:$TAG
|
||||
for b in blockmaster blockvolume sw-block; do docker cp swb-extract:/usr/local/bin/$b .; done
|
||||
docker rm swb-extract && ./blockvolume --version
|
||||
```
|
||||
|
||||
**Option 2:** build from source (the Go version in `go.mod`):
|
||||
```bash
|
||||
git clone https://github.com/seaweedfs/seaweed-block && cd seaweed-block
|
||||
for b in blockmaster blockvolume sw-block; do go build -o $b ./cmd/$b; done
|
||||
```
|
||||
|
||||
**Option 3:** Helm, see the [Kubernetes quick start](#quick-start-kubernetes-alpha).
|
||||
Services: [standalone deployment](docs/standalone-deployment.md). Operator guide (supported setup, sizing, recovery point, host loss, limits): [operator guide](docs/operator-guide.md).
|
||||
|
||||
## Try it
|
||||
|
||||
The [first volume check](docs/standalone-deployment.md#first-volume-read-only-check)
|
||||
starts `blockmaster` and one `blockvolume`, attaches a 256 MiB volume over
|
||||
NVMe/TCP on loopback, shows the device and its status, and stops. It does
|
||||
not format or write the attached device; it only creates local backing files
|
||||
and logs. It needs Linux, bash, `nvme-cli`, `sudo` and the binaries
|
||||
above. To format and write, use the [write test](docs/standalone-deployment.md#write-test-scratch-host-only) (scratch host only).
|
||||
|
||||
## Agent workspace disks: chunk lifecycle
|
||||
|
||||
The workspace path runs `blockvolume` with `--durable-impl=walstore-chunk`,
|
||||
`--chunk-filer <filer>` and `--chunk-control-endpoint`, against a SeaweedFS
|
||||
cluster. The `sw-block ops chunk` commands drive the lifecycle:
|
||||
|
||||
```bash
|
||||
sw-block ops chunk cut --volume v1 --status-addr <status> # publish changed chunks, advance HEAD
|
||||
sw-block ops chunk snapshot --volume v1 --status-addr <status> --name s1 # name a snapshot
|
||||
sw-block ops chunk snapshots --master <blockmaster> --volume v1 --chunk-filer <filer> # list snapshots
|
||||
sw-block ops chunk restore --master <blockmaster> --chunk-filer <filer> --source v1 --snapshot s1 --target v3 # new volume from a snapshot
|
||||
sw-block ops chunk detach --volume v1 --status-addr <status> # final cut (seal); moving needs revoke + move, see docs/volume-lifecycle.md
|
||||
sw-block ops chunk volume-delete --volume v2 --chunk-filer <filer> --master <blockmaster> --request-id del-v2
|
||||
```
|
||||
|
||||
`volume-delete` is refused until the volume's holder has been revoked and its ACK
|
||||
is recorded, and while the volume has snapshots: see
|
||||
[Delete a volume](docs/volume-lifecycle.md#delete-a-volume).
|
||||
Frozen detach and the pre-copy detach are not supported in this release: a
|
||||
detach with `--frozen` (`frozen:true` on `POST /chunk/detach`) is refused with
|
||||
409 `frozen_detach_unsupported`, and `blockvolume` refuses to start with
|
||||
`--chunk-detach-precopy`.
|
||||
`restore` creates the target from the snapshot; its blockvolume serves at
|
||||
once and reads every chunk it has not made local from the source's snapshot
|
||||
(there is no background copy). The source snapshot cannot be deleted while the
|
||||
target exists. Fork is not supported in this release; the command is removed.
|
||||
See [Restoring a snapshot](docs/standalone-deployment.md#restoring-a-snapshot-into-a-new-volume).
|
||||
The chunk path (`walstore-chunk`) is a proof of concept. It is not yet a
|
||||
default, a release claim or a production path.
|
||||
|
||||
## Quick start: Kubernetes (alpha)
|
||||
|
||||
For supported lab clusters, not production. From the repository root, with
|
||||
`kubectl` and `helm` configured:
|
||||
|
||||
```bash
|
||||
go build -o sw-block ./cmd/sw-block && export PATH="$PWD:$PATH"
|
||||
sw-block ops generate-helm-values --out values.day1.yaml \
|
||||
--image ghcr.io/seaweedfs/seaweed-block:sha-dc2972d0059b \
|
||||
--csi-image ghcr.io/seaweedfs/seaweed-block-csi:sha-dc2972d0059b
|
||||
helm install sw-block charts/seaweed-block --namespace kube-system \
|
||||
--create-namespace -f values.day1.yaml --wait --timeout 10m
|
||||
SW_BLOCK_INSTALL_MODE=helm SW_BLOCK_HELM_RELEASE=sw-block \
|
||||
SW_BLOCK_HELM_NAMESPACE=kube-system SW_BLOCK_HELM_VALUES_FILE=values.day1.yaml \
|
||||
bash scripts/run-basic-app-example.sh "$PWD"
|
||||
```
|
||||
|
||||
The last command writes a PVC from one pod and reads it from a replacement
|
||||
pod; expect `first_volume_status=ok` in
|
||||
`/tmp/sw-block-basic-app-*/first-volume-summary.txt`. `sha-dc2972d0059b` is
|
||||
the validated tag for the v0.4 read-only status path; later paths need
|
||||
matching [release images](docs/kubernetes-status.md#release-images), and
|
||||
`:alpha` is for smoke tests only. Each step's output is in the [Kubernetes
|
||||
quickstart](docs/quickstart-kubernetes.md). To clean up:
|
||||
|
||||
```bash
|
||||
helm uninstall sw-block --namespace kube-system
|
||||
bash scripts/uninstall-k8s-alpha.sh "$PWD" && bash scripts/verify-helm-cleanup.sh
|
||||
```
|
||||
|
||||
|
||||
## Status
|
||||
|
||||
| Area | Status |
|
||||
|---|---|
|
||||
| Agent workspace disks (`walstore-chunk`) | Proof of concept |
|
||||
| Kubernetes: Helm install, PVC provisioning, writer/reader check, read-only report and dashboard, CRD status and Events, support-bundle replay | Available (alpha) |
|
||||
| Kubernetes: RF=3 multi-volume, CSI reattach recovery, iSCSI ALUA/dm-multipath mounted failover, restart persistence with hostPath | Gated (supported lab) |
|
||||
| Kubernetes: `SwBlockVolume` finalizer lifecycle owner, returned-replica ACK eligibility executor | Beta candidate |
|
||||
| Kubernetes: NVMe/TCP CSI multipath, returned-replica failback runtime, WAL multi-block record opt-in | Source-gated |
|
||||
| Kubernetes: backup, snapshot and restore; returned-replica rebuild traffic | Planned |
|
||||
|
||||
Full table and conditions: [Kubernetes status](docs/kubernetes-status.md);
|
||||
run evidence: [release notes](docs/releases/README.md).
|
||||
|
||||
**Upgrade note:** blockmaster listens off loopback only with mutual TLS
|
||||
(`--tls-cert`, `--tls-key`, `--tls-client-ca`, `--role-file`); the runtime HTTP
|
||||
listener always stays on loopback, and `--insecure-external-bind` is refused.
|
||||
The Helm chart and the shipped manifests run with mutual TLS; create their
|
||||
Secrets first ([quickstart](docs/quickstart-kubernetes.md)).
|
||||
|
||||
### Not claimed yet
|
||||
|
||||
- Production readiness, SLOs, or a published performance, RTO or RPO claim.
|
||||
- `fsync` parity with local disk. Today it is about 1.2× local (see Measured
|
||||
results).
|
||||
- ublk at high density. Unprivileged per-volume servers need a privileged
|
||||
control broker, which is not done.
|
||||
- Crash-restart recovery of a ublk server. A crashed server fails closed.
|
||||
- Multi-replica workspaces combined with chunk snapshots.
|
||||
- The `smartwal` engine, which is experimental: no rollback for a torn
|
||||
in-place overwrite, no per-block CRC once its ring record recycles, open
|
||||
handling of a corrupted committed record, and no chunk snapshots.
|
||||
- Kubernetes: backup and restore, a production operator, automatic failback
|
||||
or cleanup, upgrade execution, broad compatibility, and more: see
|
||||
[what you should not expect yet](docs/kubernetes-status.md#what-you-should-not-expect-yet).
|
||||
|
||||
## Correctness and verification
|
||||
|
||||
- **CI** runs `go build`, `go vet` and `go test -short` on every pull request
|
||||
and push to `main` ([workflow](.github/workflows/test.yml)); that set leaves out the four
|
||||
long, disk-heavy packages (a pull request runs those of them it changes);
|
||||
they run in full, together with the legacy-fixture configuration, on a
|
||||
separate test VM for every merge train (commit status `full-suite (pool VM)`
|
||||
on the train head). Crash,
|
||||
mutation, real-SeaweedFS and binary tests are described in the
|
||||
[core design, Part 2](docs/design/block-design.md#part-2-verification-lessons-known-issues),
|
||||
with the known issues.
|
||||
- **Formal models**: [TLA+ specifications](docs/spec/README.md) of the
|
||||
protocols where a bug would lose data. Counterexamples became fixes and
|
||||
regression tests ([#152](https://github.com/seaweedfs/seaweed-block/pull/152), [#156](https://github.com/seaweedfs/seaweed-block/pull/156), [#158](https://github.com/seaweedfs/seaweed-block/pull/158), [#159](https://github.com/seaweedfs/seaweed-block/pull/159)).
|
||||
- **Fail closed**: recovery that cannot establish a consistent image reports
|
||||
a typed reason (`wal_corrupt`, `io_error`) instead of serving; some
|
||||
suspected damage (`wal_hole_suspected`) is a status warning only.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Design: [core](docs/design/block-design.md), [agent workspace](docs/design/agent-workspace-design.md),
|
||||
[Kubernetes block](docs/design/kubernetes-block-design.md), [invariants and state machines](docs/design/invariants.md),
|
||||
[TLA+ specifications](docs/spec/README.md),
|
||||
[workspace measurements](docs/workspace-measurements.md)
|
||||
- Operations: [standalone deployment](docs/standalone-deployment.md),
|
||||
[volume lifecycle](docs/volume-lifecycle.md),
|
||||
[Kubernetes quickstart](docs/quickstart-kubernetes.md), [user capabilities](docs/user-capabilities.md)
|
||||
- Claims: [Kubernetes status](docs/kubernetes-status.md), [release notes](docs/releases/README.md),
|
||||
[NVMe/TCP supported-lab claim](docs/releases/nvme-tcp-supported-lab.md),
|
||||
[known issues and work in progress](docs/design/block-design.md#24-known-issues-and-work-in-progress)
|
||||
- Engineering references, not release-claim sources: [architecture](docs/architecture.md),
|
||||
[developer architecture](docs/developer-architecture.md), [runtime state machines](docs/runtime-state-machines.md)
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
go build ./... && go vet ./... && go test -short ./... # what CI runs
|
||||
go test ./cmd/sw-block ./core/ops ./core/csi ./core/launcher ./core/host/master -count=1 # release-scoped
|
||||
```
|
||||
|
||||
The full `go test ./...` sweep may include in-progress packages outside the
|
||||
release gate. `scripts/activate-k8s-alpha.sh` remains for local images.
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
@@ -1,5 +0,0 @@
|
||||
.git/
|
||||
.github/
|
||||
results/
|
||||
*.tmp
|
||||
*.log
|
||||
@@ -1,6 +0,0 @@
|
||||
apiVersion: v2
|
||||
name: seaweed-block
|
||||
description: Seaweed Block Kubernetes CSI storage provider
|
||||
type: application
|
||||
version: 0.3.0-alpha.0
|
||||
appVersion: "0.3-alpha"
|
||||
@@ -1,173 +0,0 @@
|
||||
# Seaweed Block Helm Chart
|
||||
|
||||
This chart installs the Seaweed Block alpha Kubernetes CSI stack:
|
||||
|
||||
- `sw-blockmaster`
|
||||
- CSI controller
|
||||
- CSI node DaemonSet
|
||||
- optional `StorageClass`
|
||||
- optional CHAP secret for cross-node iSCSI
|
||||
|
||||
The chart is read/write only through Kubernetes PVCs. It does not add a
|
||||
mutating dashboard, operator reconciliation, backup/restore, or upgrade safety.
|
||||
|
||||
## Quick Install
|
||||
|
||||
Use generated values for the supported alpha install path. The generator reads
|
||||
the live Kubernetes nodes and writes the node names/IPs that the launcher uses
|
||||
for placement. On a single-node lab it keeps loopback/local-consumer mode; on a
|
||||
multi-node lab it switches to non-loopback iSCSI with CHAP. For the
|
||||
experimental NVMe/TCP path, pass `--protocol nvme`; this switches to
|
||||
non-loopback NVMe/TCP, without enabling iSCSI CHAP.
|
||||
|
||||
blockmaster runs with mutual TLS, so create its Secrets before installing
|
||||
(`tls.*` values name them; the helper issues development certificates, one
|
||||
node certificate per server id).
|
||||
|
||||
```bash
|
||||
SW_BLOCK_HELM_VALUES_OUT=values.day1.yaml \
|
||||
bash scripts/generate-helm-values-day1.sh "$PWD"
|
||||
|
||||
bash scripts/k8s-alpha-certs.sh kube-system ~/.sw-block-alpha-tls <server id>...
|
||||
|
||||
helm install sw-block charts/seaweed-block \
|
||||
--namespace kube-system \
|
||||
-f values.day1.yaml
|
||||
```
|
||||
|
||||
The raw chart defaults are render/development defaults only. Do not treat a
|
||||
plain `helm install sw-block charts/seaweed-block` as a release-gated install:
|
||||
it does not run preflight, does not discover the live Kubernetes node set, and
|
||||
can leave placement/launcher evidence incomplete on real labs.
|
||||
|
||||
A complete three-node example is in
|
||||
[`examples/values-3node.yaml`](examples/values-3node.yaml): image tags, network
|
||||
and compat settings, CHAP, the StorageClass replication factor, and three
|
||||
`blockNodes` (`node-a`, `node-b`, `node-c`, with RFC 5737 documentation
|
||||
addresses). Copy it and replace the node names and addresses with your own:
|
||||
|
||||
```bash
|
||||
helm install sw-block charts/seaweed-block -f my-values.yaml
|
||||
```
|
||||
|
||||
`blockNodes[*].kubernetesNode` must match a real Kubernetes node name. The
|
||||
`internalIP` is the management/control-plane address. `frontendIP` is optional;
|
||||
when set, blockvolume `data_addr` and NVMe/TCP or iSCSI publish targets use
|
||||
that address while `ctrl_addr` remains on `internalIP`. Use
|
||||
`frontendNetworkClass: 100gbe_tcp` for a TCP frontend on the lab 100GbE data
|
||||
network.
|
||||
|
||||
The source-gated NVMe/RDMA path is explicit and remains off by default:
|
||||
|
||||
```yaml
|
||||
storageClass:
|
||||
protocol: nvme
|
||||
nvmeTransport: rdma
|
||||
network:
|
||||
externalNVMe: true
|
||||
blockNodes:
|
||||
- name: node-b
|
||||
kubernetesNode: node-b
|
||||
internalIP: 192.0.2.12
|
||||
frontendIP: 198.51.100.12
|
||||
frontendNetworkClass: 100gbe_roce
|
||||
```
|
||||
|
||||
RDMA requires a non-loopback RoCE frontend address and host `nvme-rdma`,
|
||||
`nvmet-rdma`, NBD, configfs, and RDMA-device prerequisites. This supported-lab
|
||||
path does not claim RDMA multipath, failover, performance improvement, or an
|
||||
SLO.
|
||||
|
||||
`network.rejectLoopbackPublishTargets` records the intended safety boundary.
|
||||
Some blockmaster launcher flags are gated by `compat.*` settings because older
|
||||
published alpha images do not accept every v0.3 flag. Keep
|
||||
`compat.launcherDurableImplFlag`, `compat.launcherReplicationAckFlag`, and
|
||||
`compat.launcherRejectLoopbackFlag` false unless the selected image is known to
|
||||
support the corresponding flag. The default durable implementation is still
|
||||
`walstore` because that is the blockmaster binary default when the
|
||||
`--launcher-durable-impl` flag is omitted.
|
||||
|
||||
For source-gated NVMe/TCP write-path experiments, `nvme.maxH2CDataLength` can
|
||||
be set explicitly. The chart default is `32768`; `65536` has a supported-lab
|
||||
gate as an opt-in candidate. This is not a default change, NVMe/RDMA/RoCE
|
||||
claim, or performance SLO.
|
||||
|
||||
For source-gated WAL write-path experiments, multi-block WAL records can be
|
||||
enabled explicitly:
|
||||
|
||||
```yaml
|
||||
blockmaster:
|
||||
durableWALMultiBlockRecords: true
|
||||
```
|
||||
|
||||
This is a lab-only optimization boundary backed by Phase 151/152/155 gates. It
|
||||
is not a release-image claim until a matching-image smoke runs the explicit
|
||||
opt-in recovery/status path. The default remains `false`. Do not set
|
||||
`durableWALRecoveryTestDisableFlusher` outside recovery-test gates; that flag is
|
||||
scaffolding used to force WAL replay evidence and is not a production tuning
|
||||
knob.
|
||||
|
||||
## RF=3 Sync-Quorum Profile
|
||||
|
||||
For the gated RF=3 recovery shape:
|
||||
|
||||
```yaml
|
||||
storageClass:
|
||||
replicationFactor: 3
|
||||
replication:
|
||||
ackProfile: sync-quorum
|
||||
expectedSlotsPerVolume: 3
|
||||
network:
|
||||
externalISCSI: true
|
||||
externalNVMe: false
|
||||
externalStatus: false
|
||||
rejectLoopbackPublishTargets: true
|
||||
chap:
|
||||
enabled: true
|
||||
username: swblock
|
||||
secret: replace-with-a-real-secret
|
||||
```
|
||||
|
||||
## Stage 2 Multipath Baseline
|
||||
|
||||
Stage 2 iSCSI ALUA/dm-multipath requires host prerequisites and is intentionally
|
||||
opt-in:
|
||||
|
||||
```yaml
|
||||
stage2Multipath:
|
||||
enabled: true
|
||||
```
|
||||
|
||||
This only enables chart wiring. The host still needs iSCSI, multipath, and ALUA
|
||||
support configured.
|
||||
|
||||
## Optional Failback Runtime Wiring
|
||||
|
||||
Returned-replica failback execution is disabled by default. The chart only
|
||||
renders the blockmaster failback RPC and executor runtime flags when all
|
||||
execution switches are explicit:
|
||||
|
||||
```yaml
|
||||
blockmaster:
|
||||
failbackRuntimeRPC: true
|
||||
|
||||
failbackExecutor:
|
||||
create: true
|
||||
dryRun: false
|
||||
execution:
|
||||
enabled: true
|
||||
policy: true
|
||||
failbackRuntimeGrpcAddr: blockmaster.kube-system.svc:9333
|
||||
```
|
||||
|
||||
The chart rejects unsafe combinations such as execution with `dryRun: true`,
|
||||
missing execution policy, or both HTTP and gRPC runtime addresses. This wiring
|
||||
does not enable automatic failback by default.
|
||||
|
||||
## Current Boundary
|
||||
|
||||
- Use immutable image tags such as `sha-<commit>` for QA and release checks.
|
||||
- `:alpha` is a convenience tag and can drift from local source.
|
||||
- Dynamic node discovery/onboarding is not yet handled by this chart. For now,
|
||||
update `blockNodes` and run `helm upgrade`.
|
||||
- Operator-managed node discovery, repair, and upgrade flows are future work.
|
||||
@@ -1,318 +0,0 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: swblockclusters.block.seaweedfs.com
|
||||
spec:
|
||||
group: block.seaweedfs.com
|
||||
scope: Namespaced
|
||||
names:
|
||||
plural: swblockclusters
|
||||
singular: swblockcluster
|
||||
kind: SwBlockCluster
|
||||
shortNames:
|
||||
- swbc
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
additionalPrinterColumns:
|
||||
- name: Ready
|
||||
type: integer
|
||||
jsonPath: .status.readyVolumeCount
|
||||
- name: Blocked
|
||||
type: integer
|
||||
jsonPath: .status.blockedVolumeCount
|
||||
- name: Stale
|
||||
type: integer
|
||||
jsonPath: .status.staleVolumeCount
|
||||
- name: Age
|
||||
type: date
|
||||
jsonPath: .metadata.creationTimestamp
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
description: Read-only Seaweed Block cluster status projection.
|
||||
properties:
|
||||
spec:
|
||||
type: object
|
||||
description: Declarative install metadata. Phase 35 does not reconcile spec into storage mutation.
|
||||
properties:
|
||||
image:
|
||||
type: string
|
||||
csiImage:
|
||||
type: string
|
||||
storageClass:
|
||||
type: string
|
||||
ackProfile:
|
||||
type: string
|
||||
protocol:
|
||||
type: string
|
||||
blockNodes:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
internalIP:
|
||||
type: string
|
||||
frontendIP:
|
||||
type: string
|
||||
frontendNetworkClass:
|
||||
type: string
|
||||
status:
|
||||
type: object
|
||||
properties:
|
||||
observedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
observedGeneration:
|
||||
type: integer
|
||||
format: int64
|
||||
nodeCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
nodes:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- schedulable
|
||||
- ready
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
kubernetesNode:
|
||||
type: string
|
||||
internalIP:
|
||||
type: string
|
||||
frontendIP:
|
||||
type: string
|
||||
frontendNetworkClass:
|
||||
type: string
|
||||
schedulable:
|
||||
type: boolean
|
||||
ready:
|
||||
type: boolean
|
||||
status:
|
||||
type: string
|
||||
reasonCode:
|
||||
type: string
|
||||
lastHeartbeatAt:
|
||||
type: string
|
||||
format: date-time
|
||||
replicaCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
requiredImages:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
missingImages:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- status
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- Ready
|
||||
- Recovered
|
||||
- Recovering
|
||||
- Blocked
|
||||
- Invalid
|
||||
- CleanupRequired
|
||||
- EvidenceStale
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
reason:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- error
|
||||
message:
|
||||
type: string
|
||||
lastTransitionTime:
|
||||
type: string
|
||||
format: date-time
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
volumeCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
readyVolumeCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
blockedVolumeCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
staleVolumeCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- status
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- Ready
|
||||
- Recovered
|
||||
- Recovering
|
||||
- Blocked
|
||||
- Invalid
|
||||
- CleanupRequired
|
||||
- EvidenceStale
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
reason:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- error
|
||||
message:
|
||||
type: string
|
||||
lastTransitionTime:
|
||||
type: string
|
||||
format: date-time
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
supportBundleRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
cleanup:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
k8sResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
iscsiResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
multipathResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
processResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
hostPathResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
failureCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
failedPhase:
|
||||
type: string
|
||||
reasonCodes:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRef:
|
||||
type: string
|
||||
installDrift:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
- mismatch
|
||||
- unknown
|
||||
reasonCode:
|
||||
type: string
|
||||
chartName:
|
||||
type: string
|
||||
currentChartVersion:
|
||||
type: string
|
||||
desiredChartVersion:
|
||||
type: string
|
||||
currentAppVersion:
|
||||
type: string
|
||||
desiredAppVersion:
|
||||
type: string
|
||||
currentImage:
|
||||
type: string
|
||||
desiredImage:
|
||||
type: string
|
||||
currentCsiImage:
|
||||
type: string
|
||||
desiredCsiImage:
|
||||
type: string
|
||||
currentOperatorImage:
|
||||
type: string
|
||||
desiredOperatorImage:
|
||||
type: string
|
||||
evidenceRef:
|
||||
type: string
|
||||
safeNextSteps:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- mode
|
||||
- mutationAllowed
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
mode:
|
||||
type: string
|
||||
enum:
|
||||
- read_only
|
||||
- dry_run
|
||||
- scripted
|
||||
command:
|
||||
type: string
|
||||
reasonCode:
|
||||
type: string
|
||||
mutationAllowed:
|
||||
type: boolean
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
-174
@@ -1,174 +0,0 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: swblockfrontendpublications.block.seaweedfs.com
|
||||
spec:
|
||||
group: block.seaweedfs.com
|
||||
scope: Namespaced
|
||||
names:
|
||||
plural: swblockfrontendpublications
|
||||
singular: swblockfrontendpublication
|
||||
kind: SwBlockFrontendPublication
|
||||
shortNames:
|
||||
- swbfp
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
additionalPrinterColumns:
|
||||
- name: Volume
|
||||
type: string
|
||||
jsonPath: .spec.volumeName
|
||||
- name: Replica
|
||||
type: string
|
||||
jsonPath: .spec.replicaID
|
||||
- name: State
|
||||
type: string
|
||||
jsonPath: .status.state
|
||||
- name: Reason
|
||||
type: string
|
||||
jsonPath: .status.reasonCode
|
||||
- name: Age
|
||||
type: date
|
||||
jsonPath: .metadata.creationTimestamp
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
description: Narrow target for future frontend publication. Phase 69 creates the target only; it does not publish frontend paths.
|
||||
properties:
|
||||
spec:
|
||||
type: object
|
||||
description: Identity and terminal ACK evidence required before a future frontend publication executor may act.
|
||||
required:
|
||||
- volumeName
|
||||
- replicaID
|
||||
properties:
|
||||
volumeName:
|
||||
type: string
|
||||
volumeID:
|
||||
type: string
|
||||
pvcName:
|
||||
type: string
|
||||
replicaID:
|
||||
type: string
|
||||
targetDataAddr:
|
||||
type: string
|
||||
targetCtrlAddr:
|
||||
type: string
|
||||
sourceEligibilityName:
|
||||
type: string
|
||||
sourceFailbackName:
|
||||
type: string
|
||||
ackEligibilityKnown:
|
||||
type: boolean
|
||||
ackEligible:
|
||||
type: boolean
|
||||
frontendFencedAfterExecution:
|
||||
type: boolean
|
||||
primaryUnchanged:
|
||||
type: boolean
|
||||
durableFrontierCovered:
|
||||
type: boolean
|
||||
noCrossVolumeIdentityChange:
|
||||
type: boolean
|
||||
failbackCompleted:
|
||||
type: boolean
|
||||
authorityEpochAdvanced:
|
||||
type: boolean
|
||||
singlePrimaryAfterFailback:
|
||||
type: boolean
|
||||
publishTargetSwappedAfterFailback:
|
||||
type: boolean
|
||||
frontendPublicationDecision:
|
||||
type: string
|
||||
enum:
|
||||
- blocked
|
||||
- disabled
|
||||
- enabled
|
||||
frontendPublicationReason:
|
||||
type: string
|
||||
frontendPublicationMutationAllowed:
|
||||
type: boolean
|
||||
runtimeEndpoint:
|
||||
type: string
|
||||
status:
|
||||
type: object
|
||||
properties:
|
||||
observedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
observedGeneration:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
executor:
|
||||
type: string
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- planned
|
||||
- blocked
|
||||
- published
|
||||
reasonCode:
|
||||
type: string
|
||||
publicationMutationAllowed:
|
||||
type: boolean
|
||||
frontendPublished:
|
||||
type: boolean
|
||||
failbackStarted:
|
||||
type: boolean
|
||||
noStorageMutation:
|
||||
type: boolean
|
||||
noCrossVolumeIdentityChange:
|
||||
type: boolean
|
||||
evidenceGeneration:
|
||||
type: string
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- status
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- Ready
|
||||
- Blocked
|
||||
- Recovering
|
||||
- Recovered
|
||||
- EvidenceStale
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
reason:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- error
|
||||
message:
|
||||
type: string
|
||||
lastTransitionTime:
|
||||
type: string
|
||||
format: date-time
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
nonClaims:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: swblockreplicaeligibilities.block.seaweedfs.com
|
||||
spec:
|
||||
group: block.seaweedfs.com
|
||||
scope: Namespaced
|
||||
names:
|
||||
plural: swblockreplicaeligibilities
|
||||
singular: swblockreplicaeligibility
|
||||
kind: SwBlockReplicaEligibility
|
||||
shortNames:
|
||||
- swbre
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
additionalPrinterColumns:
|
||||
- name: Volume
|
||||
type: string
|
||||
jsonPath: .spec.volumeName
|
||||
- name: Replica
|
||||
type: string
|
||||
jsonPath: .spec.replicaID
|
||||
- name: Eligible
|
||||
type: boolean
|
||||
jsonPath: .status.ackEligible
|
||||
- name: Reason
|
||||
type: string
|
||||
jsonPath: .status.reasonCode
|
||||
- name: Age
|
||||
type: date
|
||||
jsonPath: .metadata.creationTimestamp
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
description: Narrow ACK eligibility evidence target for returned-replica reintegration.
|
||||
properties:
|
||||
spec:
|
||||
type: object
|
||||
description: Identity of the returned replica whose ACK eligibility may be recorded.
|
||||
required:
|
||||
- volumeName
|
||||
- replicaID
|
||||
properties:
|
||||
volumeName:
|
||||
type: string
|
||||
volumeID:
|
||||
type: string
|
||||
pvcName:
|
||||
type: string
|
||||
replicaID:
|
||||
type: string
|
||||
status:
|
||||
type: object
|
||||
properties:
|
||||
observedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
observedGeneration:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
executor:
|
||||
type: string
|
||||
reasonCode:
|
||||
type: string
|
||||
ackEligibilityKnown:
|
||||
type: boolean
|
||||
ackEligible:
|
||||
type: boolean
|
||||
frontendFencedAfterExecution:
|
||||
type: boolean
|
||||
primaryUnchanged:
|
||||
type: boolean
|
||||
durableFrontierCovered:
|
||||
type: boolean
|
||||
noCrossVolumeIdentityChange:
|
||||
type: boolean
|
||||
frontendPublicationDecision:
|
||||
type: string
|
||||
enum:
|
||||
- blocked
|
||||
- disabled
|
||||
frontendPublicationReason:
|
||||
type: string
|
||||
frontendPublicationMutationAllowed:
|
||||
type: boolean
|
||||
evidenceGeneration:
|
||||
type: string
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- status
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- Ready
|
||||
- Blocked
|
||||
- EvidenceStale
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
reason:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- error
|
||||
message:
|
||||
type: string
|
||||
lastTransitionTime:
|
||||
type: string
|
||||
format: date-time
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
nonClaims:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
-163
@@ -1,163 +0,0 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: swblockreplicafailbacks.block.seaweedfs.com
|
||||
spec:
|
||||
group: block.seaweedfs.com
|
||||
scope: Namespaced
|
||||
names:
|
||||
plural: swblockreplicafailbacks
|
||||
singular: swblockreplicafailback
|
||||
kind: SwBlockReplicaFailback
|
||||
shortNames:
|
||||
- swbrf
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
additionalPrinterColumns:
|
||||
- name: Volume
|
||||
type: string
|
||||
jsonPath: .spec.volumeName
|
||||
- name: Replica
|
||||
type: string
|
||||
jsonPath: .spec.replicaID
|
||||
- name: State
|
||||
type: string
|
||||
jsonPath: .status.state
|
||||
- name: Reason
|
||||
type: string
|
||||
jsonPath: .status.reasonCode
|
||||
- name: Age
|
||||
type: date
|
||||
jsonPath: .metadata.creationTimestamp
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
description: Narrow target for future returned-replica authority failback. Phase 75 creates the target only; it does not mutate authority.
|
||||
properties:
|
||||
spec:
|
||||
type: object
|
||||
description: Identity and terminal ACK evidence required before a future failback executor may act.
|
||||
required:
|
||||
- volumeName
|
||||
- replicaID
|
||||
properties:
|
||||
volumeName:
|
||||
type: string
|
||||
volumeID:
|
||||
type: string
|
||||
pvcName:
|
||||
type: string
|
||||
replicaID:
|
||||
type: string
|
||||
targetDataAddr:
|
||||
type: string
|
||||
targetCtrlAddr:
|
||||
type: string
|
||||
expectedCurrentReplicaID:
|
||||
type: string
|
||||
expectedCurrentEpoch:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
ackEligible:
|
||||
type: boolean
|
||||
frontendFencedBeforeFailback:
|
||||
type: boolean
|
||||
durableFrontierCovered:
|
||||
type: boolean
|
||||
noCrossVolumeIdentityChange:
|
||||
type: boolean
|
||||
failbackDecision:
|
||||
type: string
|
||||
enum: ["disabled", "enabled"]
|
||||
failbackReason:
|
||||
type: string
|
||||
failbackMutationAllowed:
|
||||
type: boolean
|
||||
runtimeEndpoint:
|
||||
type: string
|
||||
status:
|
||||
type: object
|
||||
properties:
|
||||
observedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
observedGeneration:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
executor:
|
||||
type: string
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- planned
|
||||
- blocked
|
||||
- failed_back
|
||||
reasonCode:
|
||||
type: string
|
||||
failbackMutationAllowed:
|
||||
type: boolean
|
||||
failbackStarted:
|
||||
type: boolean
|
||||
authorityEpochAdvanced:
|
||||
type: boolean
|
||||
singlePrimaryAfterFailback:
|
||||
type: boolean
|
||||
publishTargetSwappedAfterFailback:
|
||||
type: boolean
|
||||
noCrossVolumeIdentityChange:
|
||||
type: boolean
|
||||
evidenceGeneration:
|
||||
type: string
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- status
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- Ready
|
||||
- Blocked
|
||||
- Recovering
|
||||
- Recovered
|
||||
- EvidenceStale
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
reason:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- error
|
||||
message:
|
||||
type: string
|
||||
lastTransitionTime:
|
||||
type: string
|
||||
format: date-time
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
nonClaims:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
-188
@@ -1,188 +0,0 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: swblockreplicarebuilds.block.seaweedfs.com
|
||||
spec:
|
||||
group: block.seaweedfs.com
|
||||
scope: Namespaced
|
||||
names:
|
||||
plural: swblockreplicarebuilds
|
||||
singular: swblockreplicarebuild
|
||||
kind: SwBlockReplicaRebuild
|
||||
shortNames:
|
||||
- swbrr
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
additionalPrinterColumns:
|
||||
- name: Volume
|
||||
type: string
|
||||
jsonPath: .spec.volumeName
|
||||
- name: Replica
|
||||
type: string
|
||||
jsonPath: .spec.replicaID
|
||||
- name: State
|
||||
type: string
|
||||
jsonPath: .status.state
|
||||
- name: Reason
|
||||
type: string
|
||||
jsonPath: .status.reasonCode
|
||||
- name: Age
|
||||
type: date
|
||||
jsonPath: .metadata.creationTimestamp
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
description: Narrow status target for returned-replica rebuild/catch-up progress evidence.
|
||||
properties:
|
||||
spec:
|
||||
type: object
|
||||
description: Identity of the returned replica whose rebuild/catch-up progress may be recorded.
|
||||
required:
|
||||
- volumeName
|
||||
- replicaID
|
||||
properties:
|
||||
volumeName:
|
||||
type: string
|
||||
volumeID:
|
||||
type: string
|
||||
pvcName:
|
||||
type: string
|
||||
replicaID:
|
||||
type: string
|
||||
sourceReplicaID:
|
||||
type: string
|
||||
runtimeEndpoint:
|
||||
type: string
|
||||
targetDataAddr:
|
||||
type: string
|
||||
sessionID:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
epoch:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
endpointVersion:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
fromLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
frontierHintLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
basePinLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
status:
|
||||
type: object
|
||||
properties:
|
||||
observedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
observedGeneration:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
executor:
|
||||
type: string
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- planned
|
||||
- blocked
|
||||
- running
|
||||
- caught_up
|
||||
reasonCode:
|
||||
type: string
|
||||
frontendFencedBeforeRebuild:
|
||||
type: boolean
|
||||
primaryUnchanged:
|
||||
type: boolean
|
||||
durableFrontierKnown:
|
||||
type: boolean
|
||||
durableFrontierLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
requiredFrontierKnown:
|
||||
type: boolean
|
||||
requiredFrontierLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
durableFrontierCaughtUp:
|
||||
type: boolean
|
||||
rebuildTrafficStarted:
|
||||
type: boolean
|
||||
publicationDecision:
|
||||
type: string
|
||||
enum:
|
||||
- blocked
|
||||
- disabled
|
||||
publicationReason:
|
||||
type: string
|
||||
publicationMutationAllowed:
|
||||
type: boolean
|
||||
noFrontendPublication:
|
||||
type: boolean
|
||||
noCrossVolumeIdentityChange:
|
||||
type: boolean
|
||||
evidenceGeneration:
|
||||
type: string
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- status
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- Ready
|
||||
- Blocked
|
||||
- Recovering
|
||||
- Recovered
|
||||
- EvidenceStale
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
reason:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- error
|
||||
message:
|
||||
type: string
|
||||
lastTransitionTime:
|
||||
type: string
|
||||
format: date-time
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
nonClaims:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
@@ -1,442 +0,0 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: swblockvolumes.block.seaweedfs.com
|
||||
spec:
|
||||
group: block.seaweedfs.com
|
||||
scope: Namespaced
|
||||
names:
|
||||
plural: swblockvolumes
|
||||
singular: swblockvolume
|
||||
kind: SwBlockVolume
|
||||
shortNames:
|
||||
- swbv
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
additionalPrinterColumns:
|
||||
- name: Status
|
||||
type: string
|
||||
jsonPath: .status.status
|
||||
- name: Reason
|
||||
type: string
|
||||
jsonPath: .status.reasonCode
|
||||
- name: PVC
|
||||
type: string
|
||||
jsonPath: .status.pvcName
|
||||
- name: Age
|
||||
type: date
|
||||
jsonPath: .metadata.creationTimestamp
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
description: Read-only Seaweed Block volume status projection.
|
||||
properties:
|
||||
spec:
|
||||
type: object
|
||||
description: PVC binding metadata. Phase 35 does not reconcile spec into storage mutation.
|
||||
properties:
|
||||
pvcName:
|
||||
type: string
|
||||
storageClass:
|
||||
type: string
|
||||
status:
|
||||
type: object
|
||||
properties:
|
||||
volumeID:
|
||||
type: string
|
||||
pvcName:
|
||||
type: string
|
||||
primaryReplicaID:
|
||||
type: string
|
||||
publishTarget:
|
||||
type: string
|
||||
authorityEpoch:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
authorityEndpointVersion:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ready
|
||||
- recovered
|
||||
- recovering
|
||||
- degraded
|
||||
- blocked
|
||||
- invalid
|
||||
- unsafe
|
||||
- unknown
|
||||
reasonCode:
|
||||
type: string
|
||||
observedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- status
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- Ready
|
||||
- Recovered
|
||||
- Recovering
|
||||
- Blocked
|
||||
- Invalid
|
||||
- CleanupRequired
|
||||
- EvidenceStale
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
reason:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- error
|
||||
message:
|
||||
type: string
|
||||
lastTransitionTime:
|
||||
type: string
|
||||
format: date-time
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
deleteSafety:
|
||||
type: object
|
||||
properties:
|
||||
actionType:
|
||||
type: string
|
||||
decision:
|
||||
type: string
|
||||
enum:
|
||||
- allowed
|
||||
- rejected
|
||||
- unknown
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- not_requested
|
||||
- requested
|
||||
- blocked
|
||||
- releasable
|
||||
- released
|
||||
reason:
|
||||
type: string
|
||||
finalizerReleaseAllowed:
|
||||
type: boolean
|
||||
missingFacts:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
safeNextAction:
|
||||
type: string
|
||||
nvme:
|
||||
type: object
|
||||
properties:
|
||||
protocol:
|
||||
type: string
|
||||
enum:
|
||||
- nvme
|
||||
transport:
|
||||
type: string
|
||||
enum:
|
||||
- tcp
|
||||
- rdma
|
||||
nqn:
|
||||
type: string
|
||||
nsid:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
nvmeAddr:
|
||||
type: string
|
||||
nvmeAddrs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
pathCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
multipathObserved:
|
||||
type: boolean
|
||||
anaState:
|
||||
type: string
|
||||
reasonCode:
|
||||
type: string
|
||||
replicaReintegrations:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- replicaID
|
||||
- state
|
||||
- frontendFenced
|
||||
- frontendPrimaryReady
|
||||
- ackEligibilityKnown
|
||||
- ackEligible
|
||||
- durableFrontierKnown
|
||||
properties:
|
||||
replicaID:
|
||||
type: string
|
||||
state:
|
||||
type: string
|
||||
enum:
|
||||
- fenced
|
||||
- recovering
|
||||
- ready
|
||||
- blocked
|
||||
- unknown
|
||||
reasonCode:
|
||||
type: string
|
||||
frontendFenced:
|
||||
type: boolean
|
||||
frontendPrimaryReady:
|
||||
type: boolean
|
||||
ackEligibilityKnown:
|
||||
type: boolean
|
||||
ackEligible:
|
||||
type: boolean
|
||||
durableFrontierKnown:
|
||||
type: boolean
|
||||
durableFrontierLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
requiredFrontierKnown:
|
||||
type: boolean
|
||||
requiredFrontierLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
runtimeEndpoint:
|
||||
type: string
|
||||
targetDataAddr:
|
||||
type: string
|
||||
targetCtrlAddr:
|
||||
type: string
|
||||
sessionID:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
epoch:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
endpointVersion:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
fromLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
frontierHintLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
basePinLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
executorPreflights:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- actionType
|
||||
- decision
|
||||
- reason
|
||||
- mode
|
||||
- sideEffectClass
|
||||
- ownerExecutor
|
||||
- mutationAllowed
|
||||
- frontendFenced
|
||||
- ackEligibilityKnown
|
||||
- ackEligible
|
||||
- durableFrontierKnown
|
||||
- requiredFrontierKnown
|
||||
properties:
|
||||
actionType:
|
||||
type: string
|
||||
replicaID:
|
||||
type: string
|
||||
decision:
|
||||
type: string
|
||||
enum:
|
||||
- ready
|
||||
- hold
|
||||
reason:
|
||||
type: string
|
||||
mode:
|
||||
type: string
|
||||
enum:
|
||||
- dry_run
|
||||
sideEffectClass:
|
||||
type: string
|
||||
enum:
|
||||
- authority_mutating
|
||||
ownerExecutor:
|
||||
type: string
|
||||
mutationAllowed:
|
||||
type: boolean
|
||||
frontendFenced:
|
||||
type: boolean
|
||||
ackEligibilityKnown:
|
||||
type: boolean
|
||||
ackEligible:
|
||||
type: boolean
|
||||
durableFrontierKnown:
|
||||
type: boolean
|
||||
durableFrontierLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
requiredFrontierKnown:
|
||||
type: boolean
|
||||
requiredFrontierLsn:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
evidenceRequired:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
forbiddenMutationClass:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
executorContracts:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- actionType
|
||||
- decision
|
||||
- reason
|
||||
- ownerExecutor
|
||||
- executionEnabled
|
||||
- mutationAllowed
|
||||
properties:
|
||||
actionType:
|
||||
type: string
|
||||
replicaID:
|
||||
type: string
|
||||
decision:
|
||||
type: string
|
||||
enum:
|
||||
- blocked
|
||||
- disabled
|
||||
reason:
|
||||
type: string
|
||||
ownerExecutor:
|
||||
type: string
|
||||
executionEnabled:
|
||||
type: boolean
|
||||
mutationAllowed:
|
||||
type: boolean
|
||||
preflightDecision:
|
||||
type: string
|
||||
preflightReason:
|
||||
type: string
|
||||
allowedMutationClass:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
forbiddenMutationClass:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
terminalEvidenceRequired:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
nonClaims:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
allowedActions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- mode
|
||||
- mutationAllowed
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
mode:
|
||||
type: string
|
||||
enum:
|
||||
- read_only
|
||||
- dry_run
|
||||
- scripted
|
||||
sideEffectClass:
|
||||
type: string
|
||||
ownerExecutor:
|
||||
type: string
|
||||
decision:
|
||||
type: string
|
||||
enum:
|
||||
- allowed
|
||||
- rejected
|
||||
- unknown
|
||||
decisionReason:
|
||||
type: string
|
||||
missingFacts:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
mutationAllowed:
|
||||
type: boolean
|
||||
preconditions:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
invariantRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRequired:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
@@ -1,48 +0,0 @@
|
||||
# Example values for a three-node install (see ../README.md).
|
||||
#
|
||||
# Node names and addresses are placeholders. The addresses come from the
|
||||
# RFC 5737 documentation ranges: 192.0.2.0/24 stands for the internal
|
||||
# (management/control-plane) network and 198.51.100.0/24 for the frontend
|
||||
# (data-plane) network. Replace them with your own Kubernetes node names and
|
||||
# addresses; `sw-block ops generate-helm-values` derives them from the live
|
||||
# cluster.
|
||||
image:
|
||||
tag: sha-<commit>
|
||||
csiImage:
|
||||
tag: sha-<commit>
|
||||
|
||||
network:
|
||||
externalISCSI: true
|
||||
externalNVMe: false
|
||||
externalStatus: false # not supported with mutual TLS (the volume status stays on loopback)
|
||||
rejectLoopbackPublishTargets: true
|
||||
|
||||
compat:
|
||||
launcherDurableImplFlag: false
|
||||
launcherReplicationAckFlag: false
|
||||
launcherRejectLoopbackFlag: false
|
||||
|
||||
chap:
|
||||
enabled: true
|
||||
username: swblock
|
||||
secret: replace-with-a-real-secret
|
||||
|
||||
storageClass:
|
||||
replicationFactor: 1
|
||||
|
||||
blockNodes:
|
||||
- name: node-a
|
||||
kubernetesNode: node-a
|
||||
internalIP: 192.0.2.11
|
||||
frontendIP: 198.51.100.11
|
||||
frontendNetworkClass: 100gbe_tcp
|
||||
- name: node-b
|
||||
kubernetesNode: node-b
|
||||
internalIP: 192.0.2.12
|
||||
frontendIP: 198.51.100.12
|
||||
frontendNetworkClass: 100gbe_tcp
|
||||
- name: node-c
|
||||
kubernetesNode: node-c
|
||||
internalIP: 192.0.2.13
|
||||
frontendIP: 198.51.100.13
|
||||
frontendNetworkClass: 100gbe_tcp
|
||||
@@ -1,11 +0,0 @@
|
||||
Seaweed Block has been rendered by Helm.
|
||||
|
||||
Next checks:
|
||||
kubectl -n {{ .Release.Namespace }} wait --for=condition=available deploy/sw-blockmaster --timeout=120s
|
||||
kubectl -n {{ .Release.Namespace }} wait --for=condition=available deploy/sw-block-csi-controller --timeout=120s
|
||||
kubectl -n {{ .Release.Namespace }} rollout status ds/sw-block-csi-node --timeout=120s
|
||||
|
||||
Create volumes through Kubernetes PVCs using StorageClass {{ .Values.storageClass.name }}.
|
||||
|
||||
This chart is read-only/operator-free alpha packaging. It does not install a
|
||||
mutating dashboard, operator CRDs, backup/restore, or upgrade safety.
|
||||
@@ -1,100 +0,0 @@
|
||||
{{/*
|
||||
Common template helpers for Seaweed Block.
|
||||
*/}}
|
||||
{{- define "seaweed-block.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name (include "seaweed-block.name" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "seaweed-block.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.image" -}}
|
||||
{{- if .Values.image.digest -}}
|
||||
{{- printf "%s@%s" .Values.image.repository .Values.image.digest -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s:%s" .Values.image.repository .Values.image.tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.csiImage" -}}
|
||||
{{- if .Values.csiImage.digest -}}
|
||||
{{- printf "%s@%s" .Values.csiImage.repository .Values.csiImage.digest -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s:%s" .Values.csiImage.repository .Values.csiImage.tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.statePermissionsImage" -}}
|
||||
{{- if .Values.blockmaster.statePermissionsImage.digest -}}
|
||||
{{- printf "%s@%s" .Values.blockmaster.statePermissionsImage.repository .Values.blockmaster.statePermissionsImage.digest -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s:%s" .Values.blockmaster.statePermissionsImage.repository .Values.blockmaster.statePermissionsImage.tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.blockmasterAddress" -}}
|
||||
{{- printf "%s.%s.svc.cluster.local:%v" .Values.blockmaster.serviceName .Release.Namespace .Values.blockmaster.listenPort -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.expectedSlotsPerVolume" -}}
|
||||
{{- if gt (int .Values.replication.expectedSlotsPerVolume) 0 -}}
|
||||
{{- .Values.replication.expectedSlotsPerVolume -}}
|
||||
{{- else -}}
|
||||
{{- .Values.storageClass.replicationFactor -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Mutual TLS toward blockmaster for an in-cluster client: its own Secret
|
||||
(one of .Values.tls.clientSecrets, passed to masterTLSClientVolume)
|
||||
mounted at /etc/sw-block/master-tls. */}}
|
||||
{{- define "seaweed-block.masterTLSClientFlags" -}}
|
||||
- "--master-tls-cert=/etc/sw-block/master-tls/tls.crt"
|
||||
- "--master-tls-key=/etc/sw-block/master-tls/tls.key"
|
||||
- "--master-ca=/etc/sw-block/master-tls/ca.crt"
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.masterTLSClientEnv" -}}
|
||||
- name: SW_BLOCK_TLS_CERT
|
||||
value: /etc/sw-block/master-tls/tls.crt
|
||||
- name: SW_BLOCK_TLS_KEY
|
||||
value: /etc/sw-block/master-tls/tls.key
|
||||
- name: SW_BLOCK_TLS_CA
|
||||
value: /etc/sw-block/master-tls/ca.crt
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.masterTLSClientMount" -}}
|
||||
- name: master-tls
|
||||
mountPath: /etc/sw-block/master-tls
|
||||
readOnly: true
|
||||
{{- end -}}
|
||||
|
||||
{{/* The CSI node and the status operator only read: refuse a Secret named
|
||||
like an admin client's or blockmaster's own (the chart sees names, not
|
||||
roles; the role file decides the role). */}}
|
||||
{{- define "seaweed-block.readOnlyClientSecrets" -}}
|
||||
{{- $s := .Values.tls.clientSecrets -}}
|
||||
{{- if eq $s.csiNode $s.csiController $s.failbackExecutor .Values.tls.masterSecret -}}
|
||||
{{- fail (printf "tls.clientSecrets.csiNode %q is the CSI controller's, the failback executor's or blockmaster's Secret: the node plugin never mounts an admin key" $s.csiNode) -}}
|
||||
{{- end -}}
|
||||
{{- if eq $s.operatorStatus $s.csiController $s.failbackExecutor .Values.tls.masterSecret -}}
|
||||
{{- fail (printf "tls.clientSecrets.operatorStatus %q is the CSI controller's, the failback executor's or blockmaster's Secret: the status operator never mounts an admin key" $s.operatorStatus) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "seaweed-block.masterTLSClientVolume" -}}
|
||||
- name: master-tls
|
||||
secret:
|
||||
secretName: {{ . }}
|
||||
{{- end -}}
|
||||
@@ -1,49 +0,0 @@
|
||||
{{- if and .Values.authorityExecutor.create .Values.authorityExecutor.rbac.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-authority-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-authority-executor
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockvolumes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
{{- if .Values.authorityExecutor.execution.enabled }}
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicaeligibilities"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicaeligibilities/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicarebuilds"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicarebuilds/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-authority-executor
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "seaweed-block.fullname" . }}-authority-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "seaweed-block.fullname" . }}-authority-executor
|
||||
{{- end }}
|
||||
@@ -1,41 +0,0 @@
|
||||
{{- if .Values.authorityExecutor.create }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sw-block-authority-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
app: sw-block-authority-executor
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-block-authority-executor
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-block-authority-executor
|
||||
{{- include "seaweed-block.labels" . | nindent 8 }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-authority-executor
|
||||
{{- with .Values.authorityExecutor.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: authority-executor
|
||||
image: {{ include "seaweed-block.image" . | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["/usr/local/bin/sw-block"]
|
||||
args:
|
||||
- "ops"
|
||||
- "authority-executor"
|
||||
- "--namespace={{ .Release.Namespace }}"
|
||||
- "--allowed-mutation-class={{ .Values.authorityExecutor.execution.allowedMutationClass }}"
|
||||
{{- if .Values.authorityExecutor.execution.enabled }}
|
||||
- "--execution-policy"
|
||||
- "--enable-execution"
|
||||
{{- end }}
|
||||
- "--interval={{ .Values.authorityExecutor.interval }}"
|
||||
{{- end }}
|
||||
@@ -1,184 +0,0 @@
|
||||
{{- if and .Values.network.externalISCSI (not .Values.chap.enabled) -}}
|
||||
{{- fail "network.externalISCSI=true requires chap.enabled=true so cross-node iSCSI is not published without CHAP credentials" -}}
|
||||
{{- end -}}
|
||||
{{- if .Values.network.externalStatus -}}
|
||||
{{- fail "network.externalStatus=true is not supported: blockmaster runs with mutual TLS and an authenticated volume's status listener stays on loopback" -}}
|
||||
{{- end -}}
|
||||
{{- if .Values.blockmaster.frontendPublicationRuntimeHTTP -}}
|
||||
{{- fail "blockmaster.frontendPublicationRuntimeHTTP=true is not supported: the runtime HTTP API is unauthenticated and stays on loopback, out of reach of the executor pod" -}}
|
||||
{{- end -}}
|
||||
{{- if and (ne .Values.blockmaster.durableImpl "walstore") (not .Values.compat.launcherDurableImplFlag) -}}
|
||||
{{- fail "blockmaster.durableImpl requires compat.launcherDurableImplFlag=true because older published images do not accept --launcher-durable-impl" -}}
|
||||
{{- end -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sw-blockmaster
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
app: sw-blockmaster
|
||||
spec:
|
||||
replicas: {{ .Values.blockmaster.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-blockmaster
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-blockmaster
|
||||
{{- include "seaweed-block.labels" . | nindent 8 }}
|
||||
spec:
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-master
|
||||
{{- with .Values.blockmaster.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.blockmaster.stateHostPath }}
|
||||
initContainers:
|
||||
- name: state-permissions
|
||||
image: {{ include "seaweed-block.statePermissionsImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.blockmaster.statePermissionsImage.pullPolicy }}
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- "mkdir -p /var/lib/sw-block/authority /var/lib/sw-block/lifecycle && chown -R 65532:65532 /var/lib/sw-block"
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
volumeMounts:
|
||||
- name: state
|
||||
mountPath: /var/lib/sw-block
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: blockmaster
|
||||
image: {{ include "seaweed-block.image" . | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["/usr/local/bin/blockmaster"]
|
||||
args:
|
||||
- "--authority-store={{ .Values.blockmaster.authorityStore }}"
|
||||
- "--lifecycle-store={{ .Values.blockmaster.lifecycleStore }}"
|
||||
- "--cluster-spec=/config/cluster-spec.yaml"
|
||||
- "--lifecycle-product-loop-interval={{ .Values.blockmaster.lifecycleProductLoopInterval }}"
|
||||
- "--launcher-loop-interval={{ .Values.blockmaster.launcherLoopInterval }}"
|
||||
- "--launcher-manifest-dir={{ .Values.blockmaster.launcherManifestDir }}"
|
||||
- "--launcher-master-addr={{ include "seaweed-block.blockmasterAddress" . }}"
|
||||
- "--launcher-image={{ include "seaweed-block.image" . }}"
|
||||
- "--launcher-namespace={{ .Release.Namespace }}"
|
||||
- "--launcher-durable-root={{ .Values.blockmaster.durableRoot }}"
|
||||
{{- if .Values.compat.launcherDurableImplFlag }}
|
||||
- "--launcher-durable-impl={{ .Values.blockmaster.durableImpl }}"
|
||||
{{- end }}
|
||||
{{- if .Values.blockmaster.durableWALMultiBlockRecords }}
|
||||
- "--launcher-durable-wal-multiblock-records"
|
||||
{{- end }}
|
||||
{{- if .Values.blockmaster.durableWALRecoveryTestDisableFlusher }}
|
||||
- "--launcher-durable-wal-recovery-test-disable-flusher"
|
||||
{{- end }}
|
||||
{{- if .Values.blockmaster.launcherStatus }}
|
||||
- "--launcher-status"
|
||||
{{- end }}
|
||||
{{- if .Values.compat.launcherReplicationAckFlag }}
|
||||
- "--launcher-replication-ack={{ .Values.replication.ackProfile }}"
|
||||
{{- end }}
|
||||
- "--launcher-iscsi-port-base={{ .Values.ports.iscsiBase }}"
|
||||
- "--launcher-nvme-port-base={{ .Values.ports.nvmeBase }}"
|
||||
{{- if ne (int .Values.nvme.maxH2CDataLength) 32768 }}
|
||||
- "--launcher-nvme-max-h2c-data-length={{ .Values.nvme.maxH2CDataLength }}"
|
||||
{{- end }}
|
||||
{{- if .Values.blockmaster.launcherPVCOwnerRef }}
|
||||
- "--launcher-pvc-owner-ref"
|
||||
{{- end }}
|
||||
{{- if .Values.blockmaster.stateHostPath }}
|
||||
- "--launcher-state-hostpath={{ .Values.blockmaster.stateHostPath }}"
|
||||
{{- end }}
|
||||
{{- if .Values.network.externalISCSI }}
|
||||
- "--launcher-external-iscsi"
|
||||
- "--launcher-iscsi-chap-secret-name={{ .Values.chap.secretName }}"
|
||||
- "--launcher-iscsi-chap-username-key={{ .Values.chap.usernameKey }}"
|
||||
- "--launcher-iscsi-chap-secret-key={{ .Values.chap.secretKey }}"
|
||||
{{- end }}
|
||||
{{- if .Values.network.externalNVMe }}
|
||||
- "--launcher-external-nvme"
|
||||
{{- end }}
|
||||
{{- if and .Values.network.rejectLoopbackPublishTargets .Values.compat.launcherRejectLoopbackFlag }}
|
||||
- "--launcher-reject-loopback-publish-targets"
|
||||
{{- end }}
|
||||
- "--launcher-kubernetes-apply"
|
||||
- "--listen=0.0.0.0:{{ .Values.blockmaster.listenPort }}"
|
||||
- "--tls-cert=/etc/sw-block/tls/tls.crt"
|
||||
- "--tls-key=/etc/sw-block/tls/tls.key"
|
||||
- "--tls-client-ca=/etc/sw-block/tls/ca.crt"
|
||||
- "--role-file=/etc/sw-block/roles/roles"
|
||||
- "--audit-log=/var/lib/sw-block/audit.log"
|
||||
- "--launcher-master-tls-secret-prefix={{ .Values.tls.nodeSecretPrefix }}"
|
||||
{{- if .Values.blockmaster.failbackRuntimeRPC }}
|
||||
- "--failback-runtime-rpc"
|
||||
{{- end }}
|
||||
{{- if .Values.blockmaster.frontendPublicationRuntimeHTTP }}
|
||||
- "--frontend-publication-runtime-http"
|
||||
- "--frontend-publication-runtime-listen=0.0.0.0:{{ .Values.blockmaster.frontendPublicationRuntimePort }}"
|
||||
{{- end }}
|
||||
- "--expected-slots-per-volume={{ include "seaweed-block.expectedSlotsPerVolume" . }}"
|
||||
ports:
|
||||
- name: grpc
|
||||
containerPort: {{ .Values.blockmaster.listenPort }}
|
||||
{{- if .Values.blockmaster.frontendPublicationRuntimeHTTP }}
|
||||
- name: frontend-http
|
||||
containerPort: {{ .Values.blockmaster.frontendPublicationRuntimePort }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: cluster-spec
|
||||
mountPath: /config
|
||||
readOnly: true
|
||||
- name: state
|
||||
mountPath: /var/lib/sw-block
|
||||
- name: manifests
|
||||
mountPath: /manifests
|
||||
- name: tls
|
||||
mountPath: /etc/sw-block/tls
|
||||
readOnly: true
|
||||
- name: roles
|
||||
mountPath: /etc/sw-block/roles
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: cluster-spec
|
||||
configMap:
|
||||
name: {{ include "seaweed-block.fullname" . }}-cluster-spec
|
||||
- name: state
|
||||
{{- if .Values.blockmaster.stateHostPath }}
|
||||
hostPath:
|
||||
path: {{ .Values.blockmaster.stateHostPath | quote }}
|
||||
type: {{ .Values.blockmaster.stateHostPathType | quote }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
- name: manifests
|
||||
emptyDir: {}
|
||||
- name: tls
|
||||
secret:
|
||||
secretName: {{ .Values.tls.masterSecret }}
|
||||
- name: roles
|
||||
secret:
|
||||
secretName: {{ .Values.tls.roleSecret }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.blockmaster.serviceName }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
app: sw-blockmaster
|
||||
spec:
|
||||
selector:
|
||||
app: sw-blockmaster
|
||||
ports:
|
||||
- name: grpc
|
||||
port: {{ .Values.blockmaster.listenPort }}
|
||||
targetPort: grpc
|
||||
{{- if .Values.blockmaster.frontendPublicationRuntimeHTTP }}
|
||||
- name: frontend-http
|
||||
port: {{ .Values.blockmaster.frontendPublicationRuntimePort }}
|
||||
targetPort: frontend-http
|
||||
{{- end }}
|
||||
@@ -1,27 +0,0 @@
|
||||
{{- if and .Values.chap.enabled .Values.chap.create }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Values.chap.secretName }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{ .Values.chap.usernameKey }}: {{ required "chap.username is required when chap.enabled=true" .Values.chap.username | quote }}
|
||||
{{ .Values.chap.secretKey }}: {{ required "chap.secret is required when chap.enabled=true" .Values.chap.secret | quote }}
|
||||
{{- if ne .Values.appNamespace .Release.Namespace }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Values.chap.secretName }}
|
||||
namespace: {{ .Values.appNamespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{ .Values.chap.usernameKey }}: {{ .Values.chap.username | quote }}
|
||||
{{ .Values.chap.secretKey }}: {{ .Values.chap.secret | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,29 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-cluster-spec
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
data:
|
||||
cluster-spec.yaml: |
|
||||
nodes:
|
||||
{{- range $i, $node := .Values.blockNodes }}
|
||||
{{- $internalIP := required "blockNodes[].internalIP is required" $node.internalIP }}
|
||||
{{- $frontendIP := default $internalIP $node.frontendIP }}
|
||||
{{- $managementIP := default $internalIP $node.managementIP }}
|
||||
- server_id: {{ default $node.name $node.serverID | quote }}
|
||||
addr: {{ printf "%s:%v" $frontendIP (default 19101 $node.dataPort) | quote }}
|
||||
data_addr: {{ printf "%s:%v" $frontendIP (default 19101 $node.dataPort) | quote }}
|
||||
ctrl_addr: {{ printf "%s:%v" $internalIP (default 19102 $node.controlPort) | quote }}
|
||||
labels:
|
||||
kubernetes.io/hostname: {{ default $node.name $node.kubernetesNode | quote }}
|
||||
sw-block.seaweedfs.com/management-ip: {{ $managementIP | quote }}
|
||||
sw-block.seaweedfs.com/frontend-ip: {{ $frontendIP | quote }}
|
||||
sw-block.seaweedfs.com/frontend-network-class: {{ default "management_lan" $node.frontendNetworkClass | quote }}
|
||||
pools:
|
||||
- pool_id: {{ default (printf "pool-%d" (add $i 1)) $node.poolID | quote }}
|
||||
total_bytes: {{ default 1073741824 $node.totalBytes }}
|
||||
free_bytes: {{ default 1073741824 $node.freeBytes }}
|
||||
block_size: 4096
|
||||
{{- end }}
|
||||
@@ -1,75 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sw-block-csi-controller
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
app: sw-block-csi-controller
|
||||
spec:
|
||||
replicas: {{ .Values.csiController.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-block-csi-controller
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-block-csi-controller
|
||||
{{- include "seaweed-block.labels" . | nindent 8 }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-csi
|
||||
containers:
|
||||
- name: block-csi
|
||||
image: {{ include "seaweed-block.csiImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.csiImage.pullPolicy }}
|
||||
args:
|
||||
- "--endpoint=unix:///csi/csi.sock"
|
||||
- "--master=$(BLOCKMASTER_ADDR)"
|
||||
- "--node-id=$(NODE_NAME)"
|
||||
{{- include "seaweed-block.masterTLSClientFlags" . | nindent 12 }}
|
||||
{{- if .Values.blockmaster.launcherPVCOwnerRef }}
|
||||
- "--kubernetes-pvc-uid-lookup"
|
||||
{{- end }}
|
||||
{{- if or .Values.operatorStatus.create .Values.lifecycleOwner.create }}
|
||||
- "--swblockvolume-cr-namespace={{ .Release.Namespace }}"
|
||||
{{- end }}
|
||||
{{- if .Values.stage2Multipath.enabled }}
|
||||
- "--stage2-multipath"
|
||||
{{- end }}
|
||||
{{- if .Values.network.rejectLoopbackPublishTargets }}
|
||||
- "--reject-loopback-publish-targets"
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BLOCKMASTER_ADDR
|
||||
value: {{ include "seaweed-block.blockmasterAddress" . | quote }}
|
||||
- name: NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
{{- include "seaweed-block.masterTLSClientMount" . | nindent 12 }}
|
||||
- name: csi-provisioner
|
||||
image: {{ .Values.sidecars.provisionerImage | quote }}
|
||||
args:
|
||||
- "--csi-address=/csi/csi.sock"
|
||||
- "--timeout=30s"
|
||||
- "--leader-election=true"
|
||||
- "--extra-create-metadata=true"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: csi-attacher
|
||||
image: {{ .Values.sidecars.attacherImage | quote }}
|
||||
args:
|
||||
- "--csi-address=/csi/csi.sock"
|
||||
- "--timeout=30s"
|
||||
- "--leader-election=true"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
volumes:
|
||||
- name: socket-dir
|
||||
emptyDir: {}
|
||||
{{- include "seaweed-block.masterTLSClientVolume" .Values.tls.clientSecrets.csiController | nindent 8 }}
|
||||
@@ -1,12 +0,0 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: CSIDriver
|
||||
metadata:
|
||||
name: {{ .Values.driver.name }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
spec:
|
||||
attachRequired: true
|
||||
podInfoOnMount: false
|
||||
fsGroupPolicy: File
|
||||
volumeLifecycleModes:
|
||||
- Persistent
|
||||
@@ -1,120 +0,0 @@
|
||||
{{- include "seaweed-block.readOnlyClientSecrets" . }}
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: sw-block-csi-node
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
app: sw-block-csi-node
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-block-csi-node
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-block-csi-node
|
||||
{{- include "seaweed-block.labels" . | nindent 8 }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-csi
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
hostPID: true
|
||||
{{- if .Values.csiNode.loadKernelModules }}
|
||||
initContainers:
|
||||
- name: load-iscsi-tcp
|
||||
image: {{ include "seaweed-block.csiImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.csiImage.pullPolicy }}
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- "modprobe iscsi_tcp || true; modprobe nvme_tcp || true; modprobe nvme_rdma || true; modprobe dm_multipath || true; modprobe scsi_dh_alua || true"
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: modules-dir
|
||||
mountPath: /lib/modules
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: block-csi
|
||||
image: {{ include "seaweed-block.csiImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.csiImage.pullPolicy }}
|
||||
args:
|
||||
- "--endpoint=unix:///csi/csi.sock"
|
||||
- "--master=$(BLOCKMASTER_ADDR)"
|
||||
- "--node-id=$(NODE_NAME)"
|
||||
{{- include "seaweed-block.masterTLSClientFlags" . | nindent 12 }}
|
||||
{{- if .Values.stage2Multipath.enabled }}
|
||||
- "--stage2-multipath"
|
||||
{{- end }}
|
||||
{{- if .Values.csiNode.nvmeReconnect.enabled }}
|
||||
- "--nvme-reconnect-owner"
|
||||
- "--nvme-reconnect-interval={{ .Values.csiNode.nvmeReconnect.interval }}"
|
||||
{{- end }}
|
||||
{{- if .Values.network.rejectLoopbackPublishTargets }}
|
||||
- "--reject-loopback-publish-targets"
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BLOCKMASTER_ADDR
|
||||
value: {{ include "seaweed-block.blockmasterAddress" . | quote }}
|
||||
- name: NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: kubelet-dir
|
||||
mountPath: /var/lib/kubelet
|
||||
mountPropagation: Bidirectional
|
||||
- name: dev
|
||||
mountPath: /dev
|
||||
- name: iscsi-dir
|
||||
mountPath: /etc/iscsi
|
||||
- name: udev-run
|
||||
mountPath: /run/udev
|
||||
readOnly: true
|
||||
{{- include "seaweed-block.masterTLSClientMount" . | nindent 12 }}
|
||||
- name: csi-node-driver-registrar
|
||||
image: {{ .Values.sidecars.nodeDriverRegistrarImage | quote }}
|
||||
args:
|
||||
- "--csi-address=/csi/csi.sock"
|
||||
- "--kubelet-registration-path={{ .Values.csiNode.pluginPath }}/csi.sock"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: registration-dir
|
||||
mountPath: /registration
|
||||
volumes:
|
||||
{{- include "seaweed-block.masterTLSClientVolume" .Values.tls.clientSecrets.csiNode | nindent 8 }}
|
||||
- name: socket-dir
|
||||
hostPath:
|
||||
path: {{ .Values.csiNode.pluginPath | quote }}
|
||||
type: DirectoryOrCreate
|
||||
- name: kubelet-dir
|
||||
hostPath:
|
||||
path: {{ .Values.csiNode.kubeletPath | quote }}
|
||||
type: Directory
|
||||
- name: dev
|
||||
hostPath:
|
||||
path: /dev
|
||||
type: Directory
|
||||
- name: iscsi-dir
|
||||
hostPath:
|
||||
path: /etc/iscsi
|
||||
type: DirectoryOrCreate
|
||||
- name: udev-run
|
||||
hostPath:
|
||||
path: /run/udev
|
||||
type: Directory
|
||||
- name: modules-dir
|
||||
hostPath:
|
||||
path: /lib/modules
|
||||
type: Directory
|
||||
- name: registration-dir
|
||||
hostPath:
|
||||
path: {{ .Values.csiNode.registrationPath | quote }}
|
||||
type: Directory
|
||||
@@ -1,38 +0,0 @@
|
||||
{{- if and .Values.failbackExecutor.create .Values.failbackExecutor.rbac.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-executor
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicafailbacks"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicafailbacks/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-executor
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-executor
|
||||
{{- end }}
|
||||
@@ -1,72 +0,0 @@
|
||||
{{- if .Values.failbackExecutor.create }}
|
||||
{{- if and .Values.failbackExecutor.execution.enabled .Values.failbackExecutor.dryRun -}}
|
||||
{{- fail "failbackExecutor.execution.enabled=true requires failbackExecutor.dryRun=false" -}}
|
||||
{{- end -}}
|
||||
{{- if and .Values.failbackExecutor.execution.enabled (not .Values.failbackExecutor.execution.policy) -}}
|
||||
{{- fail "failbackExecutor.execution.enabled=true requires failbackExecutor.execution.policy=true" -}}
|
||||
{{- end -}}
|
||||
{{- if and .Values.failbackExecutor.execution.failbackRuntimeGrpcAddr (not .Values.failbackExecutor.execution.enabled) -}}
|
||||
{{- fail "failbackExecutor.execution.failbackRuntimeGrpcAddr requires failbackExecutor.execution.enabled=true" -}}
|
||||
{{- end -}}
|
||||
{{- if and .Values.failbackExecutor.execution.failbackRuntimeURL (not .Values.failbackExecutor.execution.enabled) -}}
|
||||
{{- fail "failbackExecutor.execution.failbackRuntimeURL requires failbackExecutor.execution.enabled=true" -}}
|
||||
{{- end -}}
|
||||
{{- if and .Values.failbackExecutor.execution.failbackRuntimeGrpcAddr .Values.failbackExecutor.execution.failbackRuntimeURL -}}
|
||||
{{- fail "failbackExecutor.execution.failbackRuntimeGrpcAddr and failbackExecutor.execution.failbackRuntimeURL are mutually exclusive" -}}
|
||||
{{- end -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sw-block-failback-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
app: sw-block-failback-executor
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-block-failback-executor
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-block-failback-executor
|
||||
{{- include "seaweed-block.labels" . | nindent 8 }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-failback-executor
|
||||
{{- with .Values.failbackExecutor.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: failback-executor
|
||||
image: {{ include "seaweed-block.image" . | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["/usr/local/bin/sw-block"]
|
||||
args:
|
||||
- "ops"
|
||||
- "failback-executor"
|
||||
- "--namespace={{ .Release.Namespace }}"
|
||||
{{- if .Values.failbackExecutor.dryRun }}
|
||||
- "--dry-run"
|
||||
{{- end }}
|
||||
{{- if .Values.failbackExecutor.execution.enabled }}
|
||||
- "--enable-execution"
|
||||
{{- end }}
|
||||
{{- if .Values.failbackExecutor.execution.policy }}
|
||||
- "--execution-policy"
|
||||
{{- end }}
|
||||
{{- if .Values.failbackExecutor.execution.failbackRuntimeGrpcAddr }}
|
||||
- "--failback-runtime-grpc-addr={{ .Values.failbackExecutor.execution.failbackRuntimeGrpcAddr }}"
|
||||
{{- end }}
|
||||
{{- if .Values.failbackExecutor.execution.failbackRuntimeURL }}
|
||||
- "--failback-runtime-url={{ .Values.failbackExecutor.execution.failbackRuntimeURL }}"
|
||||
{{- end }}
|
||||
- "--interval={{ .Values.failbackExecutor.interval }}"
|
||||
env:
|
||||
{{- include "seaweed-block.masterTLSClientEnv" . | nindent 12 }}
|
||||
volumeMounts:
|
||||
{{- include "seaweed-block.masterTLSClientMount" . | nindent 12 }}
|
||||
volumes:
|
||||
{{- include "seaweed-block.masterTLSClientVolume" .Values.tls.clientSecrets.failbackExecutor | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -1,38 +0,0 @@
|
||||
{{- if and .Values.failbackTargetOwner.create .Values.failbackTargetOwner.rbac.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-target-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-target-owner
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockvolumes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicafailbacks"]
|
||||
verbs: ["get", "list", "watch", "create"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-target-owner
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-target-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "seaweed-block.fullname" . }}-failback-target-owner
|
||||
{{- end }}
|
||||
@@ -1,48 +0,0 @@
|
||||
{{- if .Values.failbackTargetOwner.create }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sw-block-failback-target-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
app: sw-block-failback-target-owner
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-block-failback-target-owner
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-block-failback-target-owner
|
||||
{{- include "seaweed-block.labels" . | nindent 8 }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-failback-target-owner
|
||||
{{- with .Values.failbackTargetOwner.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: failback-target-owner
|
||||
image: {{ include "seaweed-block.image" . | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["/usr/local/bin/sw-block"]
|
||||
args:
|
||||
- "ops"
|
||||
- "failback-target-owner"
|
||||
- "--namespace={{ .Release.Namespace }}"
|
||||
{{- if .Values.failbackTargetOwner.dryRun }}
|
||||
- "--dry-run"
|
||||
{{- end }}
|
||||
- "--interval={{ .Values.failbackTargetOwner.interval }}"
|
||||
{{- if .Values.failbackTargetOwner.activation.enabled }}
|
||||
- "--activate-targets"
|
||||
{{- end }}
|
||||
{{- if .Values.failbackTargetOwner.activation.policy }}
|
||||
- "--activation-policy"
|
||||
{{- end }}
|
||||
{{- if .Values.failbackTargetOwner.activation.runtimeEndpoint }}
|
||||
- "--runtime-endpoint={{ .Values.failbackTargetOwner.activation.runtimeEndpoint }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,32 +0,0 @@
|
||||
{{- if and .Values.frontendPublicationExecutor.create .Values.frontendPublicationExecutor.rbac.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-executor
|
||||
rules:
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockfrontendpublications"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockfrontendpublications/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-executor
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-executor
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -1,46 +0,0 @@
|
||||
{{- if .Values.frontendPublicationExecutor.create }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sw-block-frontend-publication-executor
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: sw-block-frontend-publication-executor
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-block-frontend-publication-executor
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-block-frontend-publication-executor
|
||||
spec:
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-frontend-publication-executor
|
||||
{{- with .Values.frontendPublicationExecutor.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: frontend-publication-executor
|
||||
image: {{ include "seaweed-block.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["/usr/local/bin/sw-block"]
|
||||
args:
|
||||
- "ops"
|
||||
- "frontend-publication-executor"
|
||||
- "--namespace={{ .Release.Namespace }}"
|
||||
{{- if .Values.frontendPublicationExecutor.dryRun }}
|
||||
- "--dry-run"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationExecutor.execution.enabled }}
|
||||
- "--enable-execution"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationExecutor.execution.policy }}
|
||||
- "--execution-policy"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationExecutor.execution.runtimeUrl }}
|
||||
- "--frontend-publication-runtime-url={{ .Values.frontendPublicationExecutor.execution.runtimeUrl }}"
|
||||
{{- end }}
|
||||
- "--interval={{ .Values.frontendPublicationExecutor.interval }}"
|
||||
{{- end }}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
{{- if and .Values.frontendPublicationTargetOwner.create .Values.frontendPublicationTargetOwner.rbac.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-target-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-target-owner
|
||||
rules:
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicaeligibilities"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicafailbacks"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockfrontendpublications"]
|
||||
verbs: ["get", "list", "watch", "create"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-target-owner
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-target-owner
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "seaweed-block.fullname" . }}-frontend-publication-target-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -1,46 +0,0 @@
|
||||
{{- if .Values.frontendPublicationTargetOwner.create }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sw-block-frontend-publication-target-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: sw-block-frontend-publication-target-owner
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-block-frontend-publication-target-owner
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-block-frontend-publication-target-owner
|
||||
spec:
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-frontend-publication-target-owner
|
||||
{{- with .Values.frontendPublicationTargetOwner.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: frontend-publication-target-owner
|
||||
image: {{ include "seaweed-block.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["/usr/local/bin/sw-block"]
|
||||
args:
|
||||
- "ops"
|
||||
- "frontend-publication-target-owner"
|
||||
- "--namespace={{ .Release.Namespace }}"
|
||||
{{- if .Values.frontendPublicationTargetOwner.dryRun }}
|
||||
- "--dry-run"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationTargetOwner.activation.enabled }}
|
||||
- "--activate-targets"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationTargetOwner.activation.policy }}
|
||||
- "--activation-policy"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationTargetOwner.activation.runtimeEndpoint }}
|
||||
- "--runtime-endpoint={{ .Values.frontendPublicationTargetOwner.activation.runtimeEndpoint }}"
|
||||
{{- end }}
|
||||
- "--interval={{ .Values.frontendPublicationTargetOwner.interval }}"
|
||||
{{- end }}
|
||||
@@ -1,47 +0,0 @@
|
||||
{{- if and .Values.lifecycleOwner.create .Values.lifecycleOwner.admission.create }}
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingAdmissionPolicy
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-lifecycle-owner-finalizer-boundary
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
spec:
|
||||
failurePolicy: Fail
|
||||
matchConstraints:
|
||||
resourceRules:
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
apiVersions: ["v1alpha1"]
|
||||
operations: ["UPDATE"]
|
||||
resources: ["swblockvolumes"]
|
||||
validations:
|
||||
- expression: >-
|
||||
request.userInfo.username != "system:serviceaccount:{{ .Release.Namespace }}:{{ include "seaweed-block.fullname" . }}-lifecycle-owner" ||
|
||||
(
|
||||
(has(object.spec) == has(oldObject.spec)) &&
|
||||
(!has(object.spec) || object.spec == oldObject.spec) &&
|
||||
(has(object.status) == has(oldObject.status)) &&
|
||||
(!has(object.status) || object.status == oldObject.status) &&
|
||||
(has(object.metadata.labels) == has(oldObject.metadata.labels)) &&
|
||||
(!has(object.metadata.labels) || object.metadata.labels == oldObject.metadata.labels) &&
|
||||
(has(object.metadata.annotations) == has(oldObject.metadata.annotations)) &&
|
||||
(!has(object.metadata.annotations) || object.metadata.annotations == oldObject.metadata.annotations) &&
|
||||
(has(object.metadata.ownerReferences) == has(oldObject.metadata.ownerReferences)) &&
|
||||
(!has(object.metadata.ownerReferences) || object.metadata.ownerReferences == oldObject.metadata.ownerReferences) &&
|
||||
(has(object.metadata.deletionTimestamp) == has(oldObject.metadata.deletionTimestamp)) &&
|
||||
(!has(object.metadata.deletionTimestamp) || object.metadata.deletionTimestamp == oldObject.metadata.deletionTimestamp) &&
|
||||
((has(object.metadata.finalizers) ? object.metadata.finalizers : []).filter(f, f != "{{ .Values.lifecycleOwner.finalizerName | default "block.seaweedfs.com/swblockvolume-protection" }}") ==
|
||||
(has(oldObject.metadata.finalizers) ? oldObject.metadata.finalizers : []).filter(f, f != "{{ .Values.lifecycleOwner.finalizerName | default "block.seaweedfs.com/swblockvolume-protection" }}")) &&
|
||||
((has(object.metadata.finalizers) ? object.metadata.finalizers : []).filter(f, f == "{{ .Values.lifecycleOwner.finalizerName | default "block.seaweedfs.com/swblockvolume-protection" }}").size() <= 1)
|
||||
)
|
||||
message: lifecycle-owner may only add or remove the Seaweed Block protection finalizer
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingAdmissionPolicyBinding
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-lifecycle-owner-finalizer-boundary
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
spec:
|
||||
policyName: {{ include "seaweed-block.fullname" . }}-lifecycle-owner-finalizer-boundary
|
||||
validationActions: ["Deny"]
|
||||
{{- end }}
|
||||
@@ -1,38 +0,0 @@
|
||||
{{- if and .Values.lifecycleOwner.create .Values.lifecycleOwner.rbac.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-lifecycle-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-lifecycle-owner
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockvolumes"]
|
||||
verbs: ["get", "list", "watch", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["create"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "seaweed-block.fullname" . }}-lifecycle-owner
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "seaweed-block.fullname" . }}-lifecycle-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "seaweed-block.fullname" . }}-lifecycle-owner
|
||||
{{- end }}
|
||||
@@ -1,39 +0,0 @@
|
||||
{{- if .Values.lifecycleOwner.create }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sw-block-lifecycle-owner
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "seaweed-block.labels" . | nindent 4 }}
|
||||
app: sw-block-lifecycle-owner
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sw-block-lifecycle-owner
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sw-block-lifecycle-owner
|
||||
{{- include "seaweed-block.labels" . | nindent 8 }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "seaweed-block.fullname" . }}-lifecycle-owner
|
||||
{{- with .Values.lifecycleOwner.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: lifecycle-owner
|
||||
image: {{ include "seaweed-block.image" . | quote }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["/usr/local/bin/sw-block"]
|
||||
args:
|
||||
- "ops"
|
||||
- "lifecycle-owner"
|
||||
{{- if .Values.lifecycleOwner.dryRun }}
|
||||
- "--dry-run"
|
||||
{{- end }}
|
||||
- "--namespace={{ .Release.Namespace }}"
|
||||
- "--interval={{ .Values.lifecycleOwner.interval }}"
|
||||
{{- end }}
|
||||
Loaded 100 of 3439 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user