mirror of
https://github.com/containers/skopeo.git
synced 2025-07-11 13:44:15 +00:00
Merge pull request #1316 from containers/dependabot/go_modules/github.com/containers/image/v5-5.13.1
Bump github.com/containers/image/v5 from 5.12.0 to 5.13.1
This commit is contained in:
commit
5f8ec87c54
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.12
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/containers/common v0.39.0
|
github.com/containers/common v0.39.0
|
||||||
github.com/containers/image/v5 v5.12.0
|
github.com/containers/image/v5 v5.13.1
|
||||||
github.com/containers/ocicrypt v1.1.1
|
github.com/containers/ocicrypt v1.1.1
|
||||||
github.com/containers/storage v1.32.2
|
github.com/containers/storage v1.32.2
|
||||||
github.com/docker/docker v20.10.7+incompatible
|
github.com/docker/docker v20.10.7+incompatible
|
||||||
|
30
go.sum
30
go.sum
@ -67,8 +67,9 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE
|
|||||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||||
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
|
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
|
||||||
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=
|
|
||||||
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
|
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
|
||||||
|
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
||||||
|
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
@ -200,8 +201,9 @@ github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHV
|
|||||||
github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8=
|
github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8=
|
||||||
github.com/containers/common v0.39.0 h1:MrvpFa/bM4UmUILACv2IhOif4oLmWAiD4C+CpOc/MUo=
|
github.com/containers/common v0.39.0 h1:MrvpFa/bM4UmUILACv2IhOif4oLmWAiD4C+CpOc/MUo=
|
||||||
github.com/containers/common v0.39.0/go.mod h1:vPUHCg/dHoiyqIyLN+EdbjUaGrVEhs/hAvsqsxuYepk=
|
github.com/containers/common v0.39.0/go.mod h1:vPUHCg/dHoiyqIyLN+EdbjUaGrVEhs/hAvsqsxuYepk=
|
||||||
github.com/containers/image/v5 v5.12.0 h1:1hNS2QkzFQ4lH3GYQLyAXB0acRMhS1Ubm6oV++8vw4w=
|
|
||||||
github.com/containers/image/v5 v5.12.0/go.mod h1:VasTuHmOw+uD0oHCfApQcMO2+36SfyncoSahU7513Xs=
|
github.com/containers/image/v5 v5.12.0/go.mod h1:VasTuHmOw+uD0oHCfApQcMO2+36SfyncoSahU7513Xs=
|
||||||
|
github.com/containers/image/v5 v5.13.1 h1:eUb9YHEEo+akiQQEfCqZbAa9edg9Y6Mm30BG3NU4MbY=
|
||||||
|
github.com/containers/image/v5 v5.13.1/go.mod h1:GkWursKDlDcUIT7L7vZf70tADvZCk/Ga0wgS0MuF0ag=
|
||||||
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b h1:Q8ePgVfHDplZ7U33NwHZkrVELsZP5fYj9pM5WBZB2GE=
|
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b h1:Q8ePgVfHDplZ7U33NwHZkrVELsZP5fYj9pM5WBZB2GE=
|
||||||
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
|
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
|
||||||
github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc=
|
github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc=
|
||||||
@ -238,6 +240,7 @@ github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1S
|
|||||||
github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s=
|
github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s=
|
||||||
github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8=
|
github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8=
|
||||||
github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I=
|
github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I=
|
||||||
|
github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -255,8 +258,9 @@ github.com/docker/docker v1.4.2-0.20191219165747-a9416c67da9f/go.mod h1:eEKB0N0r
|
|||||||
github.com/docker/docker v20.10.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v20.10.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/docker v20.10.7+incompatible h1:Z6O9Nhsjv+ayUEeI1IojKbYcsGdgYSNqxe1s2MYzUhQ=
|
github.com/docker/docker v20.10.7+incompatible h1:Z6O9Nhsjv+ayUEeI1IojKbYcsGdgYSNqxe1s2MYzUhQ=
|
||||||
github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/docker-credential-helpers v0.6.3 h1:zI2p9+1NQYdnG6sMU26EX4aVGlqbInSQxQXLvzJ4RPQ=
|
|
||||||
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
|
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
|
||||||
|
github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o=
|
||||||
|
github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c=
|
||||||
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
||||||
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
||||||
github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA=
|
github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA=
|
||||||
@ -437,8 +441,9 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
|
|||||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
|
|
||||||
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
|
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
|
||||||
|
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
|
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
|
||||||
@ -464,8 +469,9 @@ github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0
|
|||||||
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||||
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||||
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||||
github.com/klauspost/compress v1.13.0 h1:2T7tUoQrQT+fQWdaY5rjWztFGAFwbGD04iPJg90ZiOs=
|
|
||||||
github.com/klauspost/compress v1.13.0/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
github.com/klauspost/compress v1.13.0/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||||
|
github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ=
|
||||||
|
github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||||
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
||||||
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||||
@ -493,8 +499,9 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
|
|||||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||||
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
|
|
||||||
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||||
|
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||||
|
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
|
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
|
||||||
github.com/mattn/go-shellwords v1.0.11/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
github.com/mattn/go-shellwords v1.0.11/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
||||||
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
|
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
|
||||||
@ -726,8 +733,9 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
|
|||||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/vbatts/tar-split v0.11.1 h1:0Odu65rhcZ3JZaPHxl7tCI3V/C/Q9Zf82UFravl02dE=
|
github.com/vbatts/tar-split v0.11.1 h1:0Odu65rhcZ3JZaPHxl7tCI3V/C/Q9Zf82UFravl02dE=
|
||||||
github.com/vbatts/tar-split v0.11.1/go.mod h1:LEuURwDEiWjRjwu46yU3KVGuUdVv/dcnpcEPSzR8z6g=
|
github.com/vbatts/tar-split v0.11.1/go.mod h1:LEuURwDEiWjRjwu46yU3KVGuUdVv/dcnpcEPSzR8z6g=
|
||||||
github.com/vbauerster/mpb/v6 v6.0.3 h1:j+twHHhSUe8aXWaT/27E98G5cSBeqEuJSVCMjmLg0PI=
|
|
||||||
github.com/vbauerster/mpb/v6 v6.0.3/go.mod h1:5luBx4rDLWxpA4t6I5sdeeQuZhqDxc+wr5Nqf35+tnM=
|
github.com/vbauerster/mpb/v6 v6.0.3/go.mod h1:5luBx4rDLWxpA4t6I5sdeeQuZhqDxc+wr5Nqf35+tnM=
|
||||||
|
github.com/vbauerster/mpb/v7 v7.0.2 h1:eN6AD/ytv1nqCO7Dm8MO0/pGMKmMyH/WMnTJhAUuc/w=
|
||||||
|
github.com/vbauerster/mpb/v7 v7.0.2/go.mod h1:Mnq3gESXJ9eQhccbGZDggJ1faTCrmaA4iN57fUloRGE=
|
||||||
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||||
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
|
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
|
||||||
@ -753,8 +761,9 @@ github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPS
|
|||||||
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
|
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
|
||||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
|
|
||||||
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||||
|
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
|
||||||
|
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
|
||||||
go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg=
|
go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg=
|
||||||
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1 h1:A/5uWzF44DlIgdm/PQFwfMkW0JX+cIcQi/SwLAmZP5M=
|
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1 h1:A/5uWzF44DlIgdm/PQFwfMkW0JX+cIcQi/SwLAmZP5M=
|
||||||
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk=
|
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk=
|
||||||
@ -923,6 +932,7 @@ golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@ -930,11 +940,13 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 h1:dXfMednGJh/SUUFjTLsWJz3P+TQt9qnR11GgeI3vWKs=
|
|
||||||
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I=
|
||||||
|
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
1
vendor/github.com/VividCortex/ewma/.gitignore
generated
vendored
1
vendor/github.com/VividCortex/ewma/.gitignore
generated
vendored
@ -1,2 +1,3 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.*.sw?
|
.*.sw?
|
||||||
|
/coverage.txt
|
3
vendor/github.com/VividCortex/ewma/.whitesource
generated
vendored
Normal file
3
vendor/github.com/VividCortex/ewma/.whitesource
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"settingsInheritedFrom": "VividCortex/whitesource-config@master"
|
||||||
|
}
|
29
vendor/github.com/VividCortex/ewma/README.md
generated
vendored
29
vendor/github.com/VividCortex/ewma/README.md
generated
vendored
@ -1,4 +1,8 @@
|
|||||||
# EWMA [](https://godoc.org/github.com/VividCortex/ewma) 
|
# EWMA
|
||||||
|
|
||||||
|
[](https://godoc.org/github.com/VividCortex/ewma)
|
||||||
|

|
||||||
|
[](https://codecov.io/gh/VividCortex/ewma)
|
||||||
|
|
||||||
This repo provides Exponentially Weighted Moving Average algorithms, or EWMAs for short, [based on our
|
This repo provides Exponentially Weighted Moving Average algorithms, or EWMAs for short, [based on our
|
||||||
Quantifying Abnormal Behavior talk](https://vividcortex.com/blog/2013/07/23/a-fast-go-library-for-exponential-moving-averages/).
|
Quantifying Abnormal Behavior talk](https://vividcortex.com/blog/2013/07/23/a-fast-go-library-for-exponential-moving-averages/).
|
||||||
@ -103,23 +107,24 @@ View the GoDoc generated documentation [here](http://godoc.org/github.com/VividC
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/VividCortex/ewma"
|
import "github.com/VividCortex/ewma"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
samples := [100]float64{
|
samples := [100]float64{
|
||||||
4599, 5711, 4746, 4621, 5037, 4218, 4925, 4281, 5207, 5203, 5594, 5149,
|
4599, 5711, 4746, 4621, 5037, 4218, 4925, 4281, 5207, 5203, 5594, 5149,
|
||||||
}
|
}
|
||||||
|
|
||||||
e := ewma.NewMovingAverage() //=> Returns a SimpleEWMA if called without params
|
e := ewma.NewMovingAverage() //=> Returns a SimpleEWMA if called without params
|
||||||
a := ewma.NewMovingAverage(5) //=> returns a VariableEWMA with a decay of 2 / (5 + 1)
|
a := ewma.NewMovingAverage(5) //=> returns a VariableEWMA with a decay of 2 / (5 + 1)
|
||||||
|
|
||||||
for _, f := range samples {
|
for _, f := range samples {
|
||||||
e.Add(f)
|
e.Add(f)
|
||||||
a.Add(f)
|
a.Add(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
e.Value() //=> 13.577404704631077
|
e.Value() //=> 13.577404704631077
|
||||||
a.Value() //=> 1.5806140565521463e-12
|
a.Value() //=> 1.5806140565521463e-12
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
6
vendor/github.com/VividCortex/ewma/codecov.yml
generated
vendored
Normal file
6
vendor/github.com/VividCortex/ewma/codecov.yml
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
coverage:
|
||||||
|
status:
|
||||||
|
project:
|
||||||
|
default:
|
||||||
|
threshold: 15%
|
||||||
|
patch: off
|
3
vendor/github.com/VividCortex/ewma/go.mod
generated
vendored
Normal file
3
vendor/github.com/VividCortex/ewma/go.mod
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module github.com/VividCortex/ewma
|
||||||
|
|
||||||
|
go 1.12
|
53
vendor/github.com/containers/image/v5/copy/copy.go
generated
vendored
53
vendor/github.com/containers/image/v5/copy/copy.go
generated
vendored
@ -29,10 +29,10 @@ import (
|
|||||||
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/vbauerster/mpb/v6"
|
"github.com/vbauerster/mpb/v7"
|
||||||
"github.com/vbauerster/mpb/v6/decor"
|
"github.com/vbauerster/mpb/v7/decor"
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
|
||||||
"golang.org/x/sync/semaphore"
|
"golang.org/x/sync/semaphore"
|
||||||
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
type digestingReader struct {
|
type digestingReader struct {
|
||||||
@ -43,10 +43,6 @@ type digestingReader struct {
|
|||||||
validationSucceeded bool
|
validationSucceeded bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: disable early layer commits temporarily until a solid solution to
|
|
||||||
// address #1205 has been found.
|
|
||||||
const enableEarlyCommit = false
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ErrDecryptParamsMissing is returned if there is missing decryption parameters
|
// ErrDecryptParamsMissing is returned if there is missing decryption parameters
|
||||||
ErrDecryptParamsMissing = errors.New("Necessary DecryptParameters not present")
|
ErrDecryptParamsMissing = errors.New("Necessary DecryptParameters not present")
|
||||||
@ -864,7 +860,7 @@ func (ic *imageCopier) noPendingManifestUpdates() bool {
|
|||||||
// isTTY returns true if the io.Writer is a file and a tty.
|
// isTTY returns true if the io.Writer is a file and a tty.
|
||||||
func isTTY(w io.Writer) bool {
|
func isTTY(w io.Writer) bool {
|
||||||
if f, ok := w.(*os.File); ok {
|
if f, ok := w.(*os.File); ok {
|
||||||
return terminal.IsTerminal(int(f.Fd()))
|
return term.IsTerminal(int(f.Fd()))
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -893,6 +889,18 @@ func (ic *imageCopier) copyLayers(ctx context.Context) error {
|
|||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The manifest is used to extract the information whether a given
|
||||||
|
// layer is empty.
|
||||||
|
manifestBlob, manifestType, err := ic.src.Manifest(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
man, err := manifest.FromBlob(manifestBlob, manifestType)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
manifestLayerInfos := man.LayerInfos()
|
||||||
|
|
||||||
// copyGroup is used to determine if all layers are copied
|
// copyGroup is used to determine if all layers are copied
|
||||||
copyGroup := sync.WaitGroup{}
|
copyGroup := sync.WaitGroup{}
|
||||||
|
|
||||||
@ -925,7 +933,7 @@ func (ic *imageCopier) copyLayers(ctx context.Context) error {
|
|||||||
logrus.Debugf("Skipping foreign layer %q copy to %s", cld.destInfo.Digest, ic.c.dest.Reference().Transport().Name())
|
logrus.Debugf("Skipping foreign layer %q copy to %s", cld.destInfo.Digest, ic.c.dest.Reference().Transport().Name())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cld.destInfo, cld.diffID, cld.err = ic.copyLayer(ctx, srcLayer, toEncrypt, pool, index, srcRef)
|
cld.destInfo, cld.diffID, cld.err = ic.copyLayer(ctx, srcLayer, toEncrypt, pool, index, srcRef, manifestLayerInfos[index].EmptyLayer)
|
||||||
}
|
}
|
||||||
data[index] = cld
|
data[index] = cld
|
||||||
}
|
}
|
||||||
@ -1094,8 +1102,9 @@ func (c *copier) createProgressBar(pool *mpb.Progress, info types.BlobInfo, kind
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
sstyle := mpb.SpinnerStyle(".", "..", "...", "....", "").PositionLeft()
|
||||||
bar = pool.Add(0,
|
bar = pool.Add(0,
|
||||||
mpb.NewSpinnerFiller([]string{".", "..", "...", "....", ""}, mpb.SpinnerOnLeft),
|
sstyle.Build(),
|
||||||
mpb.BarFillerClearOnComplete(),
|
mpb.BarFillerClearOnComplete(),
|
||||||
mpb.PrependDecorators(
|
mpb.PrependDecorators(
|
||||||
decor.OnComplete(decor.Name(prefix), onComplete),
|
decor.OnComplete(decor.Name(prefix), onComplete),
|
||||||
@ -1121,7 +1130,7 @@ func (c *copier) copyConfig(ctx context.Context, src types.Image) error {
|
|||||||
progressPool, progressCleanup := c.newProgressPool(ctx)
|
progressPool, progressCleanup := c.newProgressPool(ctx)
|
||||||
defer progressCleanup()
|
defer progressCleanup()
|
||||||
bar := c.createProgressBar(progressPool, srcInfo, "config", "done")
|
bar := c.createProgressBar(progressPool, srcInfo, "config", "done")
|
||||||
destInfo, err := c.copyBlobFromStream(ctx, bytes.NewReader(configBlob), srcInfo, nil, false, true, false, bar, -1)
|
destInfo, err := c.copyBlobFromStream(ctx, bytes.NewReader(configBlob), srcInfo, nil, false, true, false, bar, -1, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, err
|
return types.BlobInfo{}, err
|
||||||
}
|
}
|
||||||
@ -1148,7 +1157,7 @@ type diffIDResult struct {
|
|||||||
// copyLayer copies a layer with srcInfo (with known Digest and Annotations and possibly known Size) in src to dest, perhaps (de/re/)compressing it,
|
// copyLayer copies a layer with srcInfo (with known Digest and Annotations and possibly known Size) in src to dest, perhaps (de/re/)compressing it,
|
||||||
// and returns a complete blobInfo of the copied layer, and a value for LayerDiffIDs if diffIDIsNeeded
|
// and returns a complete blobInfo of the copied layer, and a value for LayerDiffIDs if diffIDIsNeeded
|
||||||
// srcRef can be used as an additional hint to the destination during checking whehter a layer can be reused but srcRef can be nil.
|
// srcRef can be used as an additional hint to the destination during checking whehter a layer can be reused but srcRef can be nil.
|
||||||
func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, toEncrypt bool, pool *mpb.Progress, layerIndex int, srcRef reference.Named) (types.BlobInfo, digest.Digest, error) {
|
func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, toEncrypt bool, pool *mpb.Progress, layerIndex int, srcRef reference.Named, emptyLayer bool) (types.BlobInfo, digest.Digest, error) {
|
||||||
// If the srcInfo doesn't contain compression information, try to compute it from the
|
// If the srcInfo doesn't contain compression information, try to compute it from the
|
||||||
// MediaType, which was either read from a manifest by way of LayerInfos() or constructed
|
// MediaType, which was either read from a manifest by way of LayerInfos() or constructed
|
||||||
// by LayerInfosForCopy(), if it was supplied at all. If we succeed in copying the blob,
|
// by LayerInfosForCopy(), if it was supplied at all. If we succeed in copying the blob,
|
||||||
@ -1195,10 +1204,9 @@ func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, to
|
|||||||
Cache: ic.c.blobInfoCache,
|
Cache: ic.c.blobInfoCache,
|
||||||
CanSubstitute: ic.canSubstituteBlobs,
|
CanSubstitute: ic.canSubstituteBlobs,
|
||||||
SrcRef: srcRef,
|
SrcRef: srcRef,
|
||||||
|
EmptyLayer: emptyLayer,
|
||||||
}
|
}
|
||||||
if enableEarlyCommit {
|
options.LayerIndex = &layerIndex
|
||||||
options.LayerIndex = &layerIndex
|
|
||||||
}
|
|
||||||
reused, blobInfo, err = dest.TryReusingBlobWithOptions(ctx, srcInfo, options)
|
reused, blobInfo, err = dest.TryReusingBlobWithOptions(ctx, srcInfo, options)
|
||||||
} else {
|
} else {
|
||||||
reused, blobInfo, err = ic.c.dest.TryReusingBlob(ctx, srcInfo, ic.c.blobInfoCache, ic.canSubstituteBlobs)
|
reused, blobInfo, err = ic.c.dest.TryReusingBlob(ctx, srcInfo, ic.c.blobInfoCache, ic.canSubstituteBlobs)
|
||||||
@ -1245,7 +1253,7 @@ func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, to
|
|||||||
|
|
||||||
bar := ic.c.createProgressBar(pool, srcInfo, "blob", "done")
|
bar := ic.c.createProgressBar(pool, srcInfo, "blob", "done")
|
||||||
|
|
||||||
blobInfo, diffIDChan, err := ic.copyLayerFromStream(ctx, srcStream, types.BlobInfo{Digest: srcInfo.Digest, Size: srcBlobSize, MediaType: srcInfo.MediaType, Annotations: srcInfo.Annotations}, diffIDIsNeeded, toEncrypt, bar, layerIndex)
|
blobInfo, diffIDChan, err := ic.copyLayerFromStream(ctx, srcStream, types.BlobInfo{Digest: srcInfo.Digest, Size: srcBlobSize, MediaType: srcInfo.MediaType, Annotations: srcInfo.Annotations}, diffIDIsNeeded, toEncrypt, bar, layerIndex, emptyLayer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.BlobInfo{}, "", err
|
return types.BlobInfo{}, "", err
|
||||||
}
|
}
|
||||||
@ -1276,7 +1284,7 @@ func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, to
|
|||||||
// perhaps (de/re/)compressing the stream,
|
// perhaps (de/re/)compressing the stream,
|
||||||
// and returns a complete blobInfo of the copied blob and perhaps a <-chan diffIDResult if diffIDIsNeeded, to be read by the caller.
|
// and returns a complete blobInfo of the copied blob and perhaps a <-chan diffIDResult if diffIDIsNeeded, to be read by the caller.
|
||||||
func (ic *imageCopier) copyLayerFromStream(ctx context.Context, srcStream io.Reader, srcInfo types.BlobInfo,
|
func (ic *imageCopier) copyLayerFromStream(ctx context.Context, srcStream io.Reader, srcInfo types.BlobInfo,
|
||||||
diffIDIsNeeded bool, toEncrypt bool, bar *mpb.Bar, layerIndex int) (types.BlobInfo, <-chan diffIDResult, error) {
|
diffIDIsNeeded bool, toEncrypt bool, bar *mpb.Bar, layerIndex int, emptyLayer bool) (types.BlobInfo, <-chan diffIDResult, error) {
|
||||||
var getDiffIDRecorder func(compression.DecompressorFunc) io.Writer // = nil
|
var getDiffIDRecorder func(compression.DecompressorFunc) io.Writer // = nil
|
||||||
var diffIDChan chan diffIDResult
|
var diffIDChan chan diffIDResult
|
||||||
|
|
||||||
@ -1301,7 +1309,7 @@ func (ic *imageCopier) copyLayerFromStream(ctx context.Context, srcStream io.Rea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blobInfo, err := ic.c.copyBlobFromStream(ctx, srcStream, srcInfo, getDiffIDRecorder, ic.canModifyManifest, false, toEncrypt, bar, layerIndex) // Sets err to nil on success
|
blobInfo, err := ic.c.copyBlobFromStream(ctx, srcStream, srcInfo, getDiffIDRecorder, ic.canModifyManifest, false, toEncrypt, bar, layerIndex, emptyLayer) // Sets err to nil on success
|
||||||
return blobInfo, diffIDChan, err
|
return blobInfo, diffIDChan, err
|
||||||
// We need the defer … pipeWriter.CloseWithError() to happen HERE so that the caller can block on reading from diffIDChan
|
// We need the defer … pipeWriter.CloseWithError() to happen HERE so that the caller can block on reading from diffIDChan
|
||||||
}
|
}
|
||||||
@ -1353,7 +1361,7 @@ func (r errorAnnotationReader) Read(b []byte) (n int, err error) {
|
|||||||
// and returns a complete blobInfo of the copied blob.
|
// and returns a complete blobInfo of the copied blob.
|
||||||
func (c *copier) copyBlobFromStream(ctx context.Context, srcStream io.Reader, srcInfo types.BlobInfo,
|
func (c *copier) copyBlobFromStream(ctx context.Context, srcStream io.Reader, srcInfo types.BlobInfo,
|
||||||
getOriginalLayerCopyWriter func(decompressor compression.DecompressorFunc) io.Writer,
|
getOriginalLayerCopyWriter func(decompressor compression.DecompressorFunc) io.Writer,
|
||||||
canModifyBlob bool, isConfig bool, toEncrypt bool, bar *mpb.Bar, layerIndex int) (types.BlobInfo, error) {
|
canModifyBlob bool, isConfig bool, toEncrypt bool, bar *mpb.Bar, layerIndex int, emptyLayer bool) (types.BlobInfo, error) {
|
||||||
if isConfig { // This is guaranteed by the caller, but set it here to be explicit.
|
if isConfig { // This is guaranteed by the caller, but set it here to be explicit.
|
||||||
canModifyBlob = false
|
canModifyBlob = false
|
||||||
}
|
}
|
||||||
@ -1556,10 +1564,11 @@ func (c *copier) copyBlobFromStream(ctx context.Context, srcStream io.Reader, sr
|
|||||||
dest, ok := c.dest.(internalTypes.ImageDestinationWithOptions)
|
dest, ok := c.dest.(internalTypes.ImageDestinationWithOptions)
|
||||||
if ok {
|
if ok {
|
||||||
options := internalTypes.PutBlobOptions{
|
options := internalTypes.PutBlobOptions{
|
||||||
Cache: c.blobInfoCache,
|
Cache: c.blobInfoCache,
|
||||||
IsConfig: isConfig,
|
IsConfig: isConfig,
|
||||||
|
EmptyLayer: emptyLayer,
|
||||||
}
|
}
|
||||||
if !isConfig && enableEarlyCommit {
|
if !isConfig {
|
||||||
options.LayerIndex = &layerIndex
|
options.LayerIndex = &layerIndex
|
||||||
}
|
}
|
||||||
uploadedInfo, err = dest.PutBlobWithOptions(ctx, &errorAnnotationReader{destStream}, inputInfo, options)
|
uploadedInfo, err = dest.PutBlobWithOptions(ctx, &errorAnnotationReader{destStream}, inputInfo, options)
|
||||||
|
2
vendor/github.com/containers/image/v5/internal/pkg/platform/platform_matcher.go
generated
vendored
2
vendor/github.com/containers/image/v5/internal/pkg/platform/platform_matcher.go
generated
vendored
@ -9,7 +9,7 @@ package platform
|
|||||||
// Licensed under the Apache License, Version 2.0 (the "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 not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// https://www.apache.org/licenses/LICENSE-2.0
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
4
vendor/github.com/containers/image/v5/internal/types/types.go
generated
vendored
4
vendor/github.com/containers/image/v5/internal/types/types.go
generated
vendored
@ -39,6 +39,8 @@ type PutBlobOptions struct {
|
|||||||
Cache publicTypes.BlobInfoCache
|
Cache publicTypes.BlobInfoCache
|
||||||
// Denotes whether the blob is a config or not.
|
// Denotes whether the blob is a config or not.
|
||||||
IsConfig bool
|
IsConfig bool
|
||||||
|
// Indicates an empty layer.
|
||||||
|
EmptyLayer bool
|
||||||
// The corresponding index in the layer slice.
|
// The corresponding index in the layer slice.
|
||||||
LayerIndex *int
|
LayerIndex *int
|
||||||
}
|
}
|
||||||
@ -49,6 +51,8 @@ type TryReusingBlobOptions struct {
|
|||||||
Cache publicTypes.BlobInfoCache
|
Cache publicTypes.BlobInfoCache
|
||||||
// Use an equivalent of the desired blob.
|
// Use an equivalent of the desired blob.
|
||||||
CanSubstitute bool
|
CanSubstitute bool
|
||||||
|
// Indicates an empty layer.
|
||||||
|
EmptyLayer bool
|
||||||
// The corresponding index in the layer slice.
|
// The corresponding index in the layer slice.
|
||||||
LayerIndex *int
|
LayerIndex *int
|
||||||
// The reference of the image that contains the target blob.
|
// The reference of the image that contains the target blob.
|
||||||
|
50
vendor/github.com/containers/image/v5/pkg/docker/config/config.go
generated
vendored
50
vendor/github.com/containers/image/v5/pkg/docker/config/config.go
generated
vendored
@ -51,21 +51,26 @@ var (
|
|||||||
ErrNotSupported = errors.New("not supported")
|
ErrNotSupported = errors.New("not supported")
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetAuthentication stores the username and password in the credential helper or file
|
// SetCredentials stores the username and password in the credential helper or file
|
||||||
func SetAuthentication(sys *types.SystemContext, registry, username, password string) error {
|
// and returns path to file or helper name in format (helper:%s).
|
||||||
|
// Returns a human-redable description of the location that was updated.
|
||||||
|
// NOTE: The return value is only intended to be read by humans; its form is not an API,
|
||||||
|
// it may change (or new forms can be added) any time.
|
||||||
|
func SetCredentials(sys *types.SystemContext, registry, username, password string) (string, error) {
|
||||||
helpers, err := sysregistriesv2.CredentialHelpers(sys)
|
helpers, err := sysregistriesv2.CredentialHelpers(sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure to collect all errors.
|
// Make sure to collect all errors.
|
||||||
var multiErr error
|
var multiErr error
|
||||||
for _, helper := range helpers {
|
for _, helper := range helpers {
|
||||||
|
var desc string
|
||||||
var err error
|
var err error
|
||||||
switch helper {
|
switch helper {
|
||||||
// Special-case the built-in helpers for auth files.
|
// Special-case the built-in helpers for auth files.
|
||||||
case sysregistriesv2.AuthenticationFileHelper:
|
case sysregistriesv2.AuthenticationFileHelper:
|
||||||
err = modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
desc, err = modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
||||||
if ch, exists := auths.CredHelpers[registry]; exists {
|
if ch, exists := auths.CredHelpers[registry]; exists {
|
||||||
return false, setAuthToCredHelper(ch, registry, username, password)
|
return false, setAuthToCredHelper(ch, registry, username, password)
|
||||||
}
|
}
|
||||||
@ -76,6 +81,7 @@ func SetAuthentication(sys *types.SystemContext, registry, username, password st
|
|||||||
})
|
})
|
||||||
// External helpers.
|
// External helpers.
|
||||||
default:
|
default:
|
||||||
|
desc = fmt.Sprintf("credential helper: %s", helper)
|
||||||
err = setAuthToCredHelper(helper, registry, username, password)
|
err = setAuthToCredHelper(helper, registry, username, password)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -84,9 +90,15 @@ func SetAuthentication(sys *types.SystemContext, registry, username, password st
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
logrus.Debugf("Stored credentials for %s in credential helper %s", registry, helper)
|
logrus.Debugf("Stored credentials for %s in credential helper %s", registry, helper)
|
||||||
return nil
|
return desc, nil
|
||||||
}
|
}
|
||||||
return multiErr
|
return "", multiErr
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAuthentication stores the username and password in the credential helper or file
|
||||||
|
func SetAuthentication(sys *types.SystemContext, registry, username, password string) error {
|
||||||
|
_, err := SetCredentials(sys, registry, username, password)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAllCredentials returns the registry credentials for all registries stored
|
// GetAllCredentials returns the registry credentials for all registries stored
|
||||||
@ -322,7 +334,7 @@ func RemoveAuthentication(sys *types.SystemContext, registry string) error {
|
|||||||
switch helper {
|
switch helper {
|
||||||
// Special-case the built-in helper for auth files.
|
// Special-case the built-in helper for auth files.
|
||||||
case sysregistriesv2.AuthenticationFileHelper:
|
case sysregistriesv2.AuthenticationFileHelper:
|
||||||
err = modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
_, err = modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
||||||
if innerHelper, exists := auths.CredHelpers[registry]; exists {
|
if innerHelper, exists := auths.CredHelpers[registry]; exists {
|
||||||
removeFromCredHelper(innerHelper)
|
removeFromCredHelper(innerHelper)
|
||||||
}
|
}
|
||||||
@ -368,7 +380,7 @@ func RemoveAllAuthentication(sys *types.SystemContext) error {
|
|||||||
switch helper {
|
switch helper {
|
||||||
// Special-case the built-in helper for auth files.
|
// Special-case the built-in helper for auth files.
|
||||||
case sysregistriesv2.AuthenticationFileHelper:
|
case sysregistriesv2.AuthenticationFileHelper:
|
||||||
err = modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
_, err = modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) {
|
||||||
for registry, helper := range auths.CredHelpers {
|
for registry, helper := range auths.CredHelpers {
|
||||||
// Helpers in auth files are expected
|
// Helpers in auth files are expected
|
||||||
// to exist, so no special treatment
|
// to exist, so no special treatment
|
||||||
@ -493,42 +505,44 @@ func readJSONFile(path string, legacyFormat bool) (dockerConfigFile, error) {
|
|||||||
return auths, nil
|
return auths, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// modifyJSON writes to auth.json if the dockerConfigFile has been updated
|
// modifyJSON finds an auth.json file, calls editor on the contents, and
|
||||||
func modifyJSON(sys *types.SystemContext, editor func(auths *dockerConfigFile) (bool, error)) error {
|
// writes it back if editor returns true.
|
||||||
|
// Returns a human-redable description of the file, to be returned by SetCredentials.
|
||||||
|
func modifyJSON(sys *types.SystemContext, editor func(auths *dockerConfigFile) (bool, error)) (string, error) {
|
||||||
path, legacyFormat, err := getPathToAuth(sys)
|
path, legacyFormat, err := getPathToAuth(sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return "", err
|
||||||
}
|
}
|
||||||
if legacyFormat {
|
if legacyFormat {
|
||||||
return fmt.Errorf("writes to %s using legacy format are not supported", path)
|
return "", fmt.Errorf("writes to %s using legacy format are not supported", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
dir := filepath.Dir(path)
|
dir := filepath.Dir(path)
|
||||||
if err = os.MkdirAll(dir, 0700); err != nil {
|
if err = os.MkdirAll(dir, 0700); err != nil {
|
||||||
return err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
auths, err := readJSONFile(path, false)
|
auths, err := readJSONFile(path, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error reading JSON file %q", path)
|
return "", errors.Wrapf(err, "error reading JSON file %q", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
updated, err := editor(&auths)
|
updated, err := editor(&auths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error updating %q", path)
|
return "", errors.Wrapf(err, "error updating %q", path)
|
||||||
}
|
}
|
||||||
if updated {
|
if updated {
|
||||||
newData, err := json.MarshalIndent(auths, "", "\t")
|
newData, err := json.MarshalIndent(auths, "", "\t")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error marshaling JSON %q", path)
|
return "", errors.Wrapf(err, "error marshaling JSON %q", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = ioutil.WriteFile(path, newData, 0600); err != nil {
|
if err = ioutil.WriteFile(path, newData, 0600); err != nil {
|
||||||
return errors.Wrapf(err, "error writing to file %q", path)
|
return "", errors.Wrapf(err, "error writing to file %q", path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return path, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAuthFromCredHelper(credHelper, registry string) (types.DockerAuthConfig, error) {
|
func getAuthFromCredHelper(credHelper, registry string) (types.DockerAuthConfig, error) {
|
||||||
|
12
vendor/github.com/containers/image/v5/pkg/docker/config/config_linux.go
generated
vendored
12
vendor/github.com/containers/image/v5/pkg/docker/config/config_linux.go
generated
vendored
@ -13,9 +13,9 @@ import (
|
|||||||
// reenable keyring support, we should introduce a similar built-in credential
|
// reenable keyring support, we should introduce a similar built-in credential
|
||||||
// helpers as for `sysregistriesv2.AuthenticationFileHelper`.
|
// helpers as for `sysregistriesv2.AuthenticationFileHelper`.
|
||||||
|
|
||||||
const keyDescribePrefix = "container-registry-login:" // nolint
|
const keyDescribePrefix = "container-registry-login:" //nolint:deadcode,unused
|
||||||
|
|
||||||
func getAuthFromKernelKeyring(registry string) (string, string, error) { // nolint
|
func getAuthFromKernelKeyring(registry string) (string, string, error) { //nolint:deadcode,unused
|
||||||
userkeyring, err := keyctl.UserKeyring()
|
userkeyring, err := keyctl.UserKeyring()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
@ -35,7 +35,7 @@ func getAuthFromKernelKeyring(registry string) (string, string, error) { // noli
|
|||||||
return parts[0], parts[1], nil
|
return parts[0], parts[1], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteAuthFromKernelKeyring(registry string) error { // nolint
|
func deleteAuthFromKernelKeyring(registry string) error { //nolint:deadcode,unused
|
||||||
userkeyring, err := keyctl.UserKeyring()
|
userkeyring, err := keyctl.UserKeyring()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -48,7 +48,7 @@ func deleteAuthFromKernelKeyring(registry string) error { // nolint
|
|||||||
return key.Unlink()
|
return key.Unlink()
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeAllAuthFromKernelKeyring() error { // nolint
|
func removeAllAuthFromKernelKeyring() error { //nolint:deadcode,unused
|
||||||
keys, err := keyctl.ReadUserKeyring()
|
keys, err := keyctl.ReadUserKeyring()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -81,7 +81,7 @@ func removeAllAuthFromKernelKeyring() error { // nolint
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setAuthToKernelKeyring(registry, username, password string) error { // nolint
|
func setAuthToKernelKeyring(registry, username, password string) error { //nolint:deadcode,unused
|
||||||
keyring, err := keyctl.SessionKeyring()
|
keyring, err := keyctl.SessionKeyring()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -114,6 +114,6 @@ func setAuthToKernelKeyring(registry, username, password string) error { // noli
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func genDescription(registry string) string { // nolint
|
func genDescription(registry string) string { //nolint:deadcode,unused
|
||||||
return fmt.Sprintf("%s%s", keyDescribePrefix, registry)
|
return fmt.Sprintf("%s%s", keyDescribePrefix, registry)
|
||||||
}
|
}
|
||||||
|
8
vendor/github.com/containers/image/v5/pkg/docker/config/config_unsupported.go
generated
vendored
8
vendor/github.com/containers/image/v5/pkg/docker/config/config_unsupported.go
generated
vendored
@ -3,18 +3,18 @@
|
|||||||
|
|
||||||
package config
|
package config
|
||||||
|
|
||||||
func getAuthFromKernelKeyring(registry string) (string, string, error) {
|
func getAuthFromKernelKeyring(registry string) (string, string, error) { //nolint:deadcode,unused
|
||||||
return "", "", ErrNotSupported
|
return "", "", ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteAuthFromKernelKeyring(registry string) error {
|
func deleteAuthFromKernelKeyring(registry string) error { //nolint:deadcode,unused
|
||||||
return ErrNotSupported
|
return ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func setAuthToKernelKeyring(registry, username, password string) error {
|
func setAuthToKernelKeyring(registry, username, password string) error { //nolint:deadcode,unused
|
||||||
return ErrNotSupported
|
return ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeAllAuthFromKernelKeyring() error {
|
func removeAllAuthFromKernelKeyring() error { //nolint:deadcode,unused
|
||||||
return ErrNotSupported
|
return ErrNotSupported
|
||||||
}
|
}
|
||||||
|
46
vendor/github.com/containers/image/v5/storage/storage_image.go
generated
vendored
46
vendor/github.com/containers/image/v5/storage/storage_image.go
generated
vendored
@ -449,7 +449,7 @@ func (s *storageImageDestination) PutBlobWithOptions(ctx context.Context, stream
|
|||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return info, s.queueOrCommit(ctx, info, *options.LayerIndex)
|
return info, s.queueOrCommit(ctx, info, *options.LayerIndex, options.EmptyLayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasThreadSafePutBlob indicates whether PutBlob can be executed concurrently.
|
// HasThreadSafePutBlob indicates whether PutBlob can be executed concurrently.
|
||||||
@ -542,7 +542,7 @@ func (s *storageImageDestination) TryReusingBlobWithOptions(ctx context.Context,
|
|||||||
return reused, info, err
|
return reused, info, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return reused, info, s.queueOrCommit(ctx, info, *options.LayerIndex)
|
return reused, info, s.queueOrCommit(ctx, info, *options.LayerIndex, options.EmptyLayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// tryReusingBlobWithSrcRef is a wrapper around TryReusingBlob.
|
// tryReusingBlobWithSrcRef is a wrapper around TryReusingBlob.
|
||||||
@ -731,7 +731,7 @@ func (s *storageImageDestination) getConfigBlob(info types.BlobInfo) ([]byte, er
|
|||||||
// queueOrCommit queues in the specified blob to be committed to the storage.
|
// queueOrCommit queues in the specified blob to be committed to the storage.
|
||||||
// If no other goroutine is already committing layers, the layer and all
|
// If no other goroutine is already committing layers, the layer and all
|
||||||
// subsequent layers (if already queued) will be committed to the storage.
|
// subsequent layers (if already queued) will be committed to the storage.
|
||||||
func (s *storageImageDestination) queueOrCommit(ctx context.Context, blob types.BlobInfo, index int) error {
|
func (s *storageImageDestination) queueOrCommit(ctx context.Context, blob types.BlobInfo, index int, emptyLayer bool) error {
|
||||||
// NOTE: whenever the code below is touched, make sure that all code
|
// NOTE: whenever the code below is touched, make sure that all code
|
||||||
// paths unlock the lock and to unlock it exactly once.
|
// paths unlock the lock and to unlock it exactly once.
|
||||||
//
|
//
|
||||||
@ -764,7 +764,7 @@ func (s *storageImageDestination) queueOrCommit(ctx context.Context, blob types.
|
|||||||
s.lock.Unlock()
|
s.lock.Unlock()
|
||||||
layerInfo := manifest.LayerInfo{
|
layerInfo := manifest.LayerInfo{
|
||||||
BlobInfo: *info,
|
BlobInfo: *info,
|
||||||
EmptyLayer: info.Digest == image.GzippedEmptyLayerDigest,
|
EmptyLayer: emptyLayer,
|
||||||
}
|
}
|
||||||
// Note: commitLayer locks on-demand.
|
// Note: commitLayer locks on-demand.
|
||||||
if err := s.commitLayer(ctx, layerInfo, index); err != nil {
|
if err := s.commitLayer(ctx, layerInfo, index); err != nil {
|
||||||
@ -1034,25 +1034,6 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
|
|||||||
return errors.Wrapf(err, "error saving big data %q for image %q", blob.String(), img.ID)
|
return errors.Wrapf(err, "error saving big data %q for image %q", blob.String(), img.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set the reference's name on the image. We don't need to worry about avoiding duplicate
|
|
||||||
// values because SetNames() will deduplicate the list that we pass to it.
|
|
||||||
if name := s.imageRef.DockerReference(); len(oldNames) > 0 || name != nil {
|
|
||||||
names := []string{}
|
|
||||||
if name != nil {
|
|
||||||
names = append(names, name.String())
|
|
||||||
}
|
|
||||||
if len(oldNames) > 0 {
|
|
||||||
names = append(names, oldNames...)
|
|
||||||
}
|
|
||||||
if err := s.imageRef.transport.store.SetNames(img.ID, names); err != nil {
|
|
||||||
if _, err2 := s.imageRef.transport.store.DeleteImage(img.ID, true); err2 != nil {
|
|
||||||
logrus.Debugf("error deleting incomplete image %q: %v", img.ID, err2)
|
|
||||||
}
|
|
||||||
logrus.Debugf("error setting names %v on image %q: %v", names, img.ID, err)
|
|
||||||
return errors.Wrapf(err, "error setting names %v on image %q", names, img.ID)
|
|
||||||
}
|
|
||||||
logrus.Debugf("set names of image %q to %v", img.ID, names)
|
|
||||||
}
|
|
||||||
// Save the unparsedToplevel's manifest.
|
// Save the unparsedToplevel's manifest.
|
||||||
if len(toplevelManifest) != 0 {
|
if len(toplevelManifest) != 0 {
|
||||||
manifestDigest, err := manifest.Digest(toplevelManifest)
|
manifestDigest, err := manifest.Digest(toplevelManifest)
|
||||||
@ -1130,6 +1111,25 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
|
|||||||
}
|
}
|
||||||
logrus.Debugf("saved image metadata %q", string(metadata))
|
logrus.Debugf("saved image metadata %q", string(metadata))
|
||||||
}
|
}
|
||||||
|
// Set the reference's name on the image. We don't need to worry about avoiding duplicate
|
||||||
|
// values because SetNames() will deduplicate the list that we pass to it.
|
||||||
|
if name := s.imageRef.DockerReference(); len(oldNames) > 0 || name != nil {
|
||||||
|
names := []string{}
|
||||||
|
if name != nil {
|
||||||
|
names = append(names, name.String())
|
||||||
|
}
|
||||||
|
if len(oldNames) > 0 {
|
||||||
|
names = append(names, oldNames...)
|
||||||
|
}
|
||||||
|
if err := s.imageRef.transport.store.SetNames(img.ID, names); err != nil {
|
||||||
|
if _, err2 := s.imageRef.transport.store.DeleteImage(img.ID, true); err2 != nil {
|
||||||
|
logrus.Debugf("error deleting incomplete image %q: %v", img.ID, err2)
|
||||||
|
}
|
||||||
|
logrus.Debugf("error setting names %v on image %q: %v", names, img.ID, err)
|
||||||
|
return errors.Wrapf(err, "error setting names %v on image %q", names, img.ID)
|
||||||
|
}
|
||||||
|
logrus.Debugf("set names of image %q to %v", img.ID, names)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
vendor/github.com/containers/image/v5/version/version.go
generated
vendored
4
vendor/github.com/containers/image/v5/version/version.go
generated
vendored
@ -6,9 +6,9 @@ const (
|
|||||||
// VersionMajor is for an API incompatible changes
|
// VersionMajor is for an API incompatible changes
|
||||||
VersionMajor = 5
|
VersionMajor = 5
|
||||||
// VersionMinor is for functionality in a backwards-compatible manner
|
// VersionMinor is for functionality in a backwards-compatible manner
|
||||||
VersionMinor = 12
|
VersionMinor = 13
|
||||||
// VersionPatch is for backwards-compatible bug fixes
|
// VersionPatch is for backwards-compatible bug fixes
|
||||||
VersionPatch = 0
|
VersionPatch = 1
|
||||||
|
|
||||||
// VersionDev indicates development branch. Releases will be empty string.
|
// VersionDev indicates development branch. Releases will be empty string.
|
||||||
VersionDev = ""
|
VersionDev = ""
|
||||||
|
3
vendor/github.com/docker/docker-credential-helpers/client/command.go
generated
vendored
3
vendor/github.com/docker/docker-credential-helpers/client/command.go
generated
vendored
@ -4,7 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
|
exec "golang.org/x/sys/execabs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Program is an interface to execute external programs.
|
// Program is an interface to execute external programs.
|
||||||
|
2
vendor/github.com/docker/docker-credential-helpers/credentials/version.go
generated
vendored
2
vendor/github.com/docker/docker-credential-helpers/credentials/version.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package credentials
|
package credentials
|
||||||
|
|
||||||
// Version holds a string describing the current version
|
// Version holds a string describing the current version
|
||||||
const Version = "0.6.3"
|
const Version = "0.6.4"
|
||||||
|
3
vendor/github.com/imdario/mergo/.travis.yml
generated
vendored
3
vendor/github.com/imdario/mergo/.travis.yml
generated
vendored
@ -1,4 +1,7 @@
|
|||||||
language: go
|
language: go
|
||||||
|
arch:
|
||||||
|
- amd64
|
||||||
|
- ppc64le
|
||||||
install:
|
install:
|
||||||
- go get -t
|
- go get -t
|
||||||
- go get golang.org/x/tools/cmd/cover
|
- go get golang.org/x/tools/cmd/cover
|
||||||
|
2
vendor/github.com/imdario/mergo/README.md
generated
vendored
2
vendor/github.com/imdario/mergo/README.md
generated
vendored
@ -97,7 +97,7 @@ If Mergo is useful to you, consider buying me a coffee, a beer, or making a mont
|
|||||||
- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server)
|
- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server)
|
||||||
- [jnuthong/item_search](https://github.com/jnuthong/item_search)
|
- [jnuthong/item_search](https://github.com/jnuthong/item_search)
|
||||||
- [bukalapak/snowboard](https://github.com/bukalapak/snowboard)
|
- [bukalapak/snowboard](https://github.com/bukalapak/snowboard)
|
||||||
- [janoszen/containerssh](https://github.com/janoszen/containerssh)
|
- [containerssh/containerssh](https://github.com/containerssh/containerssh)
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
9
vendor/github.com/imdario/mergo/merge.go
generated
vendored
9
vendor/github.com/imdario/mergo/merge.go
generated
vendored
@ -95,13 +95,18 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) {
|
if dst.CanSet() && (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) {
|
||||||
dst.Set(src)
|
dst.Set(src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case reflect.Map:
|
case reflect.Map:
|
||||||
if dst.IsNil() && !src.IsNil() {
|
if dst.IsNil() && !src.IsNil() {
|
||||||
dst.Set(reflect.MakeMap(dst.Type()))
|
if dst.CanSet() {
|
||||||
|
dst.Set(reflect.MakeMap(dst.Type()))
|
||||||
|
} else {
|
||||||
|
dst = src
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if src.Kind() != reflect.Map {
|
if src.Kind() != reflect.Map {
|
||||||
|
4
vendor/github.com/klauspost/compress/zstd/blockdec.go
generated
vendored
4
vendor/github.com/klauspost/compress/zstd/blockdec.go
generated
vendored
@ -168,10 +168,10 @@ func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
|
|||||||
|
|
||||||
// Read block data.
|
// Read block data.
|
||||||
if cap(b.dataStorage) < cSize {
|
if cap(b.dataStorage) < cSize {
|
||||||
if b.lowMem {
|
if b.lowMem || cSize > maxCompressedBlockSize {
|
||||||
b.dataStorage = make([]byte, 0, cSize)
|
b.dataStorage = make([]byte, 0, cSize)
|
||||||
} else {
|
} else {
|
||||||
b.dataStorage = make([]byte, 0, maxBlockSize)
|
b.dataStorage = make([]byte, 0, maxCompressedBlockSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cap(b.dst) <= maxSize {
|
if cap(b.dst) <= maxSize {
|
||||||
|
25
vendor/github.com/klauspost/compress/zstd/decoder_options.go
generated
vendored
25
vendor/github.com/klauspost/compress/zstd/decoder_options.go
generated
vendored
@ -17,14 +17,16 @@ type decoderOptions struct {
|
|||||||
lowMem bool
|
lowMem bool
|
||||||
concurrent int
|
concurrent int
|
||||||
maxDecodedSize uint64
|
maxDecodedSize uint64
|
||||||
|
maxWindowSize uint64
|
||||||
dicts []dict
|
dicts []dict
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *decoderOptions) setDefault() {
|
func (o *decoderOptions) setDefault() {
|
||||||
*o = decoderOptions{
|
*o = decoderOptions{
|
||||||
// use less ram: true for now, but may change.
|
// use less ram: true for now, but may change.
|
||||||
lowMem: true,
|
lowMem: true,
|
||||||
concurrent: runtime.GOMAXPROCS(0),
|
concurrent: runtime.GOMAXPROCS(0),
|
||||||
|
maxWindowSize: MaxWindowSize,
|
||||||
}
|
}
|
||||||
o.maxDecodedSize = 1 << 63
|
o.maxDecodedSize = 1 << 63
|
||||||
}
|
}
|
||||||
@ -52,7 +54,6 @@ func WithDecoderConcurrency(n int) DOption {
|
|||||||
// WithDecoderMaxMemory allows to set a maximum decoded size for in-memory
|
// WithDecoderMaxMemory allows to set a maximum decoded size for in-memory
|
||||||
// non-streaming operations or maximum window size for streaming operations.
|
// non-streaming operations or maximum window size for streaming operations.
|
||||||
// This can be used to control memory usage of potentially hostile content.
|
// This can be used to control memory usage of potentially hostile content.
|
||||||
// For streaming operations, the maximum window size is capped at 1<<30 bytes.
|
|
||||||
// Maximum and default is 1 << 63 bytes.
|
// Maximum and default is 1 << 63 bytes.
|
||||||
func WithDecoderMaxMemory(n uint64) DOption {
|
func WithDecoderMaxMemory(n uint64) DOption {
|
||||||
return func(o *decoderOptions) error {
|
return func(o *decoderOptions) error {
|
||||||
@ -81,3 +82,21 @@ func WithDecoderDicts(dicts ...[]byte) DOption {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithDecoderMaxWindow allows to set a maximum window size for decodes.
|
||||||
|
// This allows rejecting packets that will cause big memory usage.
|
||||||
|
// The Decoder will likely allocate more memory based on the WithDecoderLowmem setting.
|
||||||
|
// If WithDecoderMaxMemory is set to a lower value, that will be used.
|
||||||
|
// Default is 512MB, Maximum is ~3.75 TB as per zstandard spec.
|
||||||
|
func WithDecoderMaxWindow(size uint64) DOption {
|
||||||
|
return func(o *decoderOptions) error {
|
||||||
|
if size < MinWindowSize {
|
||||||
|
return errors.New("WithMaxWindowSize must be at least 1KB, 1024 bytes")
|
||||||
|
}
|
||||||
|
if size > (1<<41)+7*(1<<38) {
|
||||||
|
return errors.New("WithMaxWindowSize must be less than (1<<41) + 7*(1<<38) ~ 3.75TB")
|
||||||
|
}
|
||||||
|
o.maxWindowSize = size
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
32
vendor/github.com/klauspost/compress/zstd/framedec.go
generated
vendored
32
vendor/github.com/klauspost/compress/zstd/framedec.go
generated
vendored
@ -22,10 +22,6 @@ type frameDec struct {
|
|||||||
|
|
||||||
WindowSize uint64
|
WindowSize uint64
|
||||||
|
|
||||||
// maxWindowSize is the maximum windows size to support.
|
|
||||||
// should never be bigger than max-int.
|
|
||||||
maxWindowSize uint64
|
|
||||||
|
|
||||||
// In order queue of blocks being decoded.
|
// In order queue of blocks being decoded.
|
||||||
decoding chan *blockDec
|
decoding chan *blockDec
|
||||||
|
|
||||||
@ -50,8 +46,11 @@ type frameDec struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// The minimum Window_Size is 1 KB.
|
// MinWindowSize is the minimum Window Size, which is 1 KB.
|
||||||
MinWindowSize = 1 << 10
|
MinWindowSize = 1 << 10
|
||||||
|
|
||||||
|
// MaxWindowSize is the maximum encoder window size
|
||||||
|
// and the default decoder maximum window size.
|
||||||
MaxWindowSize = 1 << 29
|
MaxWindowSize = 1 << 29
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -61,12 +60,11 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func newFrameDec(o decoderOptions) *frameDec {
|
func newFrameDec(o decoderOptions) *frameDec {
|
||||||
d := frameDec{
|
if o.maxWindowSize > o.maxDecodedSize {
|
||||||
o: o,
|
o.maxWindowSize = o.maxDecodedSize
|
||||||
maxWindowSize: MaxWindowSize,
|
|
||||||
}
|
}
|
||||||
if d.maxWindowSize > o.maxDecodedSize {
|
d := frameDec{
|
||||||
d.maxWindowSize = o.maxDecodedSize
|
o: o,
|
||||||
}
|
}
|
||||||
return &d
|
return &d
|
||||||
}
|
}
|
||||||
@ -251,13 +249,17 @@ func (d *frameDec) reset(br byteBuffer) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.WindowSize > d.maxWindowSize {
|
if d.WindowSize > uint64(d.o.maxWindowSize) {
|
||||||
printf("window size %d > max %d\n", d.WindowSize, d.maxWindowSize)
|
if debugDecoder {
|
||||||
|
printf("window size %d > max %d\n", d.WindowSize, d.o.maxWindowSize)
|
||||||
|
}
|
||||||
return ErrWindowSizeExceeded
|
return ErrWindowSizeExceeded
|
||||||
}
|
}
|
||||||
// The minimum Window_Size is 1 KB.
|
// The minimum Window_Size is 1 KB.
|
||||||
if d.WindowSize < MinWindowSize {
|
if d.WindowSize < MinWindowSize {
|
||||||
println("got window size: ", d.WindowSize)
|
if debugDecoder {
|
||||||
|
println("got window size: ", d.WindowSize)
|
||||||
|
}
|
||||||
return ErrWindowSizeTooSmall
|
return ErrWindowSizeTooSmall
|
||||||
}
|
}
|
||||||
d.history.windowSize = int(d.WindowSize)
|
d.history.windowSize = int(d.WindowSize)
|
||||||
@ -352,8 +354,8 @@ func (d *frameDec) checkCRC() error {
|
|||||||
|
|
||||||
func (d *frameDec) initAsync() {
|
func (d *frameDec) initAsync() {
|
||||||
if !d.o.lowMem && !d.SingleSegment {
|
if !d.o.lowMem && !d.SingleSegment {
|
||||||
// set max extra size history to 10MB.
|
// set max extra size history to 2MB.
|
||||||
d.history.maxSize = d.history.windowSize + maxBlockSize*5
|
d.history.maxSize = d.history.windowSize + maxBlockSize
|
||||||
}
|
}
|
||||||
// re-alloc if more than one extra block size.
|
// re-alloc if more than one extra block size.
|
||||||
if d.o.lowMem && cap(d.history.b) > d.history.maxSize+maxBlockSize {
|
if d.o.lowMem && cap(d.history.b) > d.history.maxSize+maxBlockSize {
|
||||||
|
2
vendor/github.com/mattn/go-runewidth/go.mod
generated
vendored
2
vendor/github.com/mattn/go-runewidth/go.mod
generated
vendored
@ -2,4 +2,4 @@ module github.com/mattn/go-runewidth
|
|||||||
|
|
||||||
go 1.9
|
go 1.9
|
||||||
|
|
||||||
require github.com/rivo/uniseg v0.1.0
|
require github.com/rivo/uniseg v0.2.0
|
||||||
|
4
vendor/github.com/mattn/go-runewidth/go.sum
generated
vendored
4
vendor/github.com/mattn/go-runewidth/go.sum
generated
vendored
@ -1,2 +1,2 @@
|
|||||||
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
|
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
|
52
vendor/github.com/mattn/go-runewidth/runewidth.go
generated
vendored
52
vendor/github.com/mattn/go-runewidth/runewidth.go
generated
vendored
@ -12,8 +12,14 @@ var (
|
|||||||
// EastAsianWidth will be set true if the current locale is CJK
|
// EastAsianWidth will be set true if the current locale is CJK
|
||||||
EastAsianWidth bool
|
EastAsianWidth bool
|
||||||
|
|
||||||
|
// StrictEmojiNeutral should be set false if handle broken fonts
|
||||||
|
StrictEmojiNeutral bool = true
|
||||||
|
|
||||||
// DefaultCondition is a condition in current locale
|
// DefaultCondition is a condition in current locale
|
||||||
DefaultCondition = &Condition{}
|
DefaultCondition = &Condition{
|
||||||
|
EastAsianWidth: false,
|
||||||
|
StrictEmojiNeutral: true,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -83,26 +89,52 @@ var nonprint = table{
|
|||||||
|
|
||||||
// Condition have flag EastAsianWidth whether the current locale is CJK or not.
|
// Condition have flag EastAsianWidth whether the current locale is CJK or not.
|
||||||
type Condition struct {
|
type Condition struct {
|
||||||
EastAsianWidth bool
|
EastAsianWidth bool
|
||||||
|
StrictEmojiNeutral bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCondition return new instance of Condition which is current locale.
|
// NewCondition return new instance of Condition which is current locale.
|
||||||
func NewCondition() *Condition {
|
func NewCondition() *Condition {
|
||||||
return &Condition{
|
return &Condition{
|
||||||
EastAsianWidth: EastAsianWidth,
|
EastAsianWidth: EastAsianWidth,
|
||||||
|
StrictEmojiNeutral: StrictEmojiNeutral,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RuneWidth returns the number of cells in r.
|
// RuneWidth returns the number of cells in r.
|
||||||
// See http://www.unicode.org/reports/tr11/
|
// See http://www.unicode.org/reports/tr11/
|
||||||
func (c *Condition) RuneWidth(r rune) int {
|
func (c *Condition) RuneWidth(r rune) int {
|
||||||
switch {
|
// optimized version, verified by TestRuneWidthChecksums()
|
||||||
case r < 0 || r > 0x10FFFF || inTables(r, nonprint, combining, notassigned):
|
if !c.EastAsianWidth {
|
||||||
return 0
|
switch {
|
||||||
case (c.EastAsianWidth && IsAmbiguousWidth(r)) || inTables(r, doublewidth):
|
case r < 0x20 || r > 0x10FFFF:
|
||||||
return 2
|
return 0
|
||||||
default:
|
case (r >= 0x7F && r <= 0x9F) || r == 0xAD: // nonprint
|
||||||
return 1
|
return 0
|
||||||
|
case r < 0x300:
|
||||||
|
return 1
|
||||||
|
case inTable(r, narrow):
|
||||||
|
return 1
|
||||||
|
case inTables(r, nonprint, combining):
|
||||||
|
return 0
|
||||||
|
case inTable(r, doublewidth):
|
||||||
|
return 2
|
||||||
|
default:
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch {
|
||||||
|
case r < 0 || r > 0x10FFFF || inTables(r, nonprint, combining):
|
||||||
|
return 0
|
||||||
|
case inTable(r, narrow):
|
||||||
|
return 1
|
||||||
|
case inTables(r, ambiguous, doublewidth):
|
||||||
|
return 2
|
||||||
|
case !c.StrictEmojiNeutral && inTables(r, ambiguous, emoji, narrow):
|
||||||
|
return 2
|
||||||
|
default:
|
||||||
|
return 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
vendor/github.com/mattn/go-runewidth/runewidth_table.go
generated
vendored
6
vendor/github.com/mattn/go-runewidth/runewidth_table.go
generated
vendored
@ -124,8 +124,10 @@ var ambiguous = table{
|
|||||||
{0x1F18F, 0x1F190}, {0x1F19B, 0x1F1AC}, {0xE0100, 0xE01EF},
|
{0x1F18F, 0x1F190}, {0x1F19B, 0x1F1AC}, {0xE0100, 0xE01EF},
|
||||||
{0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD},
|
{0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD},
|
||||||
}
|
}
|
||||||
var notassigned = table{
|
var narrow = table{
|
||||||
{0x27E6, 0x27ED}, {0x2985, 0x2986},
|
{0x0020, 0x007E}, {0x00A2, 0x00A3}, {0x00A5, 0x00A6},
|
||||||
|
{0x00AC, 0x00AC}, {0x00AF, 0x00AF}, {0x27E6, 0x27ED},
|
||||||
|
{0x2985, 0x2986},
|
||||||
}
|
}
|
||||||
|
|
||||||
var neutral = table{
|
var neutral = table{
|
||||||
|
191
vendor/github.com/vbauerster/mpb/v6/bar_filler_bar.go
generated
vendored
191
vendor/github.com/vbauerster/mpb/v6/bar_filler_bar.go
generated
vendored
@ -1,191 +0,0 @@
|
|||||||
package mpb
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"io"
|
|
||||||
"unicode/utf8"
|
|
||||||
|
|
||||||
"github.com/mattn/go-runewidth"
|
|
||||||
"github.com/rivo/uniseg"
|
|
||||||
"github.com/vbauerster/mpb/v6/decor"
|
|
||||||
"github.com/vbauerster/mpb/v6/internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
rLeft = iota
|
|
||||||
rFill
|
|
||||||
rTip
|
|
||||||
rSpace
|
|
||||||
rRight
|
|
||||||
rRevTip
|
|
||||||
rRefill
|
|
||||||
)
|
|
||||||
|
|
||||||
// BarDefaultStyle is a style for rendering a progress bar.
|
|
||||||
// It consist of 7 ordered runes:
|
|
||||||
//
|
|
||||||
// '1st rune' stands for left boundary rune
|
|
||||||
//
|
|
||||||
// '2nd rune' stands for fill rune
|
|
||||||
//
|
|
||||||
// '3rd rune' stands for tip rune
|
|
||||||
//
|
|
||||||
// '4th rune' stands for space rune
|
|
||||||
//
|
|
||||||
// '5th rune' stands for right boundary rune
|
|
||||||
//
|
|
||||||
// '6th rune' stands for reverse tip rune
|
|
||||||
//
|
|
||||||
// '7th rune' stands for refill rune
|
|
||||||
//
|
|
||||||
const BarDefaultStyle string = "[=>-]<+"
|
|
||||||
|
|
||||||
type barFiller struct {
|
|
||||||
format [][]byte
|
|
||||||
rwidth []int
|
|
||||||
tip []byte
|
|
||||||
refill int64
|
|
||||||
reverse bool
|
|
||||||
flush func(io.Writer, *space, [][]byte)
|
|
||||||
}
|
|
||||||
|
|
||||||
type space struct {
|
|
||||||
space []byte
|
|
||||||
rwidth int
|
|
||||||
count int
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBarFiller returns a BarFiller implementation which renders a
|
|
||||||
// progress bar in regular direction. If style is empty string,
|
|
||||||
// BarDefaultStyle is applied. To be used with `*Progress.Add(...)
|
|
||||||
// *Bar` method.
|
|
||||||
func NewBarFiller(style string) BarFiller {
|
|
||||||
return newBarFiller(style, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBarFillerRev returns a BarFiller implementation which renders a
|
|
||||||
// progress bar in reverse direction. If style is empty string,
|
|
||||||
// BarDefaultStyle is applied. To be used with `*Progress.Add(...)
|
|
||||||
// *Bar` method.
|
|
||||||
func NewBarFillerRev(style string) BarFiller {
|
|
||||||
return newBarFiller(style, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBarFillerPick pick between regular and reverse BarFiller implementation
|
|
||||||
// based on rev param. To be used with `*Progress.Add(...) *Bar` method.
|
|
||||||
func NewBarFillerPick(style string, rev bool) BarFiller {
|
|
||||||
return newBarFiller(style, rev)
|
|
||||||
}
|
|
||||||
|
|
||||||
func newBarFiller(style string, rev bool) BarFiller {
|
|
||||||
bf := &barFiller{
|
|
||||||
format: make([][]byte, len(BarDefaultStyle)),
|
|
||||||
rwidth: make([]int, len(BarDefaultStyle)),
|
|
||||||
reverse: rev,
|
|
||||||
}
|
|
||||||
bf.parse(BarDefaultStyle)
|
|
||||||
if style != "" && style != BarDefaultStyle {
|
|
||||||
bf.parse(style)
|
|
||||||
}
|
|
||||||
return bf
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *barFiller) parse(style string) {
|
|
||||||
if !utf8.ValidString(style) {
|
|
||||||
panic("invalid bar style")
|
|
||||||
}
|
|
||||||
srcFormat := make([][]byte, len(BarDefaultStyle))
|
|
||||||
srcRwidth := make([]int, len(BarDefaultStyle))
|
|
||||||
i := 0
|
|
||||||
for gr := uniseg.NewGraphemes(style); i < len(BarDefaultStyle) && gr.Next(); i++ {
|
|
||||||
srcFormat[i] = gr.Bytes()
|
|
||||||
srcRwidth[i] = runewidth.StringWidth(gr.Str())
|
|
||||||
}
|
|
||||||
copy(s.format, srcFormat[:i])
|
|
||||||
copy(s.rwidth, srcRwidth[:i])
|
|
||||||
if s.reverse {
|
|
||||||
s.tip = s.format[rRevTip]
|
|
||||||
s.flush = reverseFlush
|
|
||||||
} else {
|
|
||||||
s.tip = s.format[rTip]
|
|
||||||
s.flush = regularFlush
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *barFiller) Fill(w io.Writer, reqWidth int, stat decor.Statistics) {
|
|
||||||
width := internal.CheckRequestedWidth(reqWidth, stat.AvailableWidth)
|
|
||||||
brackets := s.rwidth[rLeft] + s.rwidth[rRight]
|
|
||||||
if width < brackets {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// don't count brackets as progress
|
|
||||||
width -= brackets
|
|
||||||
|
|
||||||
w.Write(s.format[rLeft])
|
|
||||||
defer w.Write(s.format[rRight])
|
|
||||||
|
|
||||||
cwidth := int(internal.PercentageRound(stat.Total, stat.Current, width))
|
|
||||||
space := &space{
|
|
||||||
space: s.format[rSpace],
|
|
||||||
rwidth: s.rwidth[rSpace],
|
|
||||||
count: width - cwidth,
|
|
||||||
}
|
|
||||||
|
|
||||||
index, refill := 0, 0
|
|
||||||
bb := make([][]byte, cwidth)
|
|
||||||
|
|
||||||
if cwidth > 0 && cwidth != width {
|
|
||||||
bb[index] = s.tip
|
|
||||||
cwidth -= s.rwidth[rTip]
|
|
||||||
index++
|
|
||||||
}
|
|
||||||
|
|
||||||
if stat.Refill > 0 {
|
|
||||||
refill = int(internal.PercentageRound(stat.Total, int64(stat.Refill), width))
|
|
||||||
if refill > cwidth {
|
|
||||||
refill = cwidth
|
|
||||||
}
|
|
||||||
cwidth -= refill
|
|
||||||
}
|
|
||||||
|
|
||||||
for cwidth > 0 {
|
|
||||||
bb[index] = s.format[rFill]
|
|
||||||
cwidth -= s.rwidth[rFill]
|
|
||||||
index++
|
|
||||||
}
|
|
||||||
|
|
||||||
for refill > 0 {
|
|
||||||
bb[index] = s.format[rRefill]
|
|
||||||
refill -= s.rwidth[rRefill]
|
|
||||||
index++
|
|
||||||
}
|
|
||||||
|
|
||||||
if cwidth+refill < 0 || space.rwidth > 1 {
|
|
||||||
buf := new(bytes.Buffer)
|
|
||||||
s.flush(buf, space, bb[:index])
|
|
||||||
io.WriteString(w, runewidth.Truncate(buf.String(), width, "…"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
s.flush(w, space, bb)
|
|
||||||
}
|
|
||||||
|
|
||||||
func regularFlush(w io.Writer, space *space, bb [][]byte) {
|
|
||||||
for i := len(bb) - 1; i >= 0; i-- {
|
|
||||||
w.Write(bb[i])
|
|
||||||
}
|
|
||||||
for space.count > 0 {
|
|
||||||
w.Write(space.space)
|
|
||||||
space.count -= space.rwidth
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func reverseFlush(w io.Writer, space *space, bb [][]byte) {
|
|
||||||
for space.count > 0 {
|
|
||||||
w.Write(space.space)
|
|
||||||
space.count -= space.rwidth
|
|
||||||
}
|
|
||||||
for i := 0; i < len(bb); i++ {
|
|
||||||
w.Write(bb[i])
|
|
||||||
}
|
|
||||||
}
|
|
65
vendor/github.com/vbauerster/mpb/v6/bar_filler_spinner.go
generated
vendored
65
vendor/github.com/vbauerster/mpb/v6/bar_filler_spinner.go
generated
vendored
@ -1,65 +0,0 @@
|
|||||||
package mpb
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/mattn/go-runewidth"
|
|
||||||
"github.com/vbauerster/mpb/v6/decor"
|
|
||||||
"github.com/vbauerster/mpb/v6/internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SpinnerAlignment enum.
|
|
||||||
type SpinnerAlignment int
|
|
||||||
|
|
||||||
// SpinnerAlignment kinds.
|
|
||||||
const (
|
|
||||||
SpinnerOnLeft SpinnerAlignment = iota
|
|
||||||
SpinnerOnMiddle
|
|
||||||
SpinnerOnRight
|
|
||||||
)
|
|
||||||
|
|
||||||
// SpinnerDefaultStyle is a style for rendering a spinner.
|
|
||||||
var SpinnerDefaultStyle = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}
|
|
||||||
|
|
||||||
type spinnerFiller struct {
|
|
||||||
frames []string
|
|
||||||
count uint
|
|
||||||
alignment SpinnerAlignment
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSpinnerFiller returns a BarFiller implementation which renders
|
|
||||||
// a spinner. If style is nil or zero length, SpinnerDefaultStyle is
|
|
||||||
// applied. To be used with `*Progress.Add(...) *Bar` method.
|
|
||||||
func NewSpinnerFiller(style []string, alignment SpinnerAlignment) BarFiller {
|
|
||||||
if len(style) == 0 {
|
|
||||||
style = SpinnerDefaultStyle
|
|
||||||
}
|
|
||||||
filler := &spinnerFiller{
|
|
||||||
frames: style,
|
|
||||||
alignment: alignment,
|
|
||||||
}
|
|
||||||
return filler
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spinnerFiller) Fill(w io.Writer, reqWidth int, stat decor.Statistics) {
|
|
||||||
width := internal.CheckRequestedWidth(reqWidth, stat.AvailableWidth)
|
|
||||||
|
|
||||||
frame := s.frames[s.count%uint(len(s.frames))]
|
|
||||||
frameWidth := runewidth.StringWidth(frame)
|
|
||||||
|
|
||||||
if width < frameWidth {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
switch rest := width - frameWidth; s.alignment {
|
|
||||||
case SpinnerOnLeft:
|
|
||||||
io.WriteString(w, frame+strings.Repeat(" ", rest))
|
|
||||||
case SpinnerOnMiddle:
|
|
||||||
str := strings.Repeat(" ", rest/2) + frame + strings.Repeat(" ", rest/2+rest%2)
|
|
||||||
io.WriteString(w, str)
|
|
||||||
case SpinnerOnRight:
|
|
||||||
io.WriteString(w, strings.Repeat(" ", rest)+frame)
|
|
||||||
}
|
|
||||||
s.count++
|
|
||||||
}
|
|
20
vendor/github.com/vbauerster/mpb/v6/decor/doc.go
generated
vendored
20
vendor/github.com/vbauerster/mpb/v6/decor/doc.go
generated
vendored
@ -1,20 +0,0 @@
|
|||||||
// Package decor provides common decorators for "github.com/vbauerster/mpb/v6" module.
|
|
||||||
/*
|
|
||||||
Some decorators returned by this package might have a closure state. It is ok to use
|
|
||||||
decorators concurrently, unless you share the same decorator among multiple
|
|
||||||
*mpb.Bar instances. To avoid data races, create new decorator per *mpb.Bar instance.
|
|
||||||
|
|
||||||
Don't:
|
|
||||||
|
|
||||||
p := mpb.New()
|
|
||||||
name := decor.Name("bar")
|
|
||||||
p.AddBar(100, mpb.AppendDecorators(name))
|
|
||||||
p.AddBar(100, mpb.AppendDecorators(name))
|
|
||||||
|
|
||||||
Do:
|
|
||||||
|
|
||||||
p := mpb.New()
|
|
||||||
p.AddBar(100, mpb.AppendDecorators(decor.Name("bar1")))
|
|
||||||
p.AddBar(100, mpb.AppendDecorators(decor.Name("bar2")))
|
|
||||||
*/
|
|
||||||
package decor
|
|
11
vendor/github.com/vbauerster/mpb/v6/go.mod
generated
vendored
11
vendor/github.com/vbauerster/mpb/v6/go.mod
generated
vendored
@ -1,11 +0,0 @@
|
|||||||
module github.com/vbauerster/mpb/v6
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/VividCortex/ewma v1.1.1
|
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
|
|
||||||
github.com/mattn/go-runewidth v0.0.10
|
|
||||||
github.com/rivo/uniseg v0.2.0
|
|
||||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492
|
|
||||||
)
|
|
||||||
|
|
||||||
go 1.14
|
|
11
vendor/github.com/vbauerster/mpb/v6/go.sum
generated
vendored
11
vendor/github.com/vbauerster/mpb/v6/go.sum
generated
vendored
@ -1,11 +0,0 @@
|
|||||||
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=
|
|
||||||
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
|
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
|
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
|
|
||||||
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
|
|
||||||
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
|
||||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
|
||||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
|
||||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492 h1:Paq34FxTluEPvVyayQqMPgHm+vTOrIifmcYxFBx9TLg=
|
|
||||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
@ -1,8 +1,9 @@
|
|||||||
# Multi Progress Bar
|
# Multi Progress Bar
|
||||||
|
|
||||||
[](https://pkg.go.dev/github.com/vbauerster/mpb/v6)
|
[](https://pkg.go.dev/github.com/vbauerster/mpb/v7)
|
||||||
[](https://travis-ci.org/vbauerster/mpb)
|
[](https://travis-ci.org/vbauerster/mpb)
|
||||||
[](https://goreportcard.com/report/github.com/vbauerster/mpb)
|
[](https://goreportcard.com/report/github.com/vbauerster/mpb)
|
||||||
|
[](https://www.paypal.me/vbauerster)
|
||||||
|
|
||||||
**mpb** is a Go lib for rendering progress bars in terminal applications.
|
**mpb** is a Go lib for rendering progress bars in terminal applications.
|
||||||
|
|
||||||
@ -26,8 +27,8 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/vbauerster/mpb/v6"
|
"github.com/vbauerster/mpb/v7"
|
||||||
"github.com/vbauerster/mpb/v6/decor"
|
"github.com/vbauerster/mpb/v7/decor"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -39,7 +40,7 @@ func main() {
|
|||||||
// adding a single bar, which will inherit container's width
|
// adding a single bar, which will inherit container's width
|
||||||
bar := p.Add(int64(total),
|
bar := p.Add(int64(total),
|
||||||
// progress bar filler with customized style
|
// progress bar filler with customized style
|
||||||
mpb.NewBarFiller("╢▌▌░╟"),
|
mpb.NewBarFiller(mpb.BarStyle().Lbound("╢").Filler("▌").Tip("▌").Padding("░").Rbound("╟")),
|
||||||
mpb.PrependDecorators(
|
mpb.PrependDecorators(
|
||||||
// display our name with one space on the right
|
// display our name with one space on the right
|
||||||
decor.Name(name, decor.WC{W: len(name) + 1, C: decor.DidentRight}),
|
decor.Name(name, decor.WC{W: len(name) + 1, C: decor.DidentRight}),
|
||||||
@ -65,7 +66,7 @@ func main() {
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
// pass &wg (optional), so p will wait for it eventually
|
// passed &wg will be accounted at p.Wait() call
|
||||||
p := mpb.New(mpb.WithWaitGroup(&wg))
|
p := mpb.New(mpb.WithWaitGroup(&wg))
|
||||||
total, numBars := 100, 3
|
total, numBars := 100, 3
|
||||||
wg.Add(numBars)
|
wg.Add(numBars)
|
20
vendor/github.com/vbauerster/mpb/v6/bar.go → vendor/github.com/vbauerster/mpb/v7/bar.go
generated
vendored
20
vendor/github.com/vbauerster/mpb/v6/bar.go → vendor/github.com/vbauerster/mpb/v7/bar.go
generated
vendored
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/acarl005/stripansi"
|
"github.com/acarl005/stripansi"
|
||||||
"github.com/mattn/go-runewidth"
|
"github.com/mattn/go-runewidth"
|
||||||
"github.com/vbauerster/mpb/v6/decor"
|
"github.com/vbauerster/mpb/v7/decor"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Bar represents a progress bar.
|
// Bar represents a progress bar.
|
||||||
@ -390,12 +390,6 @@ func (b *Bar) wSyncTable() [][]chan int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *bState) draw(stat decor.Statistics) io.Reader {
|
func (s *bState) draw(stat decor.Statistics) io.Reader {
|
||||||
if !s.trimSpace {
|
|
||||||
stat.AvailableWidth -= 2
|
|
||||||
s.bufB.WriteByte(' ')
|
|
||||||
defer s.bufB.WriteByte(' ')
|
|
||||||
}
|
|
||||||
|
|
||||||
nlr := strings.NewReader("\n")
|
nlr := strings.NewReader("\n")
|
||||||
tw := stat.AvailableWidth
|
tw := stat.AvailableWidth
|
||||||
for _, d := range s.pDecorators {
|
for _, d := range s.pDecorators {
|
||||||
@ -403,10 +397,16 @@ func (s *bState) draw(stat decor.Statistics) io.Reader {
|
|||||||
stat.AvailableWidth -= runewidth.StringWidth(stripansi.Strip(str))
|
stat.AvailableWidth -= runewidth.StringWidth(stripansi.Strip(str))
|
||||||
s.bufP.WriteString(str)
|
s.bufP.WriteString(str)
|
||||||
}
|
}
|
||||||
if stat.AvailableWidth <= 0 {
|
if stat.AvailableWidth < 1 {
|
||||||
trunc := strings.NewReader(runewidth.Truncate(stripansi.Strip(s.bufP.String()), tw, "…"))
|
trunc := strings.NewReader(runewidth.Truncate(stripansi.Strip(s.bufP.String()), tw, "…"))
|
||||||
s.bufP.Reset()
|
s.bufP.Reset()
|
||||||
return io.MultiReader(trunc, s.bufB, nlr)
|
return io.MultiReader(trunc, nlr)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !s.trimSpace && stat.AvailableWidth > 1 {
|
||||||
|
stat.AvailableWidth -= 2
|
||||||
|
s.bufB.WriteByte(' ')
|
||||||
|
defer s.bufB.WriteByte(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
tw = stat.AvailableWidth
|
tw = stat.AvailableWidth
|
||||||
@ -415,7 +415,7 @@ func (s *bState) draw(stat decor.Statistics) io.Reader {
|
|||||||
stat.AvailableWidth -= runewidth.StringWidth(stripansi.Strip(str))
|
stat.AvailableWidth -= runewidth.StringWidth(stripansi.Strip(str))
|
||||||
s.bufA.WriteString(str)
|
s.bufA.WriteString(str)
|
||||||
}
|
}
|
||||||
if stat.AvailableWidth <= 0 {
|
if stat.AvailableWidth < 1 {
|
||||||
trunc := strings.NewReader(runewidth.Truncate(stripansi.Strip(s.bufA.String()), tw, "…"))
|
trunc := strings.NewReader(runewidth.Truncate(stripansi.Strip(s.bufA.String()), tw, "…"))
|
||||||
s.bufA.Reset()
|
s.bufA.Reset()
|
||||||
return io.MultiReader(s.bufP, s.bufB, trunc, nlr)
|
return io.MultiReader(s.bufP, s.bufB, trunc, nlr)
|
@ -3,7 +3,7 @@ package mpb
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/vbauerster/mpb/v6/decor"
|
"github.com/vbauerster/mpb/v7/decor"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BarFiller interface.
|
// BarFiller interface.
|
||||||
@ -14,18 +14,26 @@ import (
|
|||||||
//
|
//
|
||||||
// Default implementations can be obtained via:
|
// Default implementations can be obtained via:
|
||||||
//
|
//
|
||||||
// func NewBarFiller(style string) BarFiller
|
// func NewBarFiller(BarStyle()) BarFiller
|
||||||
// func NewBarFillerRev(style string) BarFiller
|
// func NewBarFiller(SpinnerStyle()) BarFiller
|
||||||
// func NewBarFillerPick(style string, rev bool) BarFiller
|
|
||||||
// func NewSpinnerFiller(style []string, alignment SpinnerAlignment) BarFiller
|
|
||||||
//
|
//
|
||||||
type BarFiller interface {
|
type BarFiller interface {
|
||||||
Fill(w io.Writer, reqWidth int, stat decor.Statistics)
|
Fill(w io.Writer, reqWidth int, stat decor.Statistics)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BarFillerBuilder interface.
|
||||||
|
type BarFillerBuilder interface {
|
||||||
|
Build() BarFiller
|
||||||
|
}
|
||||||
|
|
||||||
// BarFillerFunc is function type adapter to convert function into BarFiller.
|
// BarFillerFunc is function type adapter to convert function into BarFiller.
|
||||||
type BarFillerFunc func(w io.Writer, reqWidth int, stat decor.Statistics)
|
type BarFillerFunc func(w io.Writer, reqWidth int, stat decor.Statistics)
|
||||||
|
|
||||||
func (f BarFillerFunc) Fill(w io.Writer, reqWidth int, stat decor.Statistics) {
|
func (f BarFillerFunc) Fill(w io.Writer, reqWidth int, stat decor.Statistics) {
|
||||||
f(w, reqWidth, stat)
|
f(w, reqWidth, stat)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewBarFiller constructs a BarFiller from provided BarFillerBuilder.
|
||||||
|
func NewBarFiller(b BarFillerBuilder) BarFiller {
|
||||||
|
return b.Build()
|
||||||
|
}
|
219
vendor/github.com/vbauerster/mpb/v7/bar_filler_bar.go
generated
vendored
Normal file
219
vendor/github.com/vbauerster/mpb/v7/bar_filler_bar.go
generated
vendored
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
package mpb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/acarl005/stripansi"
|
||||||
|
"github.com/mattn/go-runewidth"
|
||||||
|
"github.com/vbauerster/mpb/v7/decor"
|
||||||
|
"github.com/vbauerster/mpb/v7/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
iLbound = iota
|
||||||
|
iRbound
|
||||||
|
iFiller
|
||||||
|
iRefiller
|
||||||
|
iPadding
|
||||||
|
components
|
||||||
|
)
|
||||||
|
|
||||||
|
// BarStyleComposer interface.
|
||||||
|
type BarStyleComposer interface {
|
||||||
|
BarFillerBuilder
|
||||||
|
Lbound(string) BarStyleComposer
|
||||||
|
Rbound(string) BarStyleComposer
|
||||||
|
Filler(string) BarStyleComposer
|
||||||
|
Refiller(string) BarStyleComposer
|
||||||
|
Padding(string) BarStyleComposer
|
||||||
|
Tip(...string) BarStyleComposer
|
||||||
|
Reverse() BarStyleComposer
|
||||||
|
}
|
||||||
|
|
||||||
|
type bFiller struct {
|
||||||
|
components [components]*component
|
||||||
|
tip struct {
|
||||||
|
count uint
|
||||||
|
frames []*component
|
||||||
|
}
|
||||||
|
flush func(dst io.Writer, filling, padding [][]byte)
|
||||||
|
}
|
||||||
|
|
||||||
|
type component struct {
|
||||||
|
width int
|
||||||
|
bytes []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type barStyle struct {
|
||||||
|
lbound string
|
||||||
|
rbound string
|
||||||
|
filler string
|
||||||
|
refiller string
|
||||||
|
padding string
|
||||||
|
tip []string
|
||||||
|
rev bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// BarStyle constructs default bar style which can be altered via
|
||||||
|
// BarStyleComposer interface.
|
||||||
|
func BarStyle() BarStyleComposer {
|
||||||
|
return &barStyle{
|
||||||
|
lbound: "[",
|
||||||
|
rbound: "]",
|
||||||
|
filler: "=",
|
||||||
|
refiller: "+",
|
||||||
|
padding: "-",
|
||||||
|
tip: []string{">"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *barStyle) Lbound(bound string) BarStyleComposer {
|
||||||
|
s.lbound = bound
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *barStyle) Rbound(bound string) BarStyleComposer {
|
||||||
|
s.rbound = bound
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *barStyle) Filler(filler string) BarStyleComposer {
|
||||||
|
s.filler = filler
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *barStyle) Refiller(refiller string) BarStyleComposer {
|
||||||
|
s.refiller = refiller
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *barStyle) Padding(padding string) BarStyleComposer {
|
||||||
|
s.padding = padding
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *barStyle) Tip(tip ...string) BarStyleComposer {
|
||||||
|
if len(tip) != 0 {
|
||||||
|
s.tip = append(s.tip[:0], tip...)
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *barStyle) Reverse() BarStyleComposer {
|
||||||
|
s.rev = true
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *barStyle) Build() BarFiller {
|
||||||
|
bf := new(bFiller)
|
||||||
|
if s.rev {
|
||||||
|
bf.flush = func(dst io.Writer, filling, padding [][]byte) {
|
||||||
|
flush(dst, padding, filling)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bf.flush = flush
|
||||||
|
}
|
||||||
|
bf.components[iLbound] = &component{
|
||||||
|
width: runewidth.StringWidth(stripansi.Strip(s.lbound)),
|
||||||
|
bytes: []byte(s.lbound),
|
||||||
|
}
|
||||||
|
bf.components[iRbound] = &component{
|
||||||
|
width: runewidth.StringWidth(stripansi.Strip(s.rbound)),
|
||||||
|
bytes: []byte(s.rbound),
|
||||||
|
}
|
||||||
|
bf.components[iFiller] = &component{
|
||||||
|
width: runewidth.StringWidth(stripansi.Strip(s.filler)),
|
||||||
|
bytes: []byte(s.filler),
|
||||||
|
}
|
||||||
|
bf.components[iRefiller] = &component{
|
||||||
|
width: runewidth.StringWidth(stripansi.Strip(s.refiller)),
|
||||||
|
bytes: []byte(s.refiller),
|
||||||
|
}
|
||||||
|
bf.components[iPadding] = &component{
|
||||||
|
width: runewidth.StringWidth(stripansi.Strip(s.padding)),
|
||||||
|
bytes: []byte(s.padding),
|
||||||
|
}
|
||||||
|
bf.tip.frames = make([]*component, len(s.tip))
|
||||||
|
for i, t := range s.tip {
|
||||||
|
bf.tip.frames[i] = &component{
|
||||||
|
width: runewidth.StringWidth(stripansi.Strip(t)),
|
||||||
|
bytes: []byte(t),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bf
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *bFiller) Fill(w io.Writer, width int, stat decor.Statistics) {
|
||||||
|
width = internal.CheckRequestedWidth(width, stat.AvailableWidth)
|
||||||
|
brackets := s.components[iLbound].width + s.components[iRbound].width
|
||||||
|
if width < brackets {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// don't count brackets as progress
|
||||||
|
width -= brackets
|
||||||
|
|
||||||
|
w.Write(s.components[iLbound].bytes)
|
||||||
|
defer w.Write(s.components[iRbound].bytes)
|
||||||
|
|
||||||
|
curWidth := int(internal.PercentageRound(stat.Total, stat.Current, width))
|
||||||
|
refWidth, filled := 0, curWidth
|
||||||
|
filling := make([][]byte, 0, curWidth)
|
||||||
|
|
||||||
|
if curWidth > 0 && curWidth != width {
|
||||||
|
tipFrame := s.tip.frames[s.tip.count%uint(len(s.tip.frames))]
|
||||||
|
filling = append(filling, tipFrame.bytes)
|
||||||
|
curWidth -= tipFrame.width
|
||||||
|
s.tip.count++
|
||||||
|
}
|
||||||
|
|
||||||
|
if stat.Refill > 0 && curWidth > 0 {
|
||||||
|
refWidth = int(internal.PercentageRound(stat.Total, int64(stat.Refill), width))
|
||||||
|
if refWidth > curWidth {
|
||||||
|
refWidth = curWidth
|
||||||
|
}
|
||||||
|
curWidth -= refWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
for curWidth > 0 && curWidth >= s.components[iFiller].width {
|
||||||
|
filling = append(filling, s.components[iFiller].bytes)
|
||||||
|
curWidth -= s.components[iFiller].width
|
||||||
|
if s.components[iFiller].width == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for refWidth > 0 && refWidth >= s.components[iRefiller].width {
|
||||||
|
filling = append(filling, s.components[iRefiller].bytes)
|
||||||
|
refWidth -= s.components[iRefiller].width
|
||||||
|
if s.components[iRefiller].width == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filled -= curWidth + refWidth
|
||||||
|
padWidth := width - filled
|
||||||
|
padding := make([][]byte, 0, padWidth)
|
||||||
|
for padWidth > 0 && padWidth >= s.components[iPadding].width {
|
||||||
|
padding = append(padding, s.components[iPadding].bytes)
|
||||||
|
padWidth -= s.components[iPadding].width
|
||||||
|
if s.components[iPadding].width == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for padWidth > 0 {
|
||||||
|
padding = append(padding, []byte("…"))
|
||||||
|
padWidth--
|
||||||
|
}
|
||||||
|
|
||||||
|
s.flush(w, filling, padding)
|
||||||
|
}
|
||||||
|
|
||||||
|
func flush(dst io.Writer, filling, padding [][]byte) {
|
||||||
|
for i := len(filling) - 1; i >= 0; i-- {
|
||||||
|
dst.Write(filling[i])
|
||||||
|
}
|
||||||
|
for i := 0; i < len(padding); i++ {
|
||||||
|
dst.Write(padding[i])
|
||||||
|
}
|
||||||
|
}
|
87
vendor/github.com/vbauerster/mpb/v7/bar_filler_spinner.go
generated
vendored
Normal file
87
vendor/github.com/vbauerster/mpb/v7/bar_filler_spinner.go
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
package mpb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/acarl005/stripansi"
|
||||||
|
"github.com/mattn/go-runewidth"
|
||||||
|
"github.com/vbauerster/mpb/v7/decor"
|
||||||
|
"github.com/vbauerster/mpb/v7/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
positionLeft = 1 + iota
|
||||||
|
positionRight
|
||||||
|
)
|
||||||
|
|
||||||
|
// SpinnerStyleComposer interface.
|
||||||
|
type SpinnerStyleComposer interface {
|
||||||
|
BarFillerBuilder
|
||||||
|
PositionLeft() SpinnerStyleComposer
|
||||||
|
PositionRight() SpinnerStyleComposer
|
||||||
|
}
|
||||||
|
|
||||||
|
type sFiller struct {
|
||||||
|
count uint
|
||||||
|
position uint
|
||||||
|
frames []string
|
||||||
|
}
|
||||||
|
|
||||||
|
type spinnerStyle struct {
|
||||||
|
position uint
|
||||||
|
frames []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpinnerStyle constructs default spinner style which can be altered via
|
||||||
|
// SpinnerStyleComposer interface.
|
||||||
|
func SpinnerStyle(frames ...string) SpinnerStyleComposer {
|
||||||
|
ss := new(spinnerStyle)
|
||||||
|
if len(frames) != 0 {
|
||||||
|
ss.frames = append(ss.frames, frames...)
|
||||||
|
} else {
|
||||||
|
ss.frames = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}
|
||||||
|
}
|
||||||
|
return ss
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *spinnerStyle) PositionLeft() SpinnerStyleComposer {
|
||||||
|
s.position = positionLeft
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *spinnerStyle) PositionRight() SpinnerStyleComposer {
|
||||||
|
s.position = positionRight
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *spinnerStyle) Build() BarFiller {
|
||||||
|
sf := &sFiller{
|
||||||
|
position: s.position,
|
||||||
|
frames: s.frames,
|
||||||
|
}
|
||||||
|
return sf
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *sFiller) Fill(w io.Writer, width int, stat decor.Statistics) {
|
||||||
|
width = internal.CheckRequestedWidth(width, stat.AvailableWidth)
|
||||||
|
|
||||||
|
frame := s.frames[s.count%uint(len(s.frames))]
|
||||||
|
frameWidth := runewidth.StringWidth(stripansi.Strip(frame))
|
||||||
|
|
||||||
|
if width < frameWidth {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rest := width - frameWidth
|
||||||
|
switch s.position {
|
||||||
|
case positionLeft:
|
||||||
|
io.WriteString(w, frame+strings.Repeat(" ", rest))
|
||||||
|
case positionRight:
|
||||||
|
io.WriteString(w, strings.Repeat(" ", rest)+frame)
|
||||||
|
default:
|
||||||
|
str := strings.Repeat(" ", rest/2) + frame + strings.Repeat(" ", rest/2+rest%2)
|
||||||
|
io.WriteString(w, str)
|
||||||
|
}
|
||||||
|
s.count++
|
||||||
|
}
|
@ -4,8 +4,8 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/vbauerster/mpb/v6/decor"
|
"github.com/vbauerster/mpb/v7/decor"
|
||||||
"github.com/vbauerster/mpb/v6/internal"
|
"github.com/vbauerster/mpb/v7/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BarOption is a func option to alter default behavior of a bar.
|
// BarOption is a func option to alter default behavior of a bar.
|
@ -6,7 +6,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/vbauerster/mpb/v6/internal"
|
"github.com/vbauerster/mpb/v7/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerOption is a func option to alter default behavior of a bar
|
// ContainerOption is a func option to alter default behavior of a bar
|
19
vendor/github.com/vbauerster/mpb/v7/decor/doc.go
generated
vendored
Normal file
19
vendor/github.com/vbauerster/mpb/v7/decor/doc.go
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Package decor provides common decorators for "github.com/vbauerster/mpb/v7" module.
|
||||||
|
//
|
||||||
|
// Some decorators returned by this package might have a closure state. It is ok to use
|
||||||
|
// decorators concurrently, unless you share the same decorator among multiple
|
||||||
|
// *mpb.Bar instances. To avoid data races, create new decorator per *mpb.Bar instance.
|
||||||
|
//
|
||||||
|
// Don't:
|
||||||
|
//
|
||||||
|
// p := mpb.New()
|
||||||
|
// name := decor.Name("bar")
|
||||||
|
// p.AddBar(100, mpb.AppendDecorators(name))
|
||||||
|
// p.AddBar(100, mpb.AppendDecorators(name))
|
||||||
|
//
|
||||||
|
// Do:
|
||||||
|
//
|
||||||
|
// p := mpb.New()
|
||||||
|
// p.AddBar(100, mpb.AppendDecorators(decor.Name("bar1")))
|
||||||
|
// p.AddBar(100, mpb.AppendDecorators(decor.Name("bar2")))
|
||||||
|
package decor
|
@ -5,7 +5,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/vbauerster/mpb/v6/internal"
|
"github.com/vbauerster/mpb/v7/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type percentageType float64
|
type percentageType float64
|
10
vendor/github.com/vbauerster/mpb/v7/go.mod
generated
vendored
Normal file
10
vendor/github.com/vbauerster/mpb/v7/go.mod
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module github.com/vbauerster/mpb/v7
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/VividCortex/ewma v1.2.0
|
||||||
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
|
||||||
|
github.com/mattn/go-runewidth v0.0.13
|
||||||
|
golang.org/x/sys v0.0.0-20210603125802-9665404d3644
|
||||||
|
)
|
||||||
|
|
||||||
|
go 1.14
|
10
vendor/github.com/vbauerster/mpb/v7/go.sum
generated
vendored
Normal file
10
vendor/github.com/vbauerster/mpb/v7/go.sum
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
||||||
|
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
||||||
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
|
||||||
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
|
||||||
|
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||||
|
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
|
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||||
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
|
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I=
|
||||||
|
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
@ -3,7 +3,7 @@ package internal
|
|||||||
// CheckRequestedWidth checks that requested width doesn't overflow
|
// CheckRequestedWidth checks that requested width doesn't overflow
|
||||||
// available width
|
// available width
|
||||||
func CheckRequestedWidth(requested, available int) int {
|
func CheckRequestedWidth(requested, available int) int {
|
||||||
if requested <= 0 || requested >= available {
|
if requested < 1 || requested >= available {
|
||||||
return available
|
return available
|
||||||
}
|
}
|
||||||
return requested
|
return requested
|
@ -13,8 +13,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/vbauerster/mpb/v6/cwriter"
|
"github.com/vbauerster/mpb/v7/cwriter"
|
||||||
"github.com/vbauerster/mpb/v6/decor"
|
"github.com/vbauerster/mpb/v7/decor"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -100,16 +100,16 @@ func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddBar creates a bar with default bar filler. Different filler can
|
// AddBar creates a bar with default bar filler. Different filler can
|
||||||
// be choosen and applied via `*Progress.Add(...) *Bar` method.
|
// be chosen and applied via `*Progress.Add(...) *Bar` method.
|
||||||
func (p *Progress) AddBar(total int64, options ...BarOption) *Bar {
|
func (p *Progress) AddBar(total int64, options ...BarOption) *Bar {
|
||||||
return p.Add(total, NewBarFiller(BarDefaultStyle), options...)
|
return p.Add(total, NewBarFiller(BarStyle()), options...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddSpinner creates a bar with default spinner filler. Different
|
// AddSpinner creates a bar with default spinner filler. Different
|
||||||
// filler can be choosen and applied via `*Progress.Add(...) *Bar`
|
// filler can be chosen and applied via `*Progress.Add(...) *Bar`
|
||||||
// method.
|
// method.
|
||||||
func (p *Progress) AddSpinner(total int64, alignment SpinnerAlignment, options ...BarOption) *Bar {
|
func (p *Progress) AddSpinner(total int64, options ...BarOption) *Bar {
|
||||||
return p.Add(total, NewSpinnerFiller(SpinnerDefaultStyle, alignment), options...)
|
return p.Add(total, NewBarFiller(SpinnerStyle()), options...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add creates a bar which renders itself by provided filler.
|
// Add creates a bar which renders itself by provided filler.
|
2
vendor/go.etcd.io/bbolt/.gitignore
generated
vendored
2
vendor/go.etcd.io/bbolt/.gitignore
generated
vendored
@ -3,3 +3,5 @@
|
|||||||
*.swp
|
*.swp
|
||||||
/bin/
|
/bin/
|
||||||
cover.out
|
cover.out
|
||||||
|
/.idea
|
||||||
|
*.iml
|
||||||
|
3
vendor/go.etcd.io/bbolt/.travis.yml
generated
vendored
3
vendor/go.etcd.io/bbolt/.travis.yml
generated
vendored
@ -4,9 +4,10 @@ go_import_path: go.etcd.io/bbolt
|
|||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.12
|
- 1.15
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
|
- go get -v golang.org/x/sys/unix
|
||||||
- go get -v honnef.co/go/tools/...
|
- go get -v honnef.co/go/tools/...
|
||||||
- go get -v github.com/kisielk/errcheck
|
- go get -v github.com/kisielk/errcheck
|
||||||
|
|
||||||
|
2
vendor/go.etcd.io/bbolt/Makefile
generated
vendored
2
vendor/go.etcd.io/bbolt/Makefile
generated
vendored
@ -2,8 +2,6 @@ BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|||||||
COMMIT=`git rev-parse --short HEAD`
|
COMMIT=`git rev-parse --short HEAD`
|
||||||
GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)"
|
GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)"
|
||||||
|
|
||||||
default: build
|
|
||||||
|
|
||||||
race:
|
race:
|
||||||
@TEST_FREELIST_TYPE=hashmap go test -v -race -test.run="TestSimulate_(100op|1000op)"
|
@TEST_FREELIST_TYPE=hashmap go test -v -race -test.run="TestSimulate_(100op|1000op)"
|
||||||
@echo "array freelist test"
|
@echo "array freelist test"
|
||||||
|
5
vendor/go.etcd.io/bbolt/README.md
generated
vendored
5
vendor/go.etcd.io/bbolt/README.md
generated
vendored
@ -908,12 +908,14 @@ Below is a list of public, open source projects that use Bolt:
|
|||||||
* [BoltStore](https://github.com/yosssi/boltstore) - Session store using Bolt.
|
* [BoltStore](https://github.com/yosssi/boltstore) - Session store using Bolt.
|
||||||
* [Boltdb Boilerplate](https://github.com/bobintornado/boltdb-boilerplate) - Boilerplate wrapper around bolt aiming to make simple calls one-liners.
|
* [Boltdb Boilerplate](https://github.com/bobintornado/boltdb-boilerplate) - Boilerplate wrapper around bolt aiming to make simple calls one-liners.
|
||||||
* [BoltDbWeb](https://github.com/evnix/boltdbweb) - A web based GUI for BoltDB files.
|
* [BoltDbWeb](https://github.com/evnix/boltdbweb) - A web based GUI for BoltDB files.
|
||||||
|
* [BoltDB Viewer](https://github.com/zc310/rich_boltdb) - A BoltDB Viewer Can run on Windows、Linux、Android system.
|
||||||
* [bleve](http://www.blevesearch.com/) - A pure Go search engine similar to ElasticSearch that uses Bolt as the default storage backend.
|
* [bleve](http://www.blevesearch.com/) - A pure Go search engine similar to ElasticSearch that uses Bolt as the default storage backend.
|
||||||
* [btcwallet](https://github.com/btcsuite/btcwallet) - A bitcoin wallet.
|
* [btcwallet](https://github.com/btcsuite/btcwallet) - A bitcoin wallet.
|
||||||
* [buckets](https://github.com/joyrexus/buckets) - a bolt wrapper streamlining
|
* [buckets](https://github.com/joyrexus/buckets) - a bolt wrapper streamlining
|
||||||
simple tx and key scans.
|
simple tx and key scans.
|
||||||
* [cayley](https://github.com/google/cayley) - Cayley is an open-source graph database using Bolt as optional backend.
|
* [cayley](https://github.com/google/cayley) - Cayley is an open-source graph database using Bolt as optional backend.
|
||||||
* [ChainStore](https://github.com/pressly/chainstore) - Simple key-value interface to a variety of storage engines organized as a chain of operations.
|
* [ChainStore](https://github.com/pressly/chainstore) - Simple key-value interface to a variety of storage engines organized as a chain of operations.
|
||||||
|
* [🌰 Chestnut](https://github.com/jrapoport/chestnut) - Chestnut is encrypted storage for Go.
|
||||||
* [Consul](https://github.com/hashicorp/consul) - Consul is service discovery and configuration made easy. Distributed, highly available, and datacenter-aware.
|
* [Consul](https://github.com/hashicorp/consul) - Consul is service discovery and configuration made easy. Distributed, highly available, and datacenter-aware.
|
||||||
* [DVID](https://github.com/janelia-flyem/dvid) - Added Bolt as optional storage engine and testing it against Basho-tuned leveldb.
|
* [DVID](https://github.com/janelia-flyem/dvid) - Added Bolt as optional storage engine and testing it against Basho-tuned leveldb.
|
||||||
* [dcrwallet](https://github.com/decred/dcrwallet) - A wallet for the Decred cryptocurrency.
|
* [dcrwallet](https://github.com/decred/dcrwallet) - A wallet for the Decred cryptocurrency.
|
||||||
@ -938,9 +940,8 @@ Below is a list of public, open source projects that use Bolt:
|
|||||||
* [MetricBase](https://github.com/msiebuhr/MetricBase) - Single-binary version of Graphite.
|
* [MetricBase](https://github.com/msiebuhr/MetricBase) - Single-binary version of Graphite.
|
||||||
* [MuLiFS](https://github.com/dankomiocevic/mulifs) - Music Library Filesystem creates a filesystem to organise your music files.
|
* [MuLiFS](https://github.com/dankomiocevic/mulifs) - Music Library Filesystem creates a filesystem to organise your music files.
|
||||||
* [NATS](https://github.com/nats-io/nats-streaming-server) - NATS Streaming uses bbolt for message and metadata storage.
|
* [NATS](https://github.com/nats-io/nats-streaming-server) - NATS Streaming uses bbolt for message and metadata storage.
|
||||||
* [Operation Go: A Routine Mission](http://gocode.io) - An online programming game for Golang using Bolt for user accounts and a leaderboard.
|
|
||||||
* [photosite/session](https://godoc.org/bitbucket.org/kardianos/photosite/session) - Sessions for a photo viewing site.
|
|
||||||
* [Prometheus Annotation Server](https://github.com/oliver006/prom_annotation_server) - Annotation server for PromDash & Prometheus service monitoring system.
|
* [Prometheus Annotation Server](https://github.com/oliver006/prom_annotation_server) - Annotation server for PromDash & Prometheus service monitoring system.
|
||||||
|
* [Rain](https://github.com/cenkalti/rain) - BitTorrent client and library.
|
||||||
* [reef-pi](https://github.com/reef-pi/reef-pi) - reef-pi is an award winning, modular, DIY reef tank controller using easy to learn electronics based on a Raspberry Pi.
|
* [reef-pi](https://github.com/reef-pi/reef-pi) - reef-pi is an award winning, modular, DIY reef tank controller using easy to learn electronics based on a Raspberry Pi.
|
||||||
* [Request Baskets](https://github.com/darklynx/request-baskets) - A web service to collect arbitrary HTTP requests and inspect them via REST API or simple web UI, similar to [RequestBin](http://requestb.in/) service
|
* [Request Baskets](https://github.com/darklynx/request-baskets) - A web service to collect arbitrary HTTP requests and inspect them via REST API or simple web UI, similar to [RequestBin](http://requestb.in/) service
|
||||||
* [Seaweed File System](https://github.com/chrislusf/seaweedfs) - Highly scalable distributed key~file system with O(1) disk read.
|
* [Seaweed File System](https://github.com/chrislusf/seaweedfs) - Highly scalable distributed key~file system with O(1) disk read.
|
||||||
|
17
vendor/go.etcd.io/bbolt/bolt_unix.go
generated
vendored
17
vendor/go.etcd.io/bbolt/bolt_unix.go
generated
vendored
@ -7,6 +7,8 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
// flock acquires an advisory lock on a file descriptor.
|
// flock acquires an advisory lock on a file descriptor.
|
||||||
@ -49,13 +51,13 @@ func funlock(db *DB) error {
|
|||||||
// mmap memory maps a DB's data file.
|
// mmap memory maps a DB's data file.
|
||||||
func mmap(db *DB, sz int) error {
|
func mmap(db *DB, sz int) error {
|
||||||
// Map the data file to memory.
|
// Map the data file to memory.
|
||||||
b, err := syscall.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags)
|
b, err := unix.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Advise the kernel that the mmap is accessed randomly.
|
// Advise the kernel that the mmap is accessed randomly.
|
||||||
err = madvise(b, syscall.MADV_RANDOM)
|
err = unix.Madvise(b, syscall.MADV_RANDOM)
|
||||||
if err != nil && err != syscall.ENOSYS {
|
if err != nil && err != syscall.ENOSYS {
|
||||||
// Ignore not implemented error in kernel because it still works.
|
// Ignore not implemented error in kernel because it still works.
|
||||||
return fmt.Errorf("madvise: %s", err)
|
return fmt.Errorf("madvise: %s", err)
|
||||||
@ -76,18 +78,9 @@ func munmap(db *DB) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unmap using the original byte slice.
|
// Unmap using the original byte slice.
|
||||||
err := syscall.Munmap(db.dataref)
|
err := unix.Munmap(db.dataref)
|
||||||
db.dataref = nil
|
db.dataref = nil
|
||||||
db.data = nil
|
db.data = nil
|
||||||
db.datasz = 0
|
db.datasz = 0
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This function is copied from stdlib because it is not available on darwin.
|
|
||||||
func madvise(b []byte, advice int) (err error) {
|
|
||||||
_, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(advice))
|
|
||||||
if e1 != 0 {
|
|
||||||
err = e1
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
114
vendor/go.etcd.io/bbolt/compact.go
generated
vendored
Normal file
114
vendor/go.etcd.io/bbolt/compact.go
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
package bbolt
|
||||||
|
|
||||||
|
// Compact will create a copy of the source DB and in the destination DB. This may
|
||||||
|
// reclaim space that the source database no longer has use for. txMaxSize can be
|
||||||
|
// used to limit the transactions size of this process and may trigger intermittent
|
||||||
|
// commits. A value of zero will ignore transaction sizes.
|
||||||
|
// TODO: merge with: https://github.com/etcd-io/etcd/blob/b7f0f52a16dbf83f18ca1d803f7892d750366a94/mvcc/backend/backend.go#L349
|
||||||
|
func Compact(dst, src *DB, txMaxSize int64) error {
|
||||||
|
// commit regularly, or we'll run out of memory for large datasets if using one transaction.
|
||||||
|
var size int64
|
||||||
|
tx, err := dst.Begin(true)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer tx.Rollback()
|
||||||
|
|
||||||
|
if err := walk(src, func(keys [][]byte, k, v []byte, seq uint64) error {
|
||||||
|
// On each key/value, check if we have exceeded tx size.
|
||||||
|
sz := int64(len(k) + len(v))
|
||||||
|
if size+sz > txMaxSize && txMaxSize != 0 {
|
||||||
|
// Commit previous transaction.
|
||||||
|
if err := tx.Commit(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start new transaction.
|
||||||
|
tx, err = dst.Begin(true)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
size = 0
|
||||||
|
}
|
||||||
|
size += sz
|
||||||
|
|
||||||
|
// Create bucket on the root transaction if this is the first level.
|
||||||
|
nk := len(keys)
|
||||||
|
if nk == 0 {
|
||||||
|
bkt, err := tx.CreateBucket(k)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := bkt.SetSequence(seq); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create buckets on subsequent levels, if necessary.
|
||||||
|
b := tx.Bucket(keys[0])
|
||||||
|
if nk > 1 {
|
||||||
|
for _, k := range keys[1:] {
|
||||||
|
b = b.Bucket(k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill the entire page for best compaction.
|
||||||
|
b.FillPercent = 1.0
|
||||||
|
|
||||||
|
// If there is no value then this is a bucket call.
|
||||||
|
if v == nil {
|
||||||
|
bkt, err := b.CreateBucket(k)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := bkt.SetSequence(seq); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise treat it as a key/value pair.
|
||||||
|
return b.Put(k, v)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return tx.Commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
// walkFunc is the type of the function called for keys (buckets and "normal"
|
||||||
|
// values) discovered by Walk. keys is the list of keys to descend to the bucket
|
||||||
|
// owning the discovered key/value pair k/v.
|
||||||
|
type walkFunc func(keys [][]byte, k, v []byte, seq uint64) error
|
||||||
|
|
||||||
|
// walk walks recursively the bolt database db, calling walkFn for each key it finds.
|
||||||
|
func walk(db *DB, walkFn walkFunc) error {
|
||||||
|
return db.View(func(tx *Tx) error {
|
||||||
|
return tx.ForEach(func(name []byte, b *Bucket) error {
|
||||||
|
return walkBucket(b, nil, name, nil, b.Sequence(), walkFn)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func walkBucket(b *Bucket, keypath [][]byte, k, v []byte, seq uint64, fn walkFunc) error {
|
||||||
|
// Execute callback.
|
||||||
|
if err := fn(keypath, k, v, seq); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this is not a bucket then stop.
|
||||||
|
if v != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate over each child key/value.
|
||||||
|
keypath = append(keypath, k)
|
||||||
|
return b.ForEach(func(k, v []byte) error {
|
||||||
|
if v == nil {
|
||||||
|
bkt := b.Bucket(k)
|
||||||
|
return walkBucket(bkt, keypath, k, nil, bkt.Sequence(), fn)
|
||||||
|
}
|
||||||
|
return walkBucket(b, keypath, k, v, b.Sequence(), fn)
|
||||||
|
})
|
||||||
|
}
|
66
vendor/go.etcd.io/bbolt/db.go
generated
vendored
66
vendor/go.etcd.io/bbolt/db.go
generated
vendored
@ -120,6 +120,12 @@ type DB struct {
|
|||||||
// of truncate() and fsync() when growing the data file.
|
// of truncate() and fsync() when growing the data file.
|
||||||
AllocSize int
|
AllocSize int
|
||||||
|
|
||||||
|
// Mlock locks database file in memory when set to true.
|
||||||
|
// It prevents major page faults, however used memory can't be reclaimed.
|
||||||
|
//
|
||||||
|
// Supported only on Unix via mlock/munlock syscalls.
|
||||||
|
Mlock bool
|
||||||
|
|
||||||
path string
|
path string
|
||||||
openFile func(string, int, os.FileMode) (*os.File, error)
|
openFile func(string, int, os.FileMode) (*os.File, error)
|
||||||
file *os.File
|
file *os.File
|
||||||
@ -188,6 +194,7 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) {
|
|||||||
db.MmapFlags = options.MmapFlags
|
db.MmapFlags = options.MmapFlags
|
||||||
db.NoFreelistSync = options.NoFreelistSync
|
db.NoFreelistSync = options.NoFreelistSync
|
||||||
db.FreelistType = options.FreelistType
|
db.FreelistType = options.FreelistType
|
||||||
|
db.Mlock = options.Mlock
|
||||||
|
|
||||||
// Set default values for later DB operations.
|
// Set default values for later DB operations.
|
||||||
db.MaxBatchSize = DefaultMaxBatchSize
|
db.MaxBatchSize = DefaultMaxBatchSize
|
||||||
@ -337,7 +344,8 @@ func (db *DB) mmap(minsz int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the size is at least the minimum size.
|
// Ensure the size is at least the minimum size.
|
||||||
var size = int(info.Size())
|
fileSize := int(info.Size())
|
||||||
|
var size = fileSize
|
||||||
if size < minsz {
|
if size < minsz {
|
||||||
size = minsz
|
size = minsz
|
||||||
}
|
}
|
||||||
@ -346,6 +354,13 @@ func (db *DB) mmap(minsz int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if db.Mlock {
|
||||||
|
// Unlock db memory
|
||||||
|
if err := db.munlock(fileSize); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Dereference all mmap references before unmapping.
|
// Dereference all mmap references before unmapping.
|
||||||
if db.rwtx != nil {
|
if db.rwtx != nil {
|
||||||
db.rwtx.root.dereference()
|
db.rwtx.root.dereference()
|
||||||
@ -361,6 +376,13 @@ func (db *DB) mmap(minsz int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if db.Mlock {
|
||||||
|
// Don't allow swapping of data file
|
||||||
|
if err := db.mlock(fileSize); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Save references to the meta pages.
|
// Save references to the meta pages.
|
||||||
db.meta0 = db.page(0).meta()
|
db.meta0 = db.page(0).meta()
|
||||||
db.meta1 = db.page(1).meta()
|
db.meta1 = db.page(1).meta()
|
||||||
@ -422,12 +444,36 @@ func (db *DB) mmapSize(size int) (int, error) {
|
|||||||
return int(sz), nil
|
return int(sz), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *DB) munlock(fileSize int) error {
|
||||||
|
if err := munlock(db, fileSize); err != nil {
|
||||||
|
return fmt.Errorf("munlock error: " + err.Error())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (db *DB) mlock(fileSize int) error {
|
||||||
|
if err := mlock(db, fileSize); err != nil {
|
||||||
|
return fmt.Errorf("mlock error: " + err.Error())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (db *DB) mrelock(fileSizeFrom, fileSizeTo int) error {
|
||||||
|
if err := db.munlock(fileSizeFrom); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := db.mlock(fileSizeTo); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// init creates a new database file and initializes its meta pages.
|
// init creates a new database file and initializes its meta pages.
|
||||||
func (db *DB) init() error {
|
func (db *DB) init() error {
|
||||||
// Create two meta pages on a buffer.
|
// Create two meta pages on a buffer.
|
||||||
buf := make([]byte, db.pageSize*4)
|
buf := make([]byte, db.pageSize*4)
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
p := db.pageInBuffer(buf[:], pgid(i))
|
p := db.pageInBuffer(buf, pgid(i))
|
||||||
p.id = pgid(i)
|
p.id = pgid(i)
|
||||||
p.flags = metaPageFlag
|
p.flags = metaPageFlag
|
||||||
|
|
||||||
@ -444,13 +490,13 @@ func (db *DB) init() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write an empty freelist at page 3.
|
// Write an empty freelist at page 3.
|
||||||
p := db.pageInBuffer(buf[:], pgid(2))
|
p := db.pageInBuffer(buf, pgid(2))
|
||||||
p.id = pgid(2)
|
p.id = pgid(2)
|
||||||
p.flags = freelistPageFlag
|
p.flags = freelistPageFlag
|
||||||
p.count = 0
|
p.count = 0
|
||||||
|
|
||||||
// Write an empty leaf page at page 4.
|
// Write an empty leaf page at page 4.
|
||||||
p = db.pageInBuffer(buf[:], pgid(3))
|
p = db.pageInBuffer(buf, pgid(3))
|
||||||
p.id = pgid(3)
|
p.id = pgid(3)
|
||||||
p.flags = leafPageFlag
|
p.flags = leafPageFlag
|
||||||
p.count = 0
|
p.count = 0
|
||||||
@ -462,6 +508,7 @@ func (db *DB) init() error {
|
|||||||
if err := fdatasync(db); err != nil {
|
if err := fdatasync(db); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
db.filesz = len(buf)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -973,6 +1020,12 @@ func (db *DB) grow(sz int) error {
|
|||||||
if err := db.file.Sync(); err != nil {
|
if err := db.file.Sync(); err != nil {
|
||||||
return fmt.Errorf("file sync error: %s", err)
|
return fmt.Errorf("file sync error: %s", err)
|
||||||
}
|
}
|
||||||
|
if db.Mlock {
|
||||||
|
// unlock old file and lock new one
|
||||||
|
if err := db.mrelock(db.filesz, sz); err != nil {
|
||||||
|
return fmt.Errorf("mlock/munlock error: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db.filesz = sz
|
db.filesz = sz
|
||||||
@ -1064,6 +1117,11 @@ type Options struct {
|
|||||||
// OpenFile is used to open files. It defaults to os.OpenFile. This option
|
// OpenFile is used to open files. It defaults to os.OpenFile. This option
|
||||||
// is useful for writing hermetic tests.
|
// is useful for writing hermetic tests.
|
||||||
OpenFile func(string, int, os.FileMode) (*os.File, error)
|
OpenFile func(string, int, os.FileMode) (*os.File, error)
|
||||||
|
|
||||||
|
// Mlock locks database file in memory when set to true.
|
||||||
|
// It prevents potential page faults, however
|
||||||
|
// used memory can't be reclaimed. (UNIX only)
|
||||||
|
Mlock bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultOptions represent the options used if nil options are passed into Open().
|
// DefaultOptions represent the options used if nil options are passed into Open().
|
||||||
|
6
vendor/go.etcd.io/bbolt/freelist_hmap.go
generated
vendored
6
vendor/go.etcd.io/bbolt/freelist_hmap.go
generated
vendored
@ -4,7 +4,7 @@ import "sort"
|
|||||||
|
|
||||||
// hashmapFreeCount returns count of free pages(hashmap version)
|
// hashmapFreeCount returns count of free pages(hashmap version)
|
||||||
func (f *freelist) hashmapFreeCount() int {
|
func (f *freelist) hashmapFreeCount() int {
|
||||||
// use the forwardmap to get the total count
|
// use the forwardMap to get the total count
|
||||||
count := 0
|
count := 0
|
||||||
for _, size := range f.forwardMap {
|
for _, size := range f.forwardMap {
|
||||||
count += int(size)
|
count += int(size)
|
||||||
@ -41,7 +41,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid {
|
|||||||
|
|
||||||
for pid := range bm {
|
for pid := range bm {
|
||||||
// remove the initial
|
// remove the initial
|
||||||
f.delSpan(pid, uint64(size))
|
f.delSpan(pid, size)
|
||||||
|
|
||||||
f.allocs[pid] = txid
|
f.allocs[pid] = txid
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid {
|
|||||||
f.addSpan(pid+pgid(n), remain)
|
f.addSpan(pid+pgid(n), remain)
|
||||||
|
|
||||||
for i := pgid(0); i < pgid(n); i++ {
|
for i := pgid(0); i < pgid(n); i++ {
|
||||||
delete(f.cache, pid+pgid(i))
|
delete(f.cache, pid+i)
|
||||||
}
|
}
|
||||||
return pid
|
return pid
|
||||||
}
|
}
|
||||||
|
2
vendor/go.etcd.io/bbolt/go.mod
generated
vendored
2
vendor/go.etcd.io/bbolt/go.mod
generated
vendored
@ -2,4 +2,4 @@ module go.etcd.io/bbolt
|
|||||||
|
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
|
require golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d
|
||||||
|
4
vendor/go.etcd.io/bbolt/go.sum
generated
vendored
4
vendor/go.etcd.io/bbolt/go.sum
generated
vendored
@ -1,2 +1,2 @@
|
|||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
|
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d h1:L/IKR6COd7ubZrs2oTnTi73IhgqJ71c9s80WsQnh0Es=
|
||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
36
vendor/go.etcd.io/bbolt/mlock_unix.go
generated
vendored
Normal file
36
vendor/go.etcd.io/bbolt/mlock_unix.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package bbolt
|
||||||
|
|
||||||
|
import "golang.org/x/sys/unix"
|
||||||
|
|
||||||
|
// mlock locks memory of db file
|
||||||
|
func mlock(db *DB, fileSize int) error {
|
||||||
|
sizeToLock := fileSize
|
||||||
|
if sizeToLock > db.datasz {
|
||||||
|
// Can't lock more than mmaped slice
|
||||||
|
sizeToLock = db.datasz
|
||||||
|
}
|
||||||
|
if err := unix.Mlock(db.dataref[:sizeToLock]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//munlock unlocks memory of db file
|
||||||
|
func munlock(db *DB, fileSize int) error {
|
||||||
|
if db.dataref == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
sizeToUnlock := fileSize
|
||||||
|
if sizeToUnlock > db.datasz {
|
||||||
|
// Can't unlock more than mmaped slice
|
||||||
|
sizeToUnlock = db.datasz
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := unix.Munlock(db.dataref[:sizeToUnlock]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
11
vendor/go.etcd.io/bbolt/mlock_windows.go
generated
vendored
Normal file
11
vendor/go.etcd.io/bbolt/mlock_windows.go
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package bbolt
|
||||||
|
|
||||||
|
// mlock locks memory of db file
|
||||||
|
func mlock(_ *DB, _ int) error {
|
||||||
|
panic("mlock is supported only on UNIX systems")
|
||||||
|
}
|
||||||
|
|
||||||
|
//munlock unlocks memory of db file
|
||||||
|
func munlock(_ *DB, _ int) error {
|
||||||
|
panic("munlock is supported only on UNIX systems")
|
||||||
|
}
|
3
vendor/go.etcd.io/bbolt/tx.go
generated
vendored
3
vendor/go.etcd.io/bbolt/tx.go
generated
vendored
@ -188,7 +188,6 @@ func (tx *Tx) Commit() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If strict mode is enabled then perform a consistency check.
|
// If strict mode is enabled then perform a consistency check.
|
||||||
// Only the first consistency error is reported in the panic.
|
|
||||||
if tx.db.StrictMode {
|
if tx.db.StrictMode {
|
||||||
ch := tx.Check()
|
ch := tx.Check()
|
||||||
var errs []string
|
var errs []string
|
||||||
@ -393,7 +392,7 @@ func (tx *Tx) CopyFile(path string, mode os.FileMode) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tx.Copy(f)
|
_, err = tx.WriteTo(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = f.Close()
|
_ = f.Close()
|
||||||
return err
|
return err
|
||||||
|
76
vendor/golang.org/x/crypto/ssh/terminal/terminal.go
generated
vendored
76
vendor/golang.org/x/crypto/ssh/terminal/terminal.go
generated
vendored
@ -1,76 +0,0 @@
|
|||||||
// Copyright 2011 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// Package terminal provides support functions for dealing with terminals, as
|
|
||||||
// commonly found on UNIX systems.
|
|
||||||
//
|
|
||||||
// Deprecated: this package moved to golang.org/x/term.
|
|
||||||
package terminal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
|
|
||||||
"golang.org/x/term"
|
|
||||||
)
|
|
||||||
|
|
||||||
// EscapeCodes contains escape sequences that can be written to the terminal in
|
|
||||||
// order to achieve different styles of text.
|
|
||||||
type EscapeCodes = term.EscapeCodes
|
|
||||||
|
|
||||||
// Terminal contains the state for running a VT100 terminal that is capable of
|
|
||||||
// reading lines of input.
|
|
||||||
type Terminal = term.Terminal
|
|
||||||
|
|
||||||
// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is
|
|
||||||
// a local terminal, that terminal must first have been put into raw mode.
|
|
||||||
// prompt is a string that is written at the start of each input line (i.e.
|
|
||||||
// "> ").
|
|
||||||
func NewTerminal(c io.ReadWriter, prompt string) *Terminal {
|
|
||||||
return term.NewTerminal(c, prompt)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ErrPasteIndicator may be returned from ReadLine as the error, in addition
|
|
||||||
// to valid line data. It indicates that bracketed paste mode is enabled and
|
|
||||||
// that the returned line consists only of pasted data. Programs may wish to
|
|
||||||
// interpret pasted data more literally than typed data.
|
|
||||||
var ErrPasteIndicator = term.ErrPasteIndicator
|
|
||||||
|
|
||||||
// State contains the state of a terminal.
|
|
||||||
type State = term.State
|
|
||||||
|
|
||||||
// IsTerminal returns whether the given file descriptor is a terminal.
|
|
||||||
func IsTerminal(fd int) bool {
|
|
||||||
return term.IsTerminal(fd)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadPassword reads a line of input from a terminal without local echo. This
|
|
||||||
// is commonly used for inputting passwords and other sensitive data. The slice
|
|
||||||
// returned does not include the \n.
|
|
||||||
func ReadPassword(fd int) ([]byte, error) {
|
|
||||||
return term.ReadPassword(fd)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MakeRaw puts the terminal connected to the given file descriptor into raw
|
|
||||||
// mode and returns the previous state of the terminal so that it can be
|
|
||||||
// restored.
|
|
||||||
func MakeRaw(fd int) (*State, error) {
|
|
||||||
return term.MakeRaw(fd)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore restores the terminal connected to the given file descriptor to a
|
|
||||||
// previous state.
|
|
||||||
func Restore(fd int, oldState *State) error {
|
|
||||||
return term.Restore(fd, oldState)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetState returns the current state of a terminal which may be useful to
|
|
||||||
// restore the terminal after a signal.
|
|
||||||
func GetState(fd int) (*State, error) {
|
|
||||||
return term.GetState(fd)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetSize returns the dimensions of the given terminal.
|
|
||||||
func GetSize(fd int) (width, height int, err error) {
|
|
||||||
return term.GetSize(fd)
|
|
||||||
}
|
|
102
vendor/golang.org/x/sys/execabs/execabs.go
generated
vendored
Normal file
102
vendor/golang.org/x/sys/execabs/execabs.go
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package execabs is a drop-in replacement for os/exec
|
||||||
|
// that requires PATH lookups to find absolute paths.
|
||||||
|
// That is, execabs.Command("cmd") runs the same PATH lookup
|
||||||
|
// as exec.Command("cmd"), but if the result is a path
|
||||||
|
// which is relative, the Run and Start methods will report
|
||||||
|
// an error instead of running the executable.
|
||||||
|
//
|
||||||
|
// See https://blog.golang.org/path-security for more information
|
||||||
|
// about when it may be necessary or appropriate to use this package.
|
||||||
|
package execabs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ErrNotFound is the error resulting if a path search failed to find an executable file.
|
||||||
|
// It is an alias for exec.ErrNotFound.
|
||||||
|
var ErrNotFound = exec.ErrNotFound
|
||||||
|
|
||||||
|
// Cmd represents an external command being prepared or run.
|
||||||
|
// It is an alias for exec.Cmd.
|
||||||
|
type Cmd = exec.Cmd
|
||||||
|
|
||||||
|
// Error is returned by LookPath when it fails to classify a file as an executable.
|
||||||
|
// It is an alias for exec.Error.
|
||||||
|
type Error = exec.Error
|
||||||
|
|
||||||
|
// An ExitError reports an unsuccessful exit by a command.
|
||||||
|
// It is an alias for exec.ExitError.
|
||||||
|
type ExitError = exec.ExitError
|
||||||
|
|
||||||
|
func relError(file, path string) error {
|
||||||
|
return fmt.Errorf("%s resolves to executable in current directory (.%c%s)", file, filepath.Separator, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LookPath searches for an executable named file in the directories
|
||||||
|
// named by the PATH environment variable. If file contains a slash,
|
||||||
|
// it is tried directly and the PATH is not consulted. The result will be
|
||||||
|
// an absolute path.
|
||||||
|
//
|
||||||
|
// LookPath differs from exec.LookPath in its handling of PATH lookups,
|
||||||
|
// which are used for file names without slashes. If exec.LookPath's
|
||||||
|
// PATH lookup would have returned an executable from the current directory,
|
||||||
|
// LookPath instead returns an error.
|
||||||
|
func LookPath(file string) (string, error) {
|
||||||
|
path, err := exec.LookPath(file)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if filepath.Base(file) == file && !filepath.IsAbs(path) {
|
||||||
|
return "", relError(file, path)
|
||||||
|
}
|
||||||
|
return path, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func fixCmd(name string, cmd *exec.Cmd) {
|
||||||
|
if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) {
|
||||||
|
// exec.Command was called with a bare binary name and
|
||||||
|
// exec.LookPath returned a path which is not absolute.
|
||||||
|
// Set cmd.lookPathErr and clear cmd.Path so that it
|
||||||
|
// cannot be run.
|
||||||
|
lookPathErr := (*error)(unsafe.Pointer(reflect.ValueOf(cmd).Elem().FieldByName("lookPathErr").Addr().Pointer()))
|
||||||
|
if *lookPathErr == nil {
|
||||||
|
*lookPathErr = relError(name, cmd.Path)
|
||||||
|
}
|
||||||
|
cmd.Path = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommandContext is like Command but includes a context.
|
||||||
|
//
|
||||||
|
// The provided context is used to kill the process (by calling os.Process.Kill)
|
||||||
|
// if the context becomes done before the command completes on its own.
|
||||||
|
func CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd {
|
||||||
|
cmd := exec.CommandContext(ctx, name, arg...)
|
||||||
|
fixCmd(name, cmd)
|
||||||
|
return cmd
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command returns the Cmd struct to execute the named program with the given arguments.
|
||||||
|
// See exec.Command for most details.
|
||||||
|
//
|
||||||
|
// Command differs from exec.Command in its handling of PATH lookups,
|
||||||
|
// which are used when the program name contains no slashes.
|
||||||
|
// If exec.Command would have returned an exec.Cmd configured to run an
|
||||||
|
// executable from the current directory, Command instead
|
||||||
|
// returns an exec.Cmd that will return an error from Start or Run.
|
||||||
|
func Command(name string, arg ...string) *exec.Cmd {
|
||||||
|
cmd := exec.Command(name, arg...)
|
||||||
|
fixCmd(name, cmd)
|
||||||
|
return cmd
|
||||||
|
}
|
6
vendor/golang.org/x/sys/unix/README.md
generated
vendored
6
vendor/golang.org/x/sys/unix/README.md
generated
vendored
@ -76,7 +76,7 @@ arguments can be passed to the kernel. The third is for low-level use by the
|
|||||||
ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
|
ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
|
||||||
let it know that a system call is running.
|
let it know that a system call is running.
|
||||||
|
|
||||||
When porting Go to an new architecture/OS, this file must be implemented for
|
When porting Go to a new architecture/OS, this file must be implemented for
|
||||||
each GOOS/GOARCH pair.
|
each GOOS/GOARCH pair.
|
||||||
|
|
||||||
### mksysnum
|
### mksysnum
|
||||||
@ -107,7 +107,7 @@ prototype can be exported (capitalized) or not.
|
|||||||
Adding a new syscall often just requires adding a new `//sys` function prototype
|
Adding a new syscall often just requires adding a new `//sys` function prototype
|
||||||
with the desired arguments and a capitalized name so it is exported. However, if
|
with the desired arguments and a capitalized name so it is exported. However, if
|
||||||
you want the interface to the syscall to be different, often one will make an
|
you want the interface to the syscall to be different, often one will make an
|
||||||
unexported `//sys` prototype, an then write a custom wrapper in
|
unexported `//sys` prototype, and then write a custom wrapper in
|
||||||
`syscall_${GOOS}.go`.
|
`syscall_${GOOS}.go`.
|
||||||
|
|
||||||
### types files
|
### types files
|
||||||
@ -137,7 +137,7 @@ some `#if/#elif` macros in your include statements.
|
|||||||
|
|
||||||
This script is used to generate the system's various constants. This doesn't
|
This script is used to generate the system's various constants. This doesn't
|
||||||
just include the error numbers and error strings, but also the signal numbers
|
just include the error numbers and error strings, but also the signal numbers
|
||||||
an a wide variety of miscellaneous constants. The constants come from the list
|
and a wide variety of miscellaneous constants. The constants come from the list
|
||||||
of include files in the `includes_${uname}` variable. A regex then picks out
|
of include files in the `includes_${uname}` variable. A regex then picks out
|
||||||
the desired `#define` statements, and generates the corresponding Go constants.
|
the desired `#define` statements, and generates the corresponding Go constants.
|
||||||
The error numbers and strings are generated from `#include <errno.h>`, and the
|
The error numbers and strings are generated from `#include <errno.h>`, and the
|
||||||
|
4
vendor/golang.org/x/sys/unix/asm_bsd_386.s
generated
vendored
4
vendor/golang.org/x/sys/unix/asm_bsd_386.s
generated
vendored
@ -2,8 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
//go:build (freebsd || netbsd || openbsd) && gc
|
||||||
// +build darwin freebsd netbsd openbsd
|
// +build freebsd netbsd openbsd
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
4
vendor/golang.org/x/sys/unix/asm_bsd_arm.s
generated
vendored
4
vendor/golang.org/x/sys/unix/asm_bsd_arm.s
generated
vendored
@ -2,8 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
//go:build (freebsd || netbsd || openbsd) && gc
|
||||||
// +build darwin freebsd netbsd openbsd
|
// +build freebsd netbsd openbsd
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
4
vendor/golang.org/x/sys/unix/fdset.go
generated
vendored
4
vendor/golang.org/x/sys/unix/fdset.go
generated
vendored
@ -2,8 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
12
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
12
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
@ -70,23 +70,11 @@ aix_ppc64)
|
|||||||
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
darwin_386)
|
|
||||||
mkerrors="$mkerrors -m32"
|
|
||||||
mksyscall="go run mksyscall.go -l32"
|
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
||||||
mkasm="go run mkasm_darwin.go"
|
|
||||||
;;
|
|
||||||
darwin_amd64)
|
darwin_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
mkasm="go run mkasm_darwin.go"
|
mkasm="go run mkasm_darwin.go"
|
||||||
;;
|
;;
|
||||||
darwin_arm)
|
|
||||||
mkerrors="$mkerrors"
|
|
||||||
mksyscall="go run mksyscall.go -l32"
|
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
||||||
mkasm="go run mkasm_darwin.go"
|
|
||||||
;;
|
|
||||||
darwin_arm64)
|
darwin_arm64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
8
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
8
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@ -239,6 +239,7 @@ struct ltchars {
|
|||||||
#include <linux/netfilter/nfnetlink.h>
|
#include <linux/netfilter/nfnetlink.h>
|
||||||
#include <linux/netlink.h>
|
#include <linux/netlink.h>
|
||||||
#include <linux/net_namespace.h>
|
#include <linux/net_namespace.h>
|
||||||
|
#include <linux/nfc.h>
|
||||||
#include <linux/nsfs.h>
|
#include <linux/nsfs.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
#include <linux/pps.h>
|
#include <linux/pps.h>
|
||||||
@ -258,6 +259,7 @@ struct ltchars {
|
|||||||
#include <linux/watchdog.h>
|
#include <linux/watchdog.h>
|
||||||
|
|
||||||
#include <mtd/ubi-user.h>
|
#include <mtd/ubi-user.h>
|
||||||
|
#include <mtd/mtd-user.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
|
|
||||||
#if defined(__sparc__)
|
#if defined(__sparc__)
|
||||||
@ -501,6 +503,9 @@ ccflags="$@"
|
|||||||
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
||||||
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
||||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ ||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ ||
|
||||||
|
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||||
|
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||||
|
$2 ~ /^RAW_PAYLOAD_/ ||
|
||||||
$2 ~ /^TP_STATUS_/ ||
|
$2 ~ /^TP_STATUS_/ ||
|
||||||
$2 ~ /^FALLOC_/ ||
|
$2 ~ /^FALLOC_/ ||
|
||||||
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
|
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
|
||||||
@ -593,6 +598,9 @@ ccflags="$@"
|
|||||||
$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
|
$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
|
||||||
$2 ~ /^_?HIDIOC/ ||
|
$2 ~ /^_?HIDIOC/ ||
|
||||||
$2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
|
$2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
|
||||||
|
$2 ~ /^MTD/ ||
|
||||||
|
$2 ~ /^OTP/ ||
|
||||||
|
$2 ~ /^MEM/ ||
|
||||||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||||
$2 ~ /^__WCOREFLAG$/ {next}
|
$2 ~ /^__WCOREFLAG$/ {next}
|
||||||
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||||
|
4
vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
generated
vendored
@ -17,7 +17,7 @@ import (
|
|||||||
//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
|
//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
|
||||||
|
|
||||||
func fdopendir(fd int) (dir uintptr, err error) {
|
func fdopendir(fd int) (dir uintptr, err error) {
|
||||||
r0, _, e1 := syscall_syscallPtr(funcPC(libc_fdopendir_trampoline), uintptr(fd), 0, 0)
|
r0, _, e1 := syscall_syscallPtr(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0)
|
||||||
dir = uintptr(r0)
|
dir = uintptr(r0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
@ -25,7 +25,7 @@ func fdopendir(fd int) (dir uintptr, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func libc_fdopendir_trampoline()
|
var libc_fdopendir_trampoline_addr uintptr
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
|
//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
51
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
51
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
@ -1,51 +0,0 @@
|
|||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build 386 && darwin
|
|
||||||
// +build 386,darwin
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
|
||||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setTimeval(sec, usec int64) Timeval {
|
|
||||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
|
||||||
k.Ident = uint32(fd)
|
|
||||||
k.Filter = int16(mode)
|
|
||||||
k.Flags = uint16(flags)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (iov *Iovec) SetLen(length int) {
|
|
||||||
iov.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetControllen(length int) {
|
|
||||||
msghdr.Controllen = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetIovlen(length int) {
|
|
||||||
msghdr.Iovlen = int32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
||||||
cmsg.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
|
||||||
|
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
|
||||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
|
||||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
|
||||||
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
|
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
|
||||||
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
|
|
||||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
|
51
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
51
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
@ -1,51 +0,0 @@
|
|||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
func ptrace1(request int, pid int, addr uintptr, data uintptr) error {
|
|
||||||
return ENOTSUP
|
|
||||||
}
|
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
|
||||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setTimeval(sec, usec int64) Timeval {
|
|
||||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
|
||||||
k.Ident = uint32(fd)
|
|
||||||
k.Filter = int16(mode)
|
|
||||||
k.Flags = uint16(flags)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (iov *Iovec) SetLen(length int) {
|
|
||||||
iov.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetControllen(length int) {
|
|
||||||
msghdr.Controllen = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetIovlen(length int) {
|
|
||||||
msghdr.Iovlen = int32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
||||||
cmsg.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
|
||||||
|
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
|
||||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
|
||||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
|
||||||
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
|
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
|
9
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
9
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import "unsafe"
|
import _ "unsafe"
|
||||||
|
|
||||||
// Implemented in the runtime package (runtime/sys_darwin.go)
|
// Implemented in the runtime package (runtime/sys_darwin.go)
|
||||||
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
@ -25,10 +25,3 @@ func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
|||||||
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
||||||
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
||||||
//go:linkname syscall_syscallPtr syscall.syscallPtr
|
//go:linkname syscall_syscallPtr syscall.syscallPtr
|
||||||
|
|
||||||
// Find the entry point for f. See comments in runtime/proc.go for the
|
|
||||||
// function of the same name.
|
|
||||||
//go:nosplit
|
|
||||||
func funcPC(f func()) uintptr {
|
|
||||||
return **(**uintptr)(unsafe.Pointer(&f))
|
|
||||||
}
|
|
||||||
|
71
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
71
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
@ -904,6 +904,46 @@ func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SockaddrNFC struct {
|
||||||
|
DeviceIdx uint32
|
||||||
|
TargetIdx uint32
|
||||||
|
NFCProtocol uint32
|
||||||
|
raw RawSockaddrNFC
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sa *SockaddrNFC) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
|
sa.raw.Sa_family = AF_NFC
|
||||||
|
sa.raw.Dev_idx = sa.DeviceIdx
|
||||||
|
sa.raw.Target_idx = sa.TargetIdx
|
||||||
|
sa.raw.Nfc_protocol = sa.NFCProtocol
|
||||||
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrNFC, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type SockaddrNFCLLCP struct {
|
||||||
|
DeviceIdx uint32
|
||||||
|
TargetIdx uint32
|
||||||
|
NFCProtocol uint32
|
||||||
|
DestinationSAP uint8
|
||||||
|
SourceSAP uint8
|
||||||
|
ServiceName string
|
||||||
|
raw RawSockaddrNFCLLCP
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sa *SockaddrNFCLLCP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
|
sa.raw.Sa_family = AF_NFC
|
||||||
|
sa.raw.Dev_idx = sa.DeviceIdx
|
||||||
|
sa.raw.Target_idx = sa.TargetIdx
|
||||||
|
sa.raw.Nfc_protocol = sa.NFCProtocol
|
||||||
|
sa.raw.Dsap = sa.DestinationSAP
|
||||||
|
sa.raw.Ssap = sa.SourceSAP
|
||||||
|
if len(sa.ServiceName) > len(sa.raw.Service_name) {
|
||||||
|
return nil, 0, EINVAL
|
||||||
|
}
|
||||||
|
copy(sa.raw.Service_name[:], sa.ServiceName)
|
||||||
|
sa.raw.SetServiceNameLen(len(sa.ServiceName))
|
||||||
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrNFCLLCP, nil
|
||||||
|
}
|
||||||
|
|
||||||
var socketProtocol = func(fd int) (int, error) {
|
var socketProtocol = func(fd int) (int, error) {
|
||||||
return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
||||||
}
|
}
|
||||||
@ -1144,6 +1184,37 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||||||
}
|
}
|
||||||
return sa, nil
|
return sa, nil
|
||||||
}
|
}
|
||||||
|
case AF_NFC:
|
||||||
|
proto, err := socketProtocol(fd)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
switch proto {
|
||||||
|
case NFC_SOCKPROTO_RAW:
|
||||||
|
pp := (*RawSockaddrNFC)(unsafe.Pointer(rsa))
|
||||||
|
sa := &SockaddrNFC{
|
||||||
|
DeviceIdx: pp.Dev_idx,
|
||||||
|
TargetIdx: pp.Target_idx,
|
||||||
|
NFCProtocol: pp.Nfc_protocol,
|
||||||
|
}
|
||||||
|
return sa, nil
|
||||||
|
case NFC_SOCKPROTO_LLCP:
|
||||||
|
pp := (*RawSockaddrNFCLLCP)(unsafe.Pointer(rsa))
|
||||||
|
if uint64(pp.Service_name_len) > uint64(len(pp.Service_name)) {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
sa := &SockaddrNFCLLCP{
|
||||||
|
DeviceIdx: pp.Dev_idx,
|
||||||
|
TargetIdx: pp.Target_idx,
|
||||||
|
NFCProtocol: pp.Nfc_protocol,
|
||||||
|
DestinationSAP: pp.Dsap,
|
||||||
|
SourceSAP: pp.Ssap,
|
||||||
|
ServiceName: string(pp.Service_name[:pp.Service_name_len]),
|
||||||
|
}
|
||||||
|
return sa, nil
|
||||||
|
default:
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil, EAFNOSUPPORT
|
return nil, EAFNOSUPPORT
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user