diff --git a/README.md b/README.md index a04a7a46..c7388894 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ type Bucket interface { // Upload the contents of the reader as an object into the bucket. // Upload should be idempotent. - Upload(ctx context.Context, name string, r io.Reader) (int64, error) + Upload(ctx context.Context, name string, r io.Reader) error // Delete removes the object with the given name. // If object does not exist in the moment of deletion, Delete should throw error. diff --git a/go.mod b/go.mod index 5bf1fd24..187628d7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/thanos-io/objstore go 1.18 require ( - cloud.google.com/go/storage v1.10.0 + cloud.google.com/go/storage v1.31.0 github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible github.com/aws/aws-sdk-go-v2 v1.16.0 github.com/aws/aws-sdk-go-v2/config v1.15.1 @@ -24,18 +24,19 @@ require ( go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 go.uber.org/atomic v1.9.0 - golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 - golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 - google.golang.org/api v0.80.0 + golang.org/x/oauth2 v0.8.0 + golang.org/x/sync v0.2.0 + google.golang.org/api v0.126.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/yaml.v2 v2.4.0 ) require ( - cloud.google.com/go v0.100.2 // indirect - cloud.google.com/go/compute v1.6.1 // indirect - cloud.google.com/go/iam v0.3.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.1 // indirect + cloud.google.com/go v0.110.2 // indirect + cloud.google.com/go/compute v1.19.3 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/iam v1.1.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect @@ -50,7 +51,7 @@ require ( github.com/aws/smithy-go v1.11.1 // indirect github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/clbanning/mxj v1.8.4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -58,10 +59,13 @@ require ( github.com/gofrs/flock v0.8.1 // indirect github.com/golang-jwt/jwt/v4 v4.4.3 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/google/go-querystring v1.1.0 // indirect + github.com/google/s2a-go v0.1.4 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/gax-go/v2 v2.3.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect + github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.16.7 // indirect @@ -81,23 +85,25 @@ require ( github.com/rs/xid v1.5.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sony/gobreaker v0.5.0 // indirect - github.com/stretchr/objx v0.2.0 // indirect - go.opencensus.io v0.23.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect + go.opencensus.io v0.24.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.11.0 // indirect golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect - golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20220524023933-508584e28198 // indirect - google.golang.org/grpc v1.46.2 // indirect - google.golang.org/protobuf v1.28.0 // indirect + google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/grpc v1.55.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/ini.v1 v1.67.0 // indirect ) require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.5.1 github.com/kr/text v0.2.0 // indirect diff --git a/go.sum b/go.sum index 21e06236..829951b6 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,8 @@ cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Ud cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= +cloud.google.com/go v0.110.2 h1:sdFPBr6xG9/wkBbfhmUz/JmZC7X6LavQgcrVINrKiVA= +cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -40,10 +42,16 @@ cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6m cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= cloud.google.com/go/compute v1.6.1 h1:2sMmt8prCn7DPaG4Pmh0N3Inmc8cT8ae5k1M6VJ9Wqc= cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= +cloud.google.com/go/compute v1.19.3 h1:DcTwsFgGev/wV5+q8o2fzgcHOaac+DKGC91ZlvpsQds= +cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/iam v0.3.0 h1:exkAomrVUuzx9kWFI1wm3KI0uoDeUFPB4kKGzx6x+Gc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= +cloud.google.com/go/iam v1.1.0 h1:67gSqaPukx7O8WLLHMa0PNs3EBGd2eE4d+psbO/CO94= +cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -54,13 +62,18 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0 h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.31.0 h1:+S3LjjEN2zZ+L5hOwj4+1OkGCsLVe0NzpXKQ1pSdTCI= +cloud.google.com/go/storage v1.31.0/go.mod h1:81ams1PrhW16L4kF7qg+4mTq7SRs5HsbDTM0bWvrwJ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 h1:sVW/AFBTGyJxDaMYlq0ct3jUXTtj12tQ6zE2GZUgVQw= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8u3fcIHyqkLjcFpNRHQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.1 h1:Oj853U9kG+RLTCQXpjvOnrv0WaZHxgmZz1TlLywgOPY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.1/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.5.1 h1:BMTdr+ib5ljLa9MxTJK8x/Ds0MbBb4MfuW5BL0zMJnI= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.5.1/go.mod h1:c6WvOhtmjNUWbLfOG1qxM/q0SPvQNSVJvolm+C52dIU= github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 h1:VgSJlZH5u0k2qxSpqyghcFQKmvYckj46uymKK5XzkBM= @@ -115,6 +128,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -172,6 +186,7 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU= github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -207,6 +222,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -225,6 +242,7 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= @@ -250,10 +268,14 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= +github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -261,6 +283,8 @@ github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0 github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.3.0 h1:nRJtk3y8Fm770D42QV6T90ZnvFZyk7agSo3Q+Z9p3WI= github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= +github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -317,6 +341,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSrwhe88TQQ= github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -378,12 +403,17 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.194/go.mod h1:yrBKWhChnDqNz1xuXdSbWXG56XawEq0G5j1lg4VwBD4= @@ -394,6 +424,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -402,6 +433,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= @@ -415,6 +448,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -452,6 +487,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -490,11 +526,13 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -517,6 +555,8 @@ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 h1:OSnWWcOd/CtWQC2cYSBgbTSJv3ciqd8r54ySIW2y3RE= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= +golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -530,6 +570,7 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -595,7 +636,9 @@ golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -610,6 +653,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -668,12 +712,15 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -712,6 +759,8 @@ google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRR google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= google.golang.org/api v0.80.0 h1:IQWaGVCYnsm4MO3hh+WtSXMzMzuyFx/fuR8qkN3A0Qo= google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= +google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= +google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -794,6 +843,12 @@ google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220524023933-508584e28198 h1:a1g7i05I2vUwq5eYrmxBJy6rPbw/yo7WzzwPJmcC0P4= google.golang.org/genproto v0.0.0-20220524023933-508584e28198/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc h1:8DyZCyvI8mE1IdLy/60bS+52xfymkE72wv1asokgtao= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -825,6 +880,8 @@ google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11 google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -841,6 +898,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -862,6 +921,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/inmem.go b/inmem.go index 52f325d6..ce648d81 100644 --- a/inmem.go +++ b/inmem.go @@ -175,12 +175,12 @@ func (b *InMemBucket) Attributes(_ context.Context, name string) (ObjectAttribut } // Upload writes the file specified in src to into the memory. -func (b *InMemBucket) Upload(_ context.Context, name string, r io.Reader) (int64, error) { +func (b *InMemBucket) Upload(_ context.Context, name string, r io.Reader) error { b.mtx.Lock() defer b.mtx.Unlock() body, err := io.ReadAll(r) if err != nil { - return 0, err + return err } b.objects[name] = body size := int64(len(body)) @@ -188,7 +188,7 @@ func (b *InMemBucket) Upload(_ context.Context, name string, r io.Reader) (int64 Size: size, LastModified: time.Now(), } - return size, nil + return nil } // Delete removes all data prefixed with the dir. diff --git a/objstore.go b/objstore.go index 00303ec7..0ad7dbb2 100644 --- a/objstore.go +++ b/objstore.go @@ -42,7 +42,7 @@ type Bucket interface { // Upload the contents of the reader as an object into the bucket. // Upload should be idempotent. - Upload(ctx context.Context, name string, r io.Reader) (int64, error) + Upload(ctx context.Context, name string, r io.Reader) error // Delete removes the object with the given name. // If object does not exist in the moment of deletion, Delete should throw error. @@ -285,7 +285,7 @@ func UploadFile(ctx context.Context, logger log.Logger, bkt Bucket, src, dst str } defer logerrcapture.Do(logger, r.Close, "close file %s", src) - if _, err := bkt.Upload(ctx, dst, r); err != nil { + if err := bkt.Upload(ctx, dst, r); err != nil { return errors.Wrapf(err, "upload file %s as %s", src, dst) } level.Debug(logger).Log("msg", "uploaded file", "from", src, "dst", dst, "bucket", bkt.Name()) @@ -599,22 +599,22 @@ func (b *metricBucket) Exists(ctx context.Context, name string) (bool, error) { return ok, nil } -func (b *metricBucket) Upload(ctx context.Context, name string, r io.Reader) (int64, error) { +func (b *metricBucket) Upload(ctx context.Context, name string, r io.Reader) error { const op = OpUpload b.ops.WithLabelValues(op).Inc() start := time.Now() - writtenBytes, err := b.bkt.Upload(ctx, name, r) + err := b.bkt.Upload(ctx, name, r) if err != nil { if !b.isOpFailureExpected(err) && ctx.Err() != context.Canceled { b.opsFailures.WithLabelValues(op).Inc() } - return 0, err + return err } - b.opsWrittenBytes.WithLabelValues(op).Add(float64(writtenBytes)) + //b.opsWrittenBytes.WithLabelValues(op).Add(float64(writtenBytes)) b.lastSuccessfulUploadTime.WithLabelValues(b.bkt.Name()).SetToCurrentTime() b.opsDuration.WithLabelValues(op).Observe(time.Since(start).Seconds()) - return writtenBytes, nil + return nil } func (b *metricBucket) Delete(ctx context.Context, name string) error { diff --git a/objstore_test.go b/objstore_test.go index a8bc4809..f0eee902 100644 --- a/objstore_test.go +++ b/objstore_test.go @@ -77,12 +77,9 @@ func TestDownloadUploadDirConcurrency(t *testing.T) { m := WrapWithMetrics(NewInMemBucket(), r, "") tempDir := t.TempDir() - _, err := m.Upload(context.Background(), "dir/obj1", bytes.NewReader([]byte("1"))) - testutil.Ok(t, err) - _, err = m.Upload(context.Background(), "dir/obj2", bytes.NewReader([]byte("2"))) - testutil.Ok(t, err) - _, err = m.Upload(context.Background(), "dir/obj3", bytes.NewReader(bytes.Repeat([]byte("3"), 1024*1024))) - testutil.Ok(t, err) + testutil.Ok(t, m.Upload(context.Background(), "dir/obj1", bytes.NewReader([]byte("1")))) + testutil.Ok(t, m.Upload(context.Background(), "dir/obj2", bytes.NewReader([]byte("2")))) + testutil.Ok(t, m.Upload(context.Background(), "dir/obj3", bytes.NewReader(bytes.Repeat([]byte("3"), 1024*1024)))) testutil.Ok(t, promtest.GatherAndCompare(r, strings.NewReader(` # HELP objstore_bucket_operations_total Total number of all attempted operations against a bucket. @@ -216,12 +213,9 @@ func TestDownloadDir_CleanUp(t *testing.T) { } tempDir := t.TempDir() - _, err := b.Upload(context.Background(), "dir/obj1", bytes.NewReader([]byte("1"))) - testutil.Ok(t, err) - _, err = b.Upload(context.Background(), "dir/obj2", bytes.NewReader([]byte("2"))) - testutil.Ok(t, err) - _, err = b.Upload(context.Background(), "dir/obj3", bytes.NewReader([]byte("3"))) - testutil.Ok(t, err) + testutil.Ok(t, b.Upload(context.Background(), "dir/obj1", bytes.NewReader([]byte("1")))) + testutil.Ok(t, b.Upload(context.Background(), "dir/obj2", bytes.NewReader([]byte("2")))) + testutil.Ok(t, b.Upload(context.Background(), "dir/obj3", bytes.NewReader([]byte("3")))) // We exapect the third Get to fail testutil.NotOk(t, DownloadDir(context.Background(), log.NewNopLogger(), b, "dir/", "dir/", tempDir)) diff --git a/prefixed_bucket.go b/prefixed_bucket.go index a646cd22..41448011 100644 --- a/prefixed_bucket.go +++ b/prefixed_bucket.go @@ -86,7 +86,7 @@ func (p PrefixedBucket) Attributes(ctx context.Context, name string) (ObjectAttr // Upload the contents of the reader as an object into the bucket. // Upload should be idempotent. -func (p *PrefixedBucket) Upload(ctx context.Context, name string, r io.Reader) (int64, error) { +func (p *PrefixedBucket) Upload(ctx context.Context, name string, r io.Reader) error { return p.bkt.Upload(ctx, conditionalPrefix(p.prefix, name), r) } diff --git a/prefixed_bucket_test.go b/prefixed_bucket_test.go index e7f2d9bc..f93c8580 100644 --- a/prefixed_bucket_test.go +++ b/prefixed_bucket_test.go @@ -29,8 +29,7 @@ func TestPrefixedBucket_Acceptance(t *testing.T) { } func UsesPrefixTest(t *testing.T, bkt Bucket, prefix string) { - _, err := bkt.Upload(context.Background(), strings.Trim(prefix, "/")+"/file1.jpg", strings.NewReader("test-data1")) - testutil.Ok(t, err) + testutil.Ok(t, bkt.Upload(context.Background(), strings.Trim(prefix, "/")+"/file1.jpg", strings.NewReader("test-data1"))) pBkt := NewPrefixedBucket(bkt, prefix) rc1, err := pBkt.Get(context.Background(), "file1.jpg") @@ -42,8 +41,7 @@ func UsesPrefixTest(t *testing.T, bkt Bucket, prefix string) { testutil.Ok(t, err) testutil.Equals(t, "test-data1", string(content)) - _, err = pBkt.Upload(context.Background(), "file2.jpg", strings.NewReader("test-data2")) - testutil.Ok(t, err) + testutil.Ok(t, pBkt.Upload(context.Background(), "file2.jpg", strings.NewReader("test-data2"))) rc2, err := bkt.Get(context.Background(), strings.Trim(prefix, "/")+"/file2.jpg") testutil.Ok(t, err) defer func() { testutil.Ok(t, rc2.Close()) }() @@ -71,8 +69,7 @@ func UsesPrefixTest(t *testing.T, bkt Bucket, prefix string) { testutil.Ok(t, err) testutil.Assert(t, attrs.Size == 10, "expected size to be equal to 10") - _, err = bkt.Upload(context.Background(), strings.Trim(prefix, "/")+"/dir/file1.jpg", strings.NewReader("test-data1")) - testutil.Ok(t, err) + testutil.Ok(t, bkt.Upload(context.Background(), strings.Trim(prefix, "/")+"/dir/file1.jpg", strings.NewReader("test-data1"))) seen := []string{} testutil.Ok(t, pBkt.Iter(context.Background(), "", func(fn string) error { seen = append(seen, fn) diff --git a/providers/azure/azure.go b/providers/azure/azure.go index 66c0e26d..ae959dc9 100644 --- a/providers/azure/azure.go +++ b/providers/azure/azure.go @@ -295,11 +295,11 @@ func (b *Bucket) Exists(ctx context.Context, name string) (bool, error) { } // Upload the contents of the reader as an object into the bucket. -func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, error) { +func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error { level.Debug(b.logger).Log("msg", "uploading blob", "blob", name) - size, err := objstore.TryToGetSize(r) + _, err := objstore.TryToGetSize(r) if err != nil { - return 0, errors.Wrapf(err, "failed to get size apriori to upload %s", name) + return errors.Wrapf(err, "failed to get size apriori to upload %s", name) } blobClient := b.containerClient.NewBlockBlobClient(name) @@ -309,9 +309,9 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, e } if _, err := blobClient.UploadStream(ctx, r, opts); err != nil { - return 0, errors.Wrapf(err, "cannot upload Azure blob, address: %s", name) + return errors.Wrapf(err, "cannot upload Azure blob, address: %s", name) } - return size, nil + return nil } // Delete removes the object with the given name. diff --git a/providers/bos/bos.go b/providers/bos/bos.go index 58af1209..2a9b5cae 100644 --- a/providers/bos/bos.go +++ b/providers/bos/bos.go @@ -110,29 +110,29 @@ func (b *Bucket) Delete(_ context.Context, name string) error { } // Upload the contents of the reader as an object into the bucket. -func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) (int64, error) { +func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) error { size, err := objstore.TryToGetSize(r) if err != nil { - return 0, errors.Wrapf(err, "getting size of %s", name) + return errors.Wrapf(err, "getting size of %s", name) } partNums, lastSlice := int(math.Floor(float64(size)/partSize)), size%partSize if partNums == 0 { body, err := bce.NewBodyFromSizedReader(r, lastSlice) if err != nil { - return 0, errors.Wrapf(err, "failed to create SizedReader for %s", name) + return errors.Wrapf(err, "failed to create SizedReader for %s", name) } if _, err := b.client.PutObject(b.name, name, body, nil); err != nil { - return 0, errors.Wrapf(err, "failed to upload %s", name) + return errors.Wrapf(err, "failed to upload %s", name) } - return 0, nil + return nil } result, err := b.client.BasicInitiateMultipartUpload(b.name, name) if err != nil { - return 0, errors.Wrapf(err, "failed to initiate MultipartUpload for %s", name) + return errors.Wrapf(err, "failed to initiate MultipartUpload for %s", name) } uploadEveryPart := func(partSize int64, part int, uploadId string) (string, error) { @@ -156,7 +156,7 @@ func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) (int64, err for part := 1; part <= partNums; part++ { etag, err := uploadEveryPart(partSize, part, result.UploadId) if err != nil { - return 0, errors.Wrapf(err, "failed to upload part %d for %s", part, name) + return errors.Wrapf(err, "failed to upload part %d for %s", part, name) } parts = append(parts, api.UploadInfoType{PartNumber: part, ETag: etag}) } @@ -164,15 +164,15 @@ func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) (int64, err if lastSlice != 0 { etag, err := uploadEveryPart(lastSlice, partNums+1, result.UploadId) if err != nil { - return 0, errors.Wrapf(err, "failed to upload the last part for %s", name) + return errors.Wrapf(err, "failed to upload the last part for %s", name) } parts = append(parts, api.UploadInfoType{PartNumber: partNums + 1, ETag: etag}) } if _, err := b.client.CompleteMultipartUploadFromStruct(b.name, name, result.UploadId, &api.CompleteMultipartUploadArgs{Parts: parts}); err != nil { - return 0, errors.Wrapf(err, "failed to set %s upload completed", name) + return errors.Wrapf(err, "failed to set %s upload completed", name) } - return size, nil + return nil } // Iter calls f for each entry in the given directory (not recursive). The argument to f is the full diff --git a/providers/cos/cos.go b/providers/cos/cos.go index b52ae181..36ecead5 100644 --- a/providers/cos/cos.go +++ b/providers/cos/cos.go @@ -197,24 +197,24 @@ func (r fixedLengthReader) Size() int64 { } // Upload the contents of the reader as an object into the bucket. -func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, error) { +func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error { size, err := objstore.TryToGetSize(r) if err != nil { - return 0, errors.Wrapf(err, "getting size of %s", name) + return errors.Wrapf(err, "getting size of %s", name) } // partSize 128MB. const partSize = 1024 * 1024 * 128 partNums, lastSlice := int(math.Floor(float64(size)/partSize)), size%partSize if partNums == 0 { if _, err := b.client.Object.Put(ctx, name, r, nil); err != nil { - return 0, errors.Wrapf(err, "Put object: %s", name) + return errors.Wrapf(err, "Put object: %s", name) } - return 0, nil + return nil } // 1. init. result, _, err := b.client.Object.InitiateMultipartUpload(ctx, name, nil) if err != nil { - return 0, errors.Wrapf(err, "InitiateMultipartUpload %s", name) + return errors.Wrapf(err, "InitiateMultipartUpload %s", name) } uploadEveryPart := func(partSize int64, part int, uploadID string) (string, error) { r := newFixedLengthReader(r, partSize) @@ -235,7 +235,7 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, e for part := 1; part <= partNums; part++ { etag, err := uploadEveryPart(partSize, part, result.UploadID) if err != nil { - return 0, errors.Wrapf(err, "uploadPart %d, %s", part, name) + return errors.Wrapf(err, "uploadPart %d, %s", part, name) } optcom.Parts = append(optcom.Parts, cos.Object{ PartNumber: part, ETag: etag}, @@ -246,7 +246,7 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, e part := partNums + 1 etag, err := uploadEveryPart(lastSlice, part, result.UploadID) if err != nil { - return 0, errors.Wrapf(err, "uploadPart %d, %s", part, name) + return errors.Wrapf(err, "uploadPart %d, %s", part, name) } optcom.Parts = append(optcom.Parts, cos.Object{ PartNumber: part, ETag: etag}, @@ -254,9 +254,9 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, e } // 4. complete. if _, _, err := b.client.Object.CompleteMultipartUpload(ctx, name, result.UploadID, optcom); err != nil { - return 0, errors.Wrapf(err, "CompleteMultipartUpload %s", name) + return errors.Wrapf(err, "CompleteMultipartUpload %s", name) } - return size, nil + return nil } // Delete removes the object with the given name. diff --git a/providers/filesystem/filesystem.go b/providers/filesystem/filesystem.go index 72fc2d80..093445f9 100644 --- a/providers/filesystem/filesystem.go +++ b/providers/filesystem/filesystem.go @@ -191,27 +191,27 @@ func (b *Bucket) Exists(ctx context.Context, name string) (bool, error) { } // Upload writes the file specified in src to into the memory. -func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (writtenBytes int64, err error) { +func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (err error) { if ctx.Err() != nil { - return 0, ctx.Err() + return ctx.Err() } file := filepath.Join(b.rootDir, name) if err := os.MkdirAll(filepath.Dir(file), os.ModePerm); err != nil { - return 0, err + return err } f, err := os.Create(file) if err != nil { - return 0, err + return err } defer errcapture.Do(&err, f.Close, "close") - written, err := io.Copy(f, r) + _, err = io.Copy(f, r) if err != nil { - return 0, errors.Wrapf(err, "copy to %s", file) + return errors.Wrapf(err, "copy to %s", file) } - return written, nil + return nil } func isDirEmpty(name string) (ok bool, err error) { diff --git a/providers/gcs/gcs.go b/providers/gcs/gcs.go index 078296f0..e1b72b4c 100644 --- a/providers/gcs/gcs.go +++ b/providers/gcs/gcs.go @@ -169,14 +169,13 @@ func (b *Bucket) Exists(ctx context.Context, name string) (bool, error) { } // Upload writes the file specified in src to remote GCS location specified as target. -func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, error) { +func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error { w := b.bkt.Object(name).NewWriter(ctx) - - written, err := io.Copy(w, r) + _, err := io.Copy(w, r) if err != nil { - return 0, err + return err } - return written, w.Close() + return w.Close() } // Delete removes the object with the given name. diff --git a/providers/obs/obs.go b/providers/obs/obs.go index bb9c73e4..1bc58aef 100644 --- a/providers/obs/obs.go +++ b/providers/obs/obs.go @@ -128,26 +128,26 @@ func (b *Bucket) Delete(ctx context.Context, name string) error { } // Upload the contents of the reader as an object into the bucket. -func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, error) { +func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error { size, err := objstore.TryToGetSize(r) if err != nil { - return 0, errors.Wrapf(err, "failed to get size apriori to upload %s", name) + return errors.Wrapf(err, "failed to get size apriori to upload %s", name) } if size <= 0 { - return 0, errors.New("object size must be provided") + return errors.New("object size must be provided") } if size <= MinMultipartUploadSize { err = b.putObjectSingle(name, r) if err != nil { - return 0, err + return err } } else { var initOutput *obs.InitiateMultipartUploadOutput initOutput, err = b.initiateMultipartUpload(name) if err != nil { - return 0, err + return err } uploadId := initOutput.UploadId @@ -165,7 +165,7 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, e }() parts, err := b.multipartUpload(size, name, uploadId, r) if err != nil { - return 0, err + return err } _, err = b.client.CompleteMultipartUpload(&obs.CompleteMultipartUploadInput{ @@ -175,10 +175,10 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, e Parts: parts, }) if err != nil { - return 0, errors.Wrap(err, "failed to complete multipart upload") + return errors.Wrap(err, "failed to complete multipart upload") } } - return size, nil + return nil } func (b *Bucket) putObjectSingle(key string, body io.Reader) error { diff --git a/providers/oci/oci.go b/providers/oci/oci.go index 24187e99..2be3210a 100644 --- a/providers/oci/oci.go +++ b/providers/oci/oci.go @@ -166,7 +166,7 @@ func (b *Bucket) GetRange(ctx context.Context, name string, offset, length int64 // Upload the contents of the reader as an object into the bucket. // Upload should be idempotent. -func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (written int64, err error) { +func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (err error) { req := transfer.UploadStreamRequest{ UploadRequest: transfer.UploadRequest{ NamespaceName: common.String(b.namespace), @@ -183,9 +183,9 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (written } uploadManager := transfer.NewUploadManager() - response, err := uploadManager.UploadStream(ctx, req) + _, err = uploadManager.UploadStream(ctx, req) - return response.PutObjectResponse.RawResponse.ContentLength, err + return err } // Exists checks if the given object exists in the bucket. diff --git a/providers/oss/oss.go b/providers/oss/oss.go index 82c73771..08fcf1e3 100644 --- a/providers/oss/oss.go +++ b/providers/oss/oss.go @@ -68,11 +68,11 @@ func NewTestBucket(t testing.TB) (objstore.Bucket, func(), error) { } // Upload the contents of the reader as an object into the bucket. -func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) (int64, error) { +func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) error { // TODO(https://github.com/thanos-io/thanos/issues/678): Remove guessing length when minio provider will support multipart upload without this. size, err := objstore.TryToGetSize(r) if err != nil { - return 0, errors.Wrapf(err, "failed to get size apriori to upload %s", name) + return errors.Wrapf(err, "failed to get size apriori to upload %s", name) } chunksnum, lastslice := int(math.Floor(float64(size)/PartSize)), size%PartSize @@ -81,13 +81,13 @@ func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) (int64, err switch chunksnum { case 0: if err := b.bucket.PutObject(name, ncloser); err != nil { - return 0, errors.Wrap(err, "failed to upload oss object") + return errors.Wrap(err, "failed to upload oss object") } default: { init, err := b.bucket.InitiateMultipartUpload(name) if err != nil { - return 0, errors.Wrap(err, "failed to initiate multi-part upload") + return errors.Wrap(err, "failed to initiate multi-part upload") } chunk := 0 uploadEveryPart := func(everypartsize int64, cnk int) (alioss.UploadPart, error) { @@ -105,23 +105,23 @@ func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) (int64, err for ; chunk < chunksnum; chunk++ { part, err := uploadEveryPart(PartSize, chunk+1) if err != nil { - return 0, errors.Wrap(err, "failed to upload every part") + return errors.Wrap(err, "failed to upload every part") } parts = append(parts, part) } if lastslice != 0 { part, err := uploadEveryPart(lastslice, chunksnum+1) if err != nil { - return 0, errors.Wrap(err, "failed to upload the last chunk") + return errors.Wrap(err, "failed to upload the last chunk") } parts = append(parts, part) } if _, err := b.bucket.CompleteMultipartUpload(init, parts); err != nil { - return 0, errors.Wrap(err, "failed to set multi-part upload completive") + return errors.Wrap(err, "failed to set multi-part upload completive") } } } - return size, nil + return nil } // Delete removes the object with the given name. diff --git a/providers/s3/s3.go b/providers/s3/s3.go index ced23439..22453482 100644 --- a/providers/s3/s3.go +++ b/providers/s3/s3.go @@ -478,10 +478,10 @@ func (b *Bucket) Exists(ctx context.Context, name string) (bool, error) { } // Upload the contents of the reader as an object into the bucket. -func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, error) { +func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error { sse, err := b.getServerSideEncryption(ctx) if err != nil { - return 0, err + return err } // TODO(https://github.com/thanos-io/thanos/issues/678): Remove guessing length when minio provider will support multipart upload without this. @@ -495,7 +495,7 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, e if size < int64(partSize) { partSize = 0 } - resp, err := b.client.PutObject( + _, err = b.client.PutObject( ctx, b.name, name, @@ -513,10 +513,10 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) (int64, e }, ) if err != nil { - return 0, errors.Wrap(err, "upload s3 object") + return errors.Wrap(err, "upload s3 object") } - return resp.Size, nil + return nil } // Attributes returns information about the specified object. diff --git a/providers/s3/s3_e2e_test.go b/providers/s3/s3_e2e_test.go index 2bec75d9..2bb3a851 100644 --- a/providers/s3/s3_e2e_test.go +++ b/providers/s3/s3_e2e_test.go @@ -50,7 +50,6 @@ func BenchmarkUpload(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - _, err = bkt.Upload(ctx, "test", strings.NewReader(str)) - testutil.Ok(b, err) + testutil.Ok(bkt.Upload(ctx, "test", strings.NewReader(str)), err) } } diff --git a/providers/swift/swift.go b/providers/swift/swift.go index c8ca0433..29e40732 100644 --- a/providers/swift/swift.go +++ b/providers/swift/swift.go @@ -296,7 +296,7 @@ func (b *Container) IsCustomerManagedKeyError(_ error) bool { } // Upload writes the contents of the reader as an object into the container. -func (c *Container) Upload(_ context.Context, name string, r io.Reader) (written int64, err error) { +func (c *Container) Upload(_ context.Context, name string, r io.Reader) (err error) { size, err := objstore.TryToGetSize(r) if err != nil { level.Warn(c.logger).Log("msg", "could not guess file size, using large object to avoid issues if the file is larger than limit", "name", name, "err", err) @@ -314,24 +314,24 @@ func (c *Container) Upload(_ context.Context, name string, r io.Reader) (written } if c.useDynamicLargeObjects { if file, err = c.connection.DynamicLargeObjectCreateFile(&opts); err != nil { - return 0, errors.Wrap(err, "create DLO file") + return errors.Wrap(err, "create DLO file") } } else { if file, err = c.connection.StaticLargeObjectCreateFile(&opts); err != nil { - return 0, errors.Wrap(err, "create SLO file") + return errors.Wrap(err, "create SLO file") } } } else { if file, err = c.connection.ObjectCreate(c.name, name, true, "", "", swift.Headers{}); err != nil { - return 0, errors.Wrap(err, "create file") + return errors.Wrap(err, "create file") } } defer errcapture.Do(&err, file.Close, "upload object close") - written, err = io.Copy(file, r) + _, err = io.Copy(file, r) if err != nil { - return 0, errors.Wrap(err, "uploading object") + return errors.Wrap(err, "uploading object") } - return written, nil + return nil } // Delete removes the object with the given name. diff --git a/testing.go b/testing.go index f784ef3b..4e41b278 100644 --- a/testing.go +++ b/testing.go @@ -100,8 +100,7 @@ func AcceptanceTest(t *testing.T, bkt Bucket) { testutil.Assert(t, bkt.IsObjNotFoundErr(err), "expected not found error but got %s", err) // Upload first object. - _, err = bkt.Upload(ctx, "id1/obj_1.some", strings.NewReader("@test-data@")) - testutil.Ok(t, err) + testutil.Ok(t, bkt.Upload(ctx, "id1/obj_1.some", strings.NewReader("@test-data@"))) // Double check we can immediately read it. rc1, err := bkt.Get(ctx, "id1/obj_1.some") @@ -151,21 +150,14 @@ func AcceptanceTest(t *testing.T, bkt Bucket) { testutil.Assert(t, ok, "expected exits") // Upload other objects. - _, err = bkt.Upload(ctx, "id1/obj_2.some", strings.NewReader("@test-data2@")) - testutil.Ok(t, err) + testutil.Ok(t, bkt.Upload(ctx, "id1/obj_2.some", strings.NewReader("@test-data2@"))) // Upload should be idempotent. - _, err = bkt.Upload(ctx, "id1/obj_2.some", strings.NewReader("@test-data2@")) - testutil.Ok(t, err) - _, err = bkt.Upload(ctx, "id1/obj_3.some", strings.NewReader("@test-data3@")) - testutil.Ok(t, err) - _, err = bkt.Upload(ctx, "id1/sub/subobj_1.some", strings.NewReader("@test-data4@")) - testutil.Ok(t, err) - _, err = bkt.Upload(ctx, "id1/sub/subobj_2.some", strings.NewReader("@test-data5@")) - testutil.Ok(t, err) - _, err = bkt.Upload(ctx, "id2/obj_4.some", strings.NewReader("@test-data6@")) - testutil.Ok(t, err) - _, err = bkt.Upload(ctx, "obj_5.some", strings.NewReader("@test-data7@")) - testutil.Ok(t, err) + testutil.Ok(t, bkt.Upload(ctx, "id1/obj_2.some", strings.NewReader("@test-data2@"))) + testutil.Ok(t, bkt.Upload(ctx, "id1/obj_3.some", strings.NewReader("@test-data3@"))) + testutil.Ok(t, bkt.Upload(ctx, "id1/sub/subobj_1.some", strings.NewReader("@test-data4@"))) + testutil.Ok(t, bkt.Upload(ctx, "id1/sub/subobj_2.some", strings.NewReader("@test-data5@"))) + testutil.Ok(t, bkt.Upload(ctx, "id2/obj_4.some", strings.NewReader("@test-data6@"))) + testutil.Ok(t, bkt.Upload(ctx, "obj_5.some", strings.NewReader("@test-data7@"))) // Can we iter over items from top dir? var seen []string @@ -255,8 +247,7 @@ func AcceptanceTest(t *testing.T, bkt Bucket) { sort.Strings(seen) testutil.Equals(t, expected, seen) - _, err = bkt.Upload(ctx, "obj_6.som", bytes.NewReader(make([]byte, 1024*1024*200))) - testutil.Ok(t, err) + testutil.Ok(t, bkt.Upload(ctx, "obj_6.som", bytes.NewReader(make([]byte, 1024*1024*200)))) testutil.Ok(t, bkt.Delete(ctx, "obj_6.som")) } @@ -294,7 +285,7 @@ func (d *delayingBucket) Exists(ctx context.Context, name string) (bool, error) return d.bkt.Exists(ctx, name) } -func (d *delayingBucket) Upload(ctx context.Context, name string, r io.Reader) (int64, error) { +func (d *delayingBucket) Upload(ctx context.Context, name string, r io.Reader) error { time.Sleep(d.delay) return d.bkt.Upload(ctx, name, r) } diff --git a/tracing/opentelemetry/opentelemetry.go b/tracing/opentelemetry/opentelemetry.go index ca6588d5..0e7a279a 100644 --- a/tracing/opentelemetry/opentelemetry.go +++ b/tracing/opentelemetry/opentelemetry.go @@ -90,7 +90,7 @@ func (t TracingBucket) Attributes(ctx context.Context, name string) (_ objstore. return t.bkt.Attributes(ctx, name) } -func (t TracingBucket) Upload(ctx context.Context, name string, r io.Reader) (writtenBytes int64, err error) { +func (t TracingBucket) Upload(ctx context.Context, name string, r io.Reader) (err error) { ctx, span := t.tracer.Start(ctx, "bucket_upload") defer span.End() span.SetAttributes(attribute.String("name", name)) diff --git a/tracing/opentracing/opentracing.go b/tracing/opentracing/opentracing.go index 0bfa4165..8174afb1 100644 --- a/tracing/opentracing/opentracing.go +++ b/tracing/opentracing/opentracing.go @@ -96,10 +96,10 @@ func (t TracingBucket) Attributes(ctx context.Context, name string) (attrs objst return } -func (t TracingBucket) Upload(ctx context.Context, name string, r io.Reader) (writtenBytes int64, err error) { +func (t TracingBucket) Upload(ctx context.Context, name string, r io.Reader) (err error) { doWithSpan(ctx, "bucket_upload", func(spanCtx context.Context, span opentracing.Span) { span.LogKV("name", name) - writtenBytes, err = t.bkt.Upload(spanCtx, name, r) + err = t.bkt.Upload(spanCtx, name, r) }) return }