From 851b848e4483c290c9298039f12a2f0fc58d341b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Feb 2024 04:20:06 +0000 Subject: [PATCH] chore: bump github.com/nats-io/nats.go from 1.32.0 to 1.33.0 Bumps [github.com/nats-io/nats.go](https://github.com/nats-io/nats.go) from 1.32.0 to 1.33.0. - [Release notes](https://github.com/nats-io/nats.go/releases) - [Commits](https://github.com/nats-io/nats.go/compare/v1.32.0...v1.33.0) --- updated-dependencies: - dependency-name: github.com/nats-io/nats.go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../nats-io/nats.go/CONTRIBUTING.md | 45 +++++++++++++++++++ .../nats.go/encoders/builtin/default_enc.go | 2 +- vendor/github.com/nats-io/nats.go/go_test.mod | 8 ++-- vendor/github.com/nats-io/nats.go/go_test.sum | 16 +++---- vendor/github.com/nats-io/nats.go/js.go | 15 +++++++ vendor/github.com/nats-io/nats.go/jsm.go | 10 ++++- vendor/github.com/nats-io/nats.go/nats.go | 2 +- vendor/github.com/nats-io/nats.go/object.go | 35 +++++++++++---- vendor/modules.txt | 2 +- 11 files changed, 113 insertions(+), 28 deletions(-) create mode 100644 vendor/github.com/nats-io/nats.go/CONTRIBUTING.md diff --git a/go.mod b/go.mod index 85a49bd..2bf7623 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang-jwt/jwt/v4 v4.5.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/nats-io/nats.go v1.32.0 + github.com/nats-io/nats.go v1.33.0 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.32.0 golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df diff --git a/go.sum b/go.sum index ad68951..3f0e849 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/nats-io/nats.go v1.32.0 h1:Bx9BZS+aXYlxW08k8Gd3yR2s73pV5XSoAQUyp1Kwvp0= -github.com/nats-io/nats.go v1.32.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= +github.com/nats-io/nats.go v1.33.0 h1:rRg0l2F29B30n6EPl0j50hl8eYp7rA2ecoJ74E62US8= +github.com/nats-io/nats.go v1.33.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= diff --git a/vendor/github.com/nats-io/nats.go/CONTRIBUTING.md b/vendor/github.com/nats-io/nats.go/CONTRIBUTING.md new file mode 100644 index 0000000..9eea61b --- /dev/null +++ b/vendor/github.com/nats-io/nats.go/CONTRIBUTING.md @@ -0,0 +1,45 @@ +# Contributing + +Thanks for your interest in contributing! This document contains `nats-io/nats.go` specific contributing details. If you are a first-time contributor, please refer to the general [NATS Contributor Guide](https://nats.io/contributing/) to get a comprehensive overview of contributing to the NATS project. + +## Getting started + +There are three general ways you can contribute to this repo: + +- Proposing an enhancement or new feature +- Reporting a bug or regression +- Contributing changes to the source code + +For the first two, refer to the [GitHub Issues](https://github.com/nats-io/nats.go/issues/new/choose) which guides you through the available options along with the needed information to collect. + +## Contributing changes + +_Prior to opening a pull request, it is recommended to open an issue first to ensure the maintainers can review intended changes. Exceptions to this rule include fixing non-functional source such as code comments, documentation or other supporting files._ + +Proposing source code changes is done through GitHub's standard pull request workflow. + +If your branch is a work-in-progress then please start by creating your pull requests as draft, by clicking the down-arrow next to the `Create pull request` button and instead selecting `Create draft pull request`. + +This will defer the automatic process of requesting a review from the NATS team and significantly reduces noise until you are ready. Once you are happy, you can click the `Ready for review` button. + +### Guidelines + +A good pull request includes: + +- A high-level description of the changes, including links to any issues that are related by adding comments like `Resolves #NNN` to your description. See [Linking a Pull Request to an Issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) for more information. +- An up-to-date parent commit. Please make sure you are pulling in the latest `main` branch and rebasing your work on top of it, i.e. `git rebase main`. +- Unit tests where appropriate. Bug fixes will benefit from the addition of regression tests. New features will not be accepted without suitable test coverage! +- No more commits than necessary. Sometimes having multiple commits is useful for telling a story or isolating changes from one another, but please squash down any unnecessary commits that may just be for clean-up, comments or small changes. +- No additional external dependencies that aren't absolutely essential. Please do everything you can to avoid pulling in additional libraries/dependencies into `go.mod` as we will be very critical of these. + +### Sign-off + +In order to accept a contribution, you will first need to certify that the contribution is your original work and that you license the work to the project under the [Apache-2.0 license](https://github.com/nats-io/nats.go/blob/main/LICENSE). + +This is done by using `Signed-off-by` statements, which should appear in **both** your commit messages and your PR description. Please note that we can only accept sign-offs under a legal name. Nicknames and aliases are not permitted. + +To perform a sign-off with `git`, use `git commit -s` (or `--signoff`). + +## Get help + +If you have questions about the contribution process, please start a [GitHub discussion](https://github.com/nats-io/nats.go/discussions), join the [NATS Slack](https://slack.nats.io/), or send your question to the [NATS Google Group](https://groups.google.com/forum/#!forum/natsio). diff --git a/vendor/github.com/nats-io/nats.go/encoders/builtin/default_enc.go b/vendor/github.com/nats-io/nats.go/encoders/builtin/default_enc.go index 7e72963..c1d0f6f 100644 --- a/vendor/github.com/nats-io/nats.go/encoders/builtin/default_enc.go +++ b/vendor/github.com/nats-io/nats.go/encoders/builtin/default_enc.go @@ -24,7 +24,7 @@ import ( // DefaultEncoder implementation for EncodedConn. // This encoder will leave []byte and string untouched, but will attempt to // turn numbers into appropriate strings that can be decoded. It will also -// propely encoded and decode bools. If will encode a struct, but if you want +// properly encoded and decode bools. If will encode a struct, but if you want // to properly handle structures you should use JsonEncoder. type DefaultEncoder struct { // Empty diff --git a/vendor/github.com/nats-io/nats.go/go_test.mod b/vendor/github.com/nats-io/nats.go/go_test.mod index d28963c..4e747bf 100644 --- a/vendor/github.com/nats-io/nats.go/go_test.mod +++ b/vendor/github.com/nats-io/nats.go/go_test.mod @@ -5,8 +5,8 @@ go 1.19 require ( github.com/golang/protobuf v1.4.2 github.com/klauspost/compress v1.17.4 - github.com/nats-io/nats-server/v2 v2.10.7 - github.com/nats-io/nkeys v0.4.6 + github.com/nats-io/nats-server/v2 v2.10.9 + github.com/nats-io/nkeys v0.4.7 github.com/nats-io/nuid v1.0.1 go.uber.org/goleak v1.2.1 golang.org/x/text v0.14.0 @@ -16,7 +16,7 @@ require ( require ( github.com/minio/highwayhash v1.0.2 // indirect github.com/nats-io/jwt/v2 v2.5.3 // indirect - golang.org/x/crypto v0.16.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect ) diff --git a/vendor/github.com/nats-io/nats.go/go_test.sum b/vendor/github.com/nats-io/nats.go/go_test.sum index 38fe6ef..e33016d 100644 --- a/vendor/github.com/nats-io/nats.go/go_test.sum +++ b/vendor/github.com/nats-io/nats.go/go_test.sum @@ -16,21 +16,21 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/nats-io/jwt/v2 v2.5.3 h1:/9SWvzc6hTfamcgXJ3uYRpgj+QuY2aLNqRiqrKcrpEo= github.com/nats-io/jwt/v2 v2.5.3/go.mod h1:iysuPemFcc7p4IoYots3IuELSI4EDe9Y0bQMe+I3Bf4= -github.com/nats-io/nats-server/v2 v2.10.7 h1:f5VDy+GMu7JyuFA0Fef+6TfulfCs5nBTgq7MMkFJx5Y= -github.com/nats-io/nats-server/v2 v2.10.7/go.mod h1:V2JHOvPiPdtfDXTuEUsthUnCvSDeFrK4Xn9hRo6du7c= -github.com/nats-io/nkeys v0.4.6 h1:IzVe95ru2CT6ta874rt9saQRkWfe2nFj1NtvYSLqMzY= -github.com/nats-io/nkeys v0.4.6/go.mod h1:4DxZNzenSVd1cYQoAa8948QY3QDjrHfcfVADymtkpts= +github.com/nats-io/nats-server/v2 v2.10.9 h1:VEW43Zz+p+9lARtiPM9ctd6ckun+92ZT2T17HWtwiFI= +github.com/nats-io/nats-server/v2 v2.10.9/go.mod h1:oorGiV9j3BOLLO3ejQe+U7pfAGyPo+ppD7rpgNF6KTQ= +github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= +github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= diff --git a/vendor/github.com/nats-io/nats.go/js.go b/vendor/github.com/nats-io/nats.go/js.go index 0c06730..462fea1 100644 --- a/vendor/github.com/nats-io/nats.go/js.go +++ b/vendor/github.com/nats-io/nats.go/js.go @@ -32,6 +32,11 @@ import ( ) // JetStream allows persistent messaging through JetStream. +// +// NOTE: JetStream is part of legacy API. +// Users are encouraged to switch to the new JetStream API for enhanced capabilities and +// simplified API. Please refer to the `jetstream` package. +// See: https://github.com/nats-io/nats.go/blob/main/jetstream/README.md type JetStream interface { // Publish publishes a message to JetStream. Publish(subj string, data []byte, opts ...PubOpt) (*PubAck, error) @@ -106,6 +111,11 @@ type JetStream interface { } // JetStreamContext allows JetStream messaging and stream management. +// +// NOTE: JetStreamContext is part of legacy API. +// Users are encouraged to switch to the new JetStream API for enhanced capabilities and +// simplified API. Please refer to the `jetstream` package. +// See: https://github.com/nats-io/nats.go/blob/main/jetstream/README.md type JetStreamContext interface { JetStream JetStreamManager @@ -276,6 +286,11 @@ const ( // JetStream returns a JetStreamContext for messaging and stream management. // Errors are only returned if inconsistent options are provided. +// +// NOTE: JetStreamContext is part of legacy API. +// Users are encouraged to switch to the new JetStream API for enhanced capabilities and +// simplified API. Please refer to the `jetstream` package. +// See: https://github.com/nats-io/nats.go/blob/main/jetstream/README.md func (nc *Conn) JetStream(opts ...JSOpt) (JetStreamContext, error) { js := &js{ nc: nc, diff --git a/vendor/github.com/nats-io/nats.go/jsm.go b/vendor/github.com/nats-io/nats.go/jsm.go index 8f72472..94fa86c 100644 --- a/vendor/github.com/nats-io/nats.go/jsm.go +++ b/vendor/github.com/nats-io/nats.go/jsm.go @@ -70,6 +70,10 @@ type JetStreamManager interface { SecureDeleteMsg(name string, seq uint64, opts ...JSOpt) error // AddConsumer adds a consumer to a stream. + // If the consumer already exists, and the configuration is the same, it + // will return the existing consumer. + // If the consumer already exists, and the configuration is different, it + // will return ErrConsumerNameAlreadyInUse. AddConsumer(stream string, cfg *ConsumerConfig, opts ...JSOpt) (*ConsumerInfo, error) // UpdateConsumer updates an existing consumer. @@ -329,7 +333,11 @@ type consumerResponse struct { *ConsumerInfo } -// AddConsumer will add a JetStream consumer. +// AddConsumer adds a consumer to a stream. +// If the consumer already exists, and the configuration is the same, it +// will return the existing consumer. +// If the consumer already exists, and the configuration is different, it +// will return ErrConsumerNameAlreadyInUse. func (js *js) AddConsumer(stream string, cfg *ConsumerConfig, opts ...JSOpt) (*ConsumerInfo, error) { if cfg == nil { cfg = &ConsumerConfig{} diff --git a/vendor/github.com/nats-io/nats.go/nats.go b/vendor/github.com/nats-io/nats.go/nats.go index a252da2..cb9e8b8 100644 --- a/vendor/github.com/nats-io/nats.go/nats.go +++ b/vendor/github.com/nats-io/nats.go/nats.go @@ -849,7 +849,7 @@ func InProcessServer(server InProcessConnProvider) Option { // Secure is an Option to enable TLS secure connections that skip server verification by default. // Pass a TLS Configuration for proper TLS. -// NOTE: This should NOT be used in a production setting. +// A TLS Configuration using InsecureSkipVerify should NOT be used in a production setting. func Secure(tls ...*tls.Config) Option { return func(o *Options) error { o.Secure = true diff --git a/vendor/github.com/nats-io/nats.go/object.go b/vendor/github.com/nats-io/nats.go/object.go index 9226791..f3f5d97 100644 --- a/vendor/github.com/nats-io/nats.go/object.go +++ b/vendor/github.com/nats-io/nats.go/object.go @@ -153,6 +153,9 @@ type ObjectStoreConfig struct { // Bucket-specific metadata // NOTE: Metadata requires nats-server v2.10.0+ Metadata map[string]string `json:"metadata,omitempty"` + // Enable underlying stream compression. + // NOTE: Compression is supported for nats-server 2.10.0+ + Compression bool } type ObjectStoreStatus interface { @@ -174,6 +177,8 @@ type ObjectStoreStatus interface { BackingStore() string // Metadata is the user supplied metadata for the bucket Metadata() map[string]string + // IsCompressed indicates if the data is compressed on disk + IsCompressed() bool } // ObjectMetaOptions @@ -266,7 +271,10 @@ func (js *js) CreateObjectStore(cfg *ObjectStoreConfig) (ObjectStore, error) { if maxBytes == 0 { maxBytes = -1 } - + var compression StoreCompression + if cfg.Compression { + compression = S2Compression + } scfg := &StreamConfig{ Name: fmt.Sprintf(objNameTmpl, name), Description: cfg.Description, @@ -280,6 +288,7 @@ func (js *js) CreateObjectStore(cfg *ObjectStoreConfig) (ObjectStore, error) { AllowRollup: true, AllowDirect: true, Metadata: cfg.Metadata, + Compression: compression, } // Create our stream. @@ -384,7 +393,7 @@ func (obs *obs) Put(meta *ObjectMeta, r io.Reader, opts ...ObjectOpt) (*ObjectIn case <-time.After(obs.js.opts.wait): } if err := obs.js.purgeStream(obs.stream, &StreamPurgeRequest{Subject: chunkSubj}); err != nil { - return fmt.Errorf("could not cleanup bucket after erronous put operation: %w", err) + return fmt.Errorf("could not cleanup bucket after erroneous put operation: %w", err) } return nil } @@ -535,11 +544,12 @@ func DecodeObjectDigest(data string) ([]byte, error) { // ObjectResult impl. type objResult struct { sync.Mutex - info *ObjectInfo - r io.ReadCloser - err error - ctx context.Context - digest hash.Hash + info *ObjectInfo + r io.ReadCloser + err error + ctx context.Context + digest hash.Hash + readTimeout time.Duration } func (info *ObjectInfo) isLink() bool { @@ -623,7 +633,7 @@ func (obs *obs) Get(name string, opts ...GetObjectOpt) (ObjectResult, error) { return lobs.Get(info.ObjectMeta.Opts.Link.Name) } - result := &objResult{info: info, ctx: ctx} + result := &objResult{info: info, ctx: ctx, readTimeout: obs.js.opts.wait} if info.Size == 0 { return result, nil } @@ -1223,6 +1233,9 @@ func (s *ObjectBucketStatus) Metadata() map[string]string { return s.nfo.Config. // StreamInfo is the stream info retrieved to create the status func (s *ObjectBucketStatus) StreamInfo() *StreamInfo { return s.nfo } +// IsCompressed indicates if the data is compressed on disk +func (s *ObjectBucketStatus) IsCompressed() bool { return s.nfo.Config.Compression != NoCompression } + // Status retrieves run-time status about a bucket func (obs *obs) Status() (ObjectStoreStatus, error) { nfo, err := obs.js.StreamInfo(obs.stream) @@ -1242,7 +1255,11 @@ func (obs *obs) Status() (ObjectStoreStatus, error) { func (o *objResult) Read(p []byte) (n int, err error) { o.Lock() defer o.Unlock() + readDeadline := time.Now().Add(o.readTimeout) if ctx := o.ctx; ctx != nil { + if deadline, ok := ctx.Deadline(); ok { + readDeadline = deadline + } select { case <-ctx.Done(): if ctx.Err() == context.Canceled { @@ -1261,7 +1278,7 @@ func (o *objResult) Read(p []byte) (n int, err error) { } r := o.r.(net.Conn) - r.SetReadDeadline(time.Now().Add(2 * time.Second)) + r.SetReadDeadline(readDeadline) n, err = r.Read(p) if err, ok := err.(net.Error); ok && err.Timeout() { if ctx := o.ctx; ctx != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 5c6cdd3..9bbb947 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -26,7 +26,7 @@ github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.19 ## explicit; go 1.15 github.com/mattn/go-isatty -# github.com/nats-io/nats.go v1.32.0 +# github.com/nats-io/nats.go v1.33.0 ## explicit; go 1.20 github.com/nats-io/nats.go github.com/nats-io/nats.go/encoders/builtin