When mirroring Object Store, there is a need to setup subject
transformations. However, client also needs to bind to the stream
to avoid stream lookup, which is both not necessary and expensive,
and also does not work with Object Store mirrors.
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
The change is needed to properly operate on mirrored object store buckets.
By binding stream nats.go does not need to search for stream by subjects (which does not work for mirrors).
* Add link changes and some refactoring
* Remove test skipping on Windows
* Allowed to add a bucket/link over a bucket/link
Co-authored-by: Jean-Noël Moyne <jnmoyne@users.noreply.github.com>
Co-authored-by: jnmoyne <jnmoyne@gmail.com>
The old code might miss the last object if `Reader` return both a value and `EOF`
Extract from `Reader` doc :
> When Read encounters an error or end-of-file condition after successfully reading n > 0 bytes, it returns the number of bytes read. It may return the (non-nil) error from the same call or return the error (and n == 0) from a subsequent call. An instance of this general case is that a Reader returning a non-zero number of bytes at the end of the input stream may return either err == EOF or err == nil. The next Read should return 0, EOF.
>
> Callers should always process the n > 0 bytes returned before considering the error err. Doing so correctly handles I/O errors that happen after reading some bytes and also both of the allowed EOF behaviors.
The new `gospel` tool, <https://github.com/kortschak/gospel>, uses hunspell
libraries but pre-registers as acceptable words every symbol from the Go
source, massively reducing the noise and making comment spell-checking a
tractable problem. It recently gained support for a `.words` file located in
the same directory as the `go.mod` file, to define local words. With this, we
can fix real issues too.
This PR reduces the complaints down to 4:
1. A reference to `syncSubscribers` which I can't figure out
2. A reference to a `pubArg`
3. Two references to `splitArgs`.
I made two actual code changes:
1. Fixing a **non-exported** const type for consistency with all the others:
`apiStreamList` -> `apiStreamListT`.
2. Changing an error message to refer to a field which exist
Lots of typo fixes; references to since-renamed fields; etc.
A reference to `PublishAsynMsg` might have been intended to be
`PublishAsyncMsg` but that doesn't exist either, so I removed it.
Similarly, `SubjectIsDelivery` lived briefly but a stale reference was left in
a comment, so I removed that.
To reproduce:
go install github.com/kortschak/gospel@latest
gospel .
Also:
- Fixed message reply in PublishMsgAsync
- Ability to seal streams
- Ability for consumer to get message headers only, no msg payload
- GetLastMsg and purgeStream by subject
Signed-off-by: Derek Collison <derek@nats.io>