...
 
Commits (9)
    https://gitcode.net/no-src/gofs/-/commit/1239ff484cec52d3a889967b2f54f6f98f931209 Bump github.com/pkg/sftp from 1.13.5 to 1.13.6 (#237) 2023-08-14T16:46:33+08:00 dependabot[bot] 49699333+dependabot[bot]@users.noreply.github.com Bumps [github.com/pkg/sftp](<a href="https://github.com/pkg/sftp" rel="nofollow noreferrer noopener" target="_blank">https://github.com/pkg/sftp</a>) from 1.13.5 to 1.13.6. - [Release notes](<a href="https://github.com/pkg/sftp/releases" rel="nofollow noreferrer noopener" target="_blank">https://github.com/pkg/sftp/releases</a>) - [Commits](<a href="https://github.com/pkg/sftp/compare/v1.13.5...v1.13.6" rel="nofollow noreferrer noopener" target="_blank">https://github.com/pkg/sftp/compare/v1.13.5...v1.13.6</a>) --- updated-dependencies: - dependency-name: github.com/pkg/sftp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:support@github.com" title="support@github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg1" style="text-decoration: none">N</a><a href="mailto:support@github.com" title="support@github.com">dependabot[bot]</a> &lt;<a href="mailto:support@github.com" title="support@github.com">support@github.com</a>&gt;</span> Co-authored-by: <span data-trailer="Co-authored-by:"><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg2" style="text-decoration: none">N</a><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">dependabot[bot]</a> &lt;<a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">49699333+dependabot[bot]@users.noreply.github.com</a>&gt;</span> https://gitcode.net/no-src/gofs/-/commit/03d55b9498bab791b57abb6ffd850b6369dc55ce Bump github.com/minio/minio-go/v7 from 7.0.60 to 7.0.62 (#238) 2023-08-21T17:40:19+08:00 dependabot[bot] 49699333+dependabot[bot]@users.noreply.github.com Bumps [github.com/minio/minio-go/v7](<a href="https://github.com/minio/minio-go" rel="nofollow noreferrer noopener" target="_blank">https://github.com/minio/minio-go</a>) from 7.0.60 to 7.0.62. - [Release notes](<a href="https://github.com/minio/minio-go/releases" rel="nofollow noreferrer noopener" target="_blank">https://github.com/minio/minio-go/releases</a>) - [Commits](<a href="https://github.com/minio/minio-go/compare/v7.0.60...v7.0.62" rel="nofollow noreferrer noopener" target="_blank">https://github.com/minio/minio-go/compare/v7.0.60...v7.0.62</a>) --- updated-dependencies: - dependency-name: github.com/minio/minio-go/v7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:support@github.com" title="support@github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg6" style="text-decoration: none">N</a><a href="mailto:support@github.com" title="support@github.com">dependabot[bot]</a> &lt;<a href="mailto:support@github.com" title="support@github.com">support@github.com</a>&gt;</span> Co-authored-by: <span data-trailer="Co-authored-by:"><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg3" style="text-decoration: none">N</a><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">dependabot[bot]</a> &lt;<a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">49699333+dependabot[bot]@users.noreply.github.com</a>&gt;</span> https://gitcode.net/no-src/gofs/-/commit/54b2fa27fe34a4618d5823d8d7ef539c3815986b Bump github.com/quic-go/quic-go from 0.37.4 to 0.38.0 (#239) 2023-08-21T17:41:34+08:00 dependabot[bot] 49699333+dependabot[bot]@users.noreply.github.com Bumps [github.com/quic-go/quic-go](<a href="https://github.com/quic-go/quic-go" rel="nofollow noreferrer noopener" target="_blank">https://github.com/quic-go/quic-go</a>) from 0.37.4 to 0.38.0. - [Release notes](<a href="https://github.com/quic-go/quic-go/releases" rel="nofollow noreferrer noopener" target="_blank">https://github.com/quic-go/quic-go/releases</a>) - [Changelog](<a href="https://github.com/quic-go/quic-go/blob/master/Changelog.md" rel="nofollow noreferrer noopener" target="_blank">https://github.com/quic-go/quic-go/blob/master/Changelog.md</a>) - [Commits](<a href="https://github.com/quic-go/quic-go/compare/v0.37.4...v0.38.0" rel="nofollow noreferrer noopener" target="_blank">https://github.com/quic-go/quic-go/compare/v0.37.4...v0.38.0</a>) --- updated-dependencies: - dependency-name: github.com/quic-go/quic-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:support@github.com" title="support@github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg2" style="text-decoration: none">N</a><a href="mailto:support@github.com" title="support@github.com">dependabot[bot]</a> &lt;<a href="mailto:support@github.com" title="support@github.com">support@github.com</a>&gt;</span> Co-authored-by: <span data-trailer="Co-authored-by:"><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg4" style="text-decoration: none">N</a><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">dependabot[bot]</a> &lt;<a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">49699333+dependabot[bot]@users.noreply.github.com</a>&gt;</span> https://gitcode.net/no-src/gofs/-/commit/00b83eb8848044c4de3d470677988aef8e3a652e Bump github.com/no-src/log from 0.2.3 to 0.3.0 (#241) 2023-08-21T18:17:36+08:00 dependabot[bot] 49699333+dependabot[bot]@users.noreply.github.com Bumps [github.com/no-src/log](<a href="https://github.com/no-src/log" rel="nofollow noreferrer noopener" target="_blank">https://github.com/no-src/log</a>) from 0.2.3 to 0.3.0. - [Release notes](<a href="https://github.com/no-src/log/releases" rel="nofollow noreferrer noopener" target="_blank">https://github.com/no-src/log/releases</a>) - [Commits](<a href="https://github.com/no-src/log/compare/v0.2.3...v0.3.0" rel="nofollow noreferrer noopener" target="_blank">https://github.com/no-src/log/compare/v0.2.3...v0.3.0</a>) --- updated-dependencies: - dependency-name: github.com/no-src/log dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:support@github.com" title="support@github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg6" style="text-decoration: none">N</a><a href="mailto:support@github.com" title="support@github.com">dependabot[bot]</a> &lt;<a href="mailto:support@github.com" title="support@github.com">support@github.com</a>&gt;</span> Co-authored-by: <span data-trailer="Co-authored-by:"><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg1" style="text-decoration: none">N</a><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">dependabot[bot]</a> &lt;<a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">49699333+dependabot[bot]@users.noreply.github.com</a>&gt;</span> https://gitcode.net/no-src/gofs/-/commit/acc89201db9601f54845c8ed45eefe8c6f17d21f Bump github.com/no-src/fsctl (#240) 2023-08-21T18:43:09+08:00 dependabot[bot] 49699333+dependabot[bot]@users.noreply.github.com Bumps [github.com/no-src/fsctl](<a href="https://github.com/no-src/fsctl" rel="nofollow noreferrer noopener" target="_blank">https://github.com/no-src/fsctl</a>) from 0.1.2-0.20230809094346-873969ea2e79 to 0.1.2. - [Release notes](<a href="https://github.com/no-src/fsctl/releases" rel="nofollow noreferrer noopener" target="_blank">https://github.com/no-src/fsctl/releases</a>) - [Commits](<a href="https://github.com/no-src/fsctl/commits/v0.1.2" rel="nofollow noreferrer noopener" target="_blank">https://github.com/no-src/fsctl/commits/v0.1.2</a>) --- updated-dependencies: - dependency-name: github.com/no-src/fsctl dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:support@github.com" title="support@github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg5" style="text-decoration: none">N</a><a href="mailto:support@github.com" title="support@github.com">dependabot[bot]</a> &lt;<a href="mailto:support@github.com" title="support@github.com">support@github.com</a>&gt;</span> Co-authored-by: <span data-trailer="Co-authored-by:"><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg6" style="text-decoration: none">N</a><a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">dependabot[bot]</a> &lt;<a href="mailto:49699333+dependabot%5Bbot%5D@users.noreply.github.com" title="49699333+dependabot[bot]@users.noreply.github.com">49699333+dependabot[bot]@users.noreply.github.com</a>&gt;</span> https://gitcode.net/no-src/gofs/-/commit/489f4b1d9fe35376c8bf4bc3d57e1eb5c955d8b5 Update scripts/build-release.sh, add linux arm64 and macOS arm64 releases (#242) 2023-08-25T00:04:07+08:00 mstmdev mstmdev@gmail.com https://gitcode.net/no-src/gofs/-/commit/dd59b4ac3f36ea1ad5518f30d03e520f39e825cf Remove the CBool structure and code refactoring (#243) 2023-08-26T00:21:11+08:00 mstmdev mstmdev@gmail.com https://gitcode.net/no-src/gofs/-/commit/5a1bf70de773e426102d7c7a8cc8c4f294820a42 Remove the unused global variables (#244) 2023-08-27T00:12:38+08:00 mstmdev mstmdev@gmail.com https://gitcode.net/no-src/gofs/-/commit/e14bbcb6290010524f68bcd99dc7e74907bb1351 Add release test workflow to GitHub Actions (#245) 2023-08-28T00:36:18+08:00 mstmdev mstmdev@gmail.com
......@@ -61,4 +61,8 @@ jobs:
- name: Codecov
uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest'
- name: Test Release
run: chmod +x ./scripts/build-release.sh && ./scripts/build-release.sh
if: matrix.os == 'ubuntu-latest'
\ No newline at end of file
......@@ -8,12 +8,12 @@ require (
github.com/gin-contrib/pprof v1.4.0
github.com/gin-contrib/sessions v0.0.5
github.com/gin-gonic/gin v1.9.1
github.com/minio/minio-go/v7 v7.0.60
github.com/no-src/fsctl v0.1.2-0.20230809094346-873969ea2e79
github.com/no-src/log v0.2.3
github.com/minio/minio-go/v7 v7.0.62
github.com/no-src/fsctl v0.1.2
github.com/no-src/log v0.3.0
github.com/no-src/nscache v0.1.1
github.com/pkg/sftp v1.13.5
github.com/quic-go/quic-go v0.37.4
github.com/pkg/sftp v1.13.6
github.com/quic-go/quic-go v0.38.0
github.com/robfig/cron/v3 v3.0.1
github.com/schollz/progressbar/v3 v3.13.1
golang.org/x/crypto v0.12.0
......@@ -52,8 +52,8 @@ require (
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
......@@ -67,11 +67,11 @@ require (
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-20 v0.3.1 // indirect
github.com/quic-go/qtls-go1-20 v0.3.2 // indirect
github.com/redis/go-redis/v9 v9.0.5 // indirect
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/sirupsen/logrus v1.9.2 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/tidwall/btree v1.4.2 // indirect
github.com/tidwall/buntdb v1.3.0 // indirect
github.com/tidwall/gjson v1.14.3 // indirect
......
......@@ -88,12 +88,12 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
......@@ -115,8 +115,8 @@ github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWV
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.60 h1:iHkrmWyHFs/eZiWc2F/5jAHtNBAFy+HjdhMX6FkkPWc=
github.com/minio/minio-go/v7 v7.0.60/go.mod h1:NUDy4A4oXPq1l2yK6LTSvCEzAMeIcoz9lcj5dbzSrRE=
github.com/minio/minio-go/v7 v7.0.62 h1:qNYsFZHEzl+NfH8UxW4jpmlKav1qUAgfY30YNRneVhc=
github.com/minio/minio-go/v7 v7.0.62/go.mod h1:Q6X7Qjb7WMhvG65qKf4gUgA5XaiSox74kR1uAEjxRS4=
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
......@@ -126,10 +126,10 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/no-src/fsctl v0.1.2-0.20230809094346-873969ea2e79 h1:3I9Vl7r0UAJ7eopzmZzLQQdJkoefvqdENTZ5LJ41qu8=
github.com/no-src/fsctl v0.1.2-0.20230809094346-873969ea2e79/go.mod h1:sXkup5MSxKl0br3AbtkoOhaGD0QSuieO8J3pExKegVs=
github.com/no-src/log v0.2.3 h1:lCJrWeMMuC2Wkp6CKEVylgllH+k4YAm0eRsFX9nVxaQ=
github.com/no-src/log v0.2.3/go.mod h1:C58ahv0WdsBL3Yxi+v6wyUXzwqk7aEPN+/1ltOsdHXg=
github.com/no-src/fsctl v0.1.2 h1:7WqIurxv/f9jZjC4tja0CH7nsKX2Fm/vDSpqjqjcUIg=
github.com/no-src/fsctl v0.1.2/go.mod h1:cQdLhD6yd08KQZFLjBXr0M1OY7Oo8Vfbr/aOl89HTSA=
github.com/no-src/log v0.3.0 h1:uyW5RznvuST+BEb5hb774gTqVQNt6lfIjlUZiZhcM/w=
github.com/no-src/log v0.3.0/go.mod h1:AG2AiKsnJpZQHmJ24waj6Bi0xHaBEPXiFl1yYpHzLJQ=
github.com/no-src/nscache v0.1.1 h1:gs9hJ4Y5CaeLRmexvE4Rto6Gnjf5maKoTxFnssXAuJE=
github.com/no-src/nscache v0.1.1/go.mod h1:b8MdbvnxTwjlmyszbysVX/4/cZKk/rWvtW2RnQI7uSQ=
github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
......@@ -141,18 +141,18 @@ github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNc
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/sftp v1.13.5 h1:a3RLUqkyjYRtBTZJZ1VRrKbN3zhuPLlUc3sphVz81go=
github.com/pkg/sftp v1.13.5/go.mod h1:wHDZ0IZX6JcBYRK1TH9bcVq8G7TLpVHYIGJRFnmPfxg=
github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo=
github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b h1:aUNXCGgukb4gtY99imuIeoh8Vr0GSwAlYxPAhqZrpFc=
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/qtls-go1-20 v0.3.1 h1:O4BLOM3hwfVF3AcktIylQXyl7Yi2iBNVy5QsV+ySxbg=
github.com/quic-go/qtls-go1-20 v0.3.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
github.com/quic-go/quic-go v0.37.4 h1:ke8B73yMCWGq9MfrCCAw0Uzdm7GaViC3i39dsIdDlH4=
github.com/quic-go/quic-go v0.37.4/go.mod h1:YsbH1r4mSHPJcLF4k4zruUkLBqctEMBDR6VPvcYjIsU=
github.com/quic-go/qtls-go1-20 v0.3.2 h1:rRgN3WfnKbyik4dBV8A6girlJVxGand/d+jVKbQq5GI=
github.com/quic-go/qtls-go1-20 v0.3.2/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
github.com/quic-go/quic-go v0.38.0 h1:T45lASr5q/TrVwt+jrVccmqHhPL2XuSyoCLVCpfOSLc=
github.com/quic-go/quic-go v0.38.0/go.mod h1:MPCuRq7KBK2hNcfKj/1iD1BGuN3eAYMeNxp3T42LRUg=
github.com/redis/go-redis/v9 v9.0.5 h1:CuQcn5HIEeK7BgElubPP8CGtE0KakrnbBSTLjathl5o=
github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
......@@ -167,8 +167,8 @@ github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/schollz/progressbar/v3 v3.13.1 h1:o8rySDYiQ59Mwzy2FELeHY5ZARXZTVJC7iHD6PEFUiE=
github.com/schollz/progressbar/v3 v3.13.1/go.mod h1:xvrbki8kfT1fzWzBT/UZd9L6GA+jdL7HAgq2RFnO6fQ=
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
......@@ -209,6 +209,7 @@ github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZ
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/etcd/api/v3 v3.5.9 h1:4wSsluwyTbGGmyjJktOf3wFQoTBIURXHnq9n/G/JQHs=
......@@ -230,7 +231,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/exp v0.0.0-20230210204819-062eb4c674ab h1:628ME69lBm9C6JY2wXhAph/yjN3jezx1z7BIDLUwxjo=
......@@ -238,6 +240,7 @@ golang.org/x/exp v0.0.0-20230210204819-062eb4c674ab/go.mod h1:CxIveKay+FTh1D0yPZ
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
......@@ -247,7 +250,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU=
......@@ -256,25 +260,29 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
......@@ -282,6 +290,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
......@@ -291,6 +301,7 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
......
package cbool
import (
"sync/atomic"
)
// CBool a concurrent safe bool
type CBool struct {
v atomic.Bool
}
// New create an instance of CBool
func New(v bool) *CBool {
cb := &CBool{}
cb.v.Store(v)
return cb
}
// Get return the bool value
func (cb *CBool) Get() bool {
return cb.v.Load()
}
// Set to set the bool value
func (cb *CBool) Set(v bool) {
cb.v.Store(v)
}
// SetC to set the bool value and return a closed channel
func (cb *CBool) SetC(v bool) <-chan struct{} {
cb.Set(v)
c := make(chan struct{})
close(c)
return c
}
package cbool
import (
"sync"
"testing"
)
func TestCBool(t *testing.T) {
expect := true
cb := New(expect)
actual := cb.Get()
if actual != expect {
t.Errorf("test CBoll New and Get failed, expect:%v, actual:%v", expect, actual)
}
expect = false
cb.Set(expect)
actual = cb.Get()
if actual != expect {
t.Errorf("test CBoll Set and Get failed, expect:%v, actual:%v", expect, actual)
}
expect = true
c := cb.SetC(expect)
actual = cb.Get()
if actual != expect {
t.Errorf("test CBoll SetC and Get failed, expect:%v, actual:%v", expect, actual)
}
_, ok := <-c
if ok {
t.Errorf("test CBoll SetC value failed, channel should be closed")
}
}
func TestCBool_Concurrent(t *testing.T) {
cb := New(false)
wg := sync.WaitGroup{}
count := 10
wg.Add(count * 3)
for i := 0; i < count; i++ {
go func() {
cb.Get()
wg.Done()
}()
go func() {
cb.Set(true)
wg.Done()
}()
go func() {
<-cb.SetC(true)
wg.Done()
}()
}
wg.Wait()
}
func BenchmarkCBool(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
cb := New(false)
for i := 0; i < b.N; i++ {
cb.Set(true)
cb.Get()
}
}
......@@ -10,7 +10,7 @@ import (
)
// VERSION the current program version info
const VERSION = "v0.7.2"
const VERSION = "v0.8.0"
// Commit the commit file records the last commit hash value, used by release
//
......
......@@ -28,7 +28,7 @@ type baseMonitor struct {
mu sync.Mutex
syncSpec string
cronChan chan struct{}
shutdown chan bool
shutdown chan struct{}
syncOnce bool
el eventlog.EventLog
enableSyncDelay bool
......@@ -63,7 +63,7 @@ func newBaseMonitor(opt Option) baseMonitor {
writeChan: make(chan *writeMessage, 100),
writeNotify: make(chan struct{}, 100),
cronChan: make(chan struct{}, 1),
shutdown: make(chan bool, 1),
shutdown: make(chan struct{}, 1),
syncOnce: syncOnce,
el: eventlog.New(eventWriter),
enableSyncDelay: enableSyncDelay,
......@@ -281,7 +281,7 @@ func (m *baseMonitor) Shutdown() (err error) {
err = fmt.Errorf("%v", r)
}
}()
m.shutdown <- true
m.shutdown <- struct{}{}
return err
}
......
package monitor
import (
"github.com/no-src/gofs/internal/cbool"
"sync/atomic"
"github.com/no-src/gofs/wait"
"github.com/no-src/log"
)
......@@ -12,7 +13,7 @@ type driverPullClientMonitor struct {
func (m *driverPullClientMonitor) Start() (wait.Wait, error) {
wd := wait.NewWaitDone()
shutdown := cbool.New(false)
shutdown := &atomic.Bool{}
go m.waitShutdown(shutdown, wd)
// execute -sync_once flag
......@@ -40,17 +41,12 @@ func (m *driverPullClientMonitor) syncAndShutdown() (err error) {
}
// waitShutdown wait for the shutdown notify then mark the work done
func (m *driverPullClientMonitor) waitShutdown(st *cbool.CBool, wd wait.Done) {
select {
case <-st.SetC(<-m.shutdown):
{
if st.Get() {
log.ErrorIf(m.Close(), "close driver pull client monitor error")
m.syncer.Close()
wd.Done()
}
}
}
func (m *driverPullClientMonitor) waitShutdown(st *atomic.Bool, wd wait.Done) {
<-m.shutdown
st.Store(true)
log.ErrorIf(m.Close(), "close driver pull client monitor error")
m.syncer.Close()
wd.Done()
}
// sync try to sync all the files once
......
......@@ -134,13 +134,11 @@ func (m *fsNotifyMonitor) startReceiveEvents(wd wait.Done) error {
}
log.Error(err, "watcher error")
}
case shutdown := <-m.shutdown:
case <-m.shutdown:
{
if shutdown {
m.syncer.Close()
wd.Done()
return nil
}
m.syncer.Close()
wd.Done()
return nil
}
}
}
......
......@@ -5,6 +5,7 @@ import (
"fmt"
"net/url"
"os"
"sync/atomic"
"time"
"github.com/no-src/gofs/action"
......@@ -15,7 +16,6 @@ import (
"github.com/no-src/gofs/eventlog"
"github.com/no-src/gofs/fs"
"github.com/no-src/gofs/ignore"
"github.com/no-src/gofs/internal/cbool"
"github.com/no-src/gofs/internal/clist"
"github.com/no-src/gofs/util/stringutil"
"github.com/no-src/gofs/wait"
......@@ -26,7 +26,7 @@ type remoteClientMonitor struct {
baseMonitor
client apiclient.Client
closed *cbool.CBool
closed atomic.Bool
messages *clist.CList
pi ignore.PathIgnore
}
......@@ -55,7 +55,6 @@ func NewRemoteClientMonitor(opt Option) (Monitor, error) {
client: apiclient.New(host, port, enableTLS, certFile, user),
messages: clist.New(),
baseMonitor: newBaseMonitor(opt),
closed: cbool.New(false),
pi: pi,
}
return m, nil
......@@ -113,41 +112,36 @@ func (m *remoteClientMonitor) syncAndShutdown() (err error) {
// if receive a shutdown notify, then stop reading the message.
func (m *remoteClientMonitor) receive() wait.Wait {
wd := wait.NewWaitDone()
shutdown := cbool.New(false)
shutdown := &atomic.Bool{}
go m.waitShutdown(shutdown, wd)
go m.readMessage(shutdown, wd)
return wd
}
// waitShutdown wait for the shutdown notify then mark the work done
func (m *remoteClientMonitor) waitShutdown(st *cbool.CBool, wd wait.Done) {
select {
case <-st.SetC(<-m.shutdown):
{
if st.Get() {
log.ErrorIf(m.Close(), "close remote client monitor error")
m.syncer.Close()
wd.Done()
}
}
}
func (m *remoteClientMonitor) waitShutdown(st *atomic.Bool, wd wait.Done) {
<-m.shutdown
st.Store(true)
log.ErrorIf(m.Close(), "close remote client monitor error")
m.syncer.Close()
wd.Done()
}
// readMessage loop read the messages, if receive a message, parse the message then send to consumers according to the api type.
// if receive a shutdown notify, then stop reading the message.
func (m *remoteClientMonitor) readMessage(st *cbool.CBool, wd wait.Done) {
func (m *remoteClientMonitor) readMessage(st *atomic.Bool, wd wait.Done) {
mc, err := m.client.Monitor()
if err != nil {
return
}
for {
if m.closed.Get() {
if m.closed.Load() {
wd.DoneWithError(errors.New("remote monitor is closed"))
break
}
msg, err := mc.Recv()
if err != nil {
if st.Get() {
if st.Load() {
break
}
log.Error(err, "receive monitor message error")
......@@ -237,7 +231,7 @@ func (m *remoteClientMonitor) execSync(msg *monitor.MonitorMessage) (err error)
// Close mark the monitor is closed, then close the connection
func (m *remoteClientMonitor) Close() error {
m.closed.Set(true)
m.closed.Store(true)
if m.client != nil {
return m.client.Stop()
}
......
......@@ -5,12 +5,12 @@ import (
"fmt"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/no-src/gofs/api/apiclient"
"github.com/no-src/gofs/api/task"
"github.com/no-src/gofs/auth"
"github.com/no-src/gofs/internal/cbool"
"github.com/no-src/gofs/internal/clist"
"github.com/no-src/gofs/result"
"github.com/no-src/gofs/retry"
......@@ -23,7 +23,7 @@ type taskClientMonitor struct {
shutdown chan struct{}
retry retry.Retry
client apiclient.Client
closed *cbool.CBool
closed atomic.Bool
runFn func(content string, ext string) result.Result
clientId string
labels []string
......@@ -52,7 +52,6 @@ func NewTaskClientMonitor(opt Option, run runFn) (Monitor, error) {
shutdown: make(chan struct{}, 1),
retry: retry,
client: apiclient.New(host, port, enableTLS, certFile, user),
closed: cbool.New(false),
runFn: run,
clientId: randutil.RandomString(10),
labels: labels,
......@@ -77,7 +76,7 @@ func (m *taskClientMonitor) Start() (wait.Wait, error) {
// if receive a shutdown notify, then stop reading the message.
func (m *taskClientMonitor) receive() wait.Wait {
wd := wait.NewWaitDone()
shutdown := cbool.New(false)
shutdown := &atomic.Bool{}
go m.waitShutdown(shutdown, wd)
go m.readMessage(shutdown, wd)
go m.dequeue()
......@@ -85,20 +84,16 @@ func (m *taskClientMonitor) receive() wait.Wait {
}
// waitShutdown wait for the shutdown notify then mark the work done
func (m *taskClientMonitor) waitShutdown(st *cbool.CBool, wd wait.Done) {
select {
case <-m.shutdown:
{
st.Set(true)
log.ErrorIf(m.Close(), "close remote client monitor error")
wd.Done()
}
}
func (m *taskClientMonitor) waitShutdown(st *atomic.Bool, wd wait.Done) {
<-m.shutdown
st.Store(true)
log.ErrorIf(m.Close(), "close remote client monitor error")
wd.Done()
}
// readMessage loop read the messages, if receive a message, parse the message then send to consumers according to the api type.
// if receive a shutdown notify, then stop reading the message.
func (m *taskClientMonitor) readMessage(st *cbool.CBool, wd wait.Done) {
func (m *taskClientMonitor) readMessage(st *atomic.Bool, wd wait.Done) {
clientInfo := &task.ClientInfo{
ClientId: m.clientId,
Labels: m.labels,
......@@ -108,13 +103,13 @@ func (m *taskClientMonitor) readMessage(st *cbool.CBool, wd wait.Done) {
return
}
for {
if m.closed.Get() {
if m.closed.Load() {
wd.DoneWithError(errors.New("remote task client is closed"))
break
}
t, err := rc.Recv()
if err != nil {
if st.Get() {
if st.Load() {
break
}
log.Error(err, "subscribe task message error")
......@@ -138,7 +133,7 @@ func (m *taskClientMonitor) readMessage(st *cbool.CBool, wd wait.Done) {
// Close mark the monitor is closed, then close the connection
func (m *taskClientMonitor) Close() error {
m.closed.Set(true)
m.closed.Store(true)
if m.client != nil {
return m.client.Stop()
}
......@@ -159,6 +154,7 @@ func (m *taskClientMonitor) Shutdown() (err error) {
err = fmt.Errorf("%v", r)
}
}()
// broadcast shutdown notify
close(m.shutdown)
return err
}
......@@ -166,15 +162,13 @@ func (m *taskClientMonitor) Shutdown() (err error) {
func (m *taskClientMonitor) run(t *task.TaskInfo) {
log.Info("running gofs task [%s]", t.Name)
r := m.runFn(t.Content, t.Ext)
done := make(chan struct{}, 1)
go func() {
log.ErrorIf(r.Wait(), "running gofs task error [%s]", t.Name)
}()
select {
case <-m.shutdown:
log.ErrorIf(r.Shutdown(), "shutdown gofs task error [%s]", t.Name)
case <-done:
}
<-m.shutdown
log.ErrorIf(r.Shutdown(), "shutdown gofs task error [%s]", t.Name)
m.tasks.Delete(t.Name)
<-m.workers
log.Info("running gofs task finished [%s]", t.Name)
......@@ -188,7 +182,7 @@ func (m *taskClientMonitor) enqueue(t *task.TaskInfo) {
func (m *taskClientMonitor) dequeue() {
for {
if m.closed.Get() {
if m.closed.Load() {
break
}
e := m.queue.Front()
......
......@@ -12,13 +12,30 @@ echo -e "$(git rev-parse main)\c" >internal/version/commit
# set GOPROXY environment variable
# export GOPROXY=https://goproxy.cn
############################## linux-release ##############################
function build_release {
# build
go build -v -o . ./...
# set go env for linux
# release path, for example, gofs_go1.20.1_arm64_linux_v0.6.0
GOFS_RELEASE="gofs_${GOFS_RELEASE_GO_VERSION}_${GOARCH}_${GOOS}_${GOFS_RELEASE_VERSION}"
rm -rf "$GOFS_RELEASE"
mkdir "$GOFS_RELEASE"
mv gofs "$GOFS_RELEASE/"
# release archive
tar -zcvf "$GOFS_RELEASE.tar.gz" "$GOFS_RELEASE"
rm -rf "$GOFS_RELEASE"
}
############################## linux-amd64-release ##############################
# set go env
export GOOS=linux
export GOARCH=amd64
# build gofs
# build
go build -v -o . ./...
GOFS_RELEASE_GO_VERSION=$(go version | awk '{print $3}')
......@@ -31,23 +48,32 @@ rm -rf "$GOFS_RELEASE"
mkdir "$GOFS_RELEASE"
mv gofs "$GOFS_RELEASE/"
# linux release archive
# release archive
tar -zcvf "$GOFS_RELEASE.tar.gz" "$GOFS_RELEASE"
rm -rf "$GOFS_RELEASE"
############################## linux-release ##############################
############################## linux-amd64-release ##############################
############################## linux-arm64-release ##############################
export GOOS=linux
export GOARCH=arm64
build_release
############################## linux-arm64-release ##############################
############################# windows-release #############################
# set go env for windows
# set go env
export GOOS=windows
export GOARCH=amd64
# build gofs
# build
go build -v -o . ./...
# build gofs with -ldflags="-H windowsgui" flag
# build with -ldflags="-H windowsgui" flag
go build -v -ldflags="-H windowsgui" -o ./gofs_background.exe ./cmd/gofs
# release path, for example, gofs_go1.20.1_amd64_windows_v0.6.0
......@@ -63,28 +89,25 @@ rm -rf "$GOFS_RELEASE"
############################# windows-release #############################
############################## macOS-release ##############################
############################## macOS-amd64-release ##############################
# set go env for macOS
export GOOS=darwin
export GOARCH=amd64
# build gofs
go build -v -o . ./...
build_release
# release path, for example, gofs_go1.20.1_amd64_darwin_v0.6.0
GOFS_RELEASE="gofs_${GOFS_RELEASE_GO_VERSION}_${GOARCH}_${GOOS}_${GOFS_RELEASE_VERSION}"
############################## macOS-amd64-release ##############################
rm -rf "$GOFS_RELEASE"
mkdir "$GOFS_RELEASE"
mv gofs "$GOFS_RELEASE/"
############################## macOS-arm64-release ##############################
# macOS release archive
tar -zcvf "$GOFS_RELEASE.tar.gz" "$GOFS_RELEASE"
export GOOS=darwin
export GOARCH=arm64
rm -rf "$GOFS_RELEASE"
build_release
############################## macOS-release ##############################
############################## macOS-arm64-release ##############################
# reset commit file
echo -e "\c" >internal/version/commit
ls -alh | grep gofs_
\ No newline at end of file
......@@ -27,10 +27,6 @@ import (
)
var (
errAuthResponse = errors.New("receive auth command response error")
errInfoResponse = errors.New("receive info command response error")
errAuthTimeout = errors.New("auth timeout")
errInfoTimeout = errors.New("info timeout")
errPushServerUnsupported = errors.New("the push server is unsupported")
errSendToPushServer = errors.New("send a request to the push server error")
)
......