Return `error` from all `ReadFromV2` methods in order to support
backward compatibility if message will be extended with some formatted
field.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
It is a helper function that uses a `Pool` to fetch network information and
apply it to the container (change the container if it does not fit the
network). Currently, only applies the homomorphic hashing parameter.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Add `IsErrSessionExpired` and `IsErrSessionNotFound` functions which
assert corresponding session errors.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Client errors are quite often wrapped in context. When checking a
specific error, it is required not to lose the ability to determine it,
regardless of the attached context. In previous implementation `IsErr*`
functions didn't support wrapped errors.
Make `IsErr*` functions to preliminarily unwrap `error` argument before
type assertion. Use `errors.Unwrap` for this instead of `errors.As`
since the latter has the overhead of filling in an error.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make test value generator to be random as documented. Add `default`
keyword to switch-case to avoid linter comments.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Replace basic ACL functionality from `acl` package to the `container`
one. Create `BasicACL` type and provide convenient interface to work
with it.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
NEO VM uses little-endian format for integers,
however the resulting byte slice can contain less than 8 bytes.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Session token and signature isn't presented in `Container` and
`EACLTable` messages of NeoFS API V2 protocol. These entities are needed
for access control and doesn't carry payload of these messages.
Remove `SetSessionToken` / `SessionToken` methods of
`container.Container` and `eacl.Table` types. Provide methods to specify
these components in corresponding `Client` operations.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Support preprocessing within the `NodeInfo` type. Provide methods for
placement directly from the `NodeInfo` type. Returns slice of slices of
`NodeInfo` from placement methods of `Netmap`. Remove no longer needed
`Node` and `Nodes` types.
```
name old time/op new time/op delta
ManySelects-12 19.7µs ±14% 15.8µs ±15% -19.70% (p=0.000 n=20+20)
name old alloc/op new alloc/op delta
ManySelects-12 8.65kB ± 0% 6.22kB ± 0% -28.03% (p=0.000 n=20+20)
name old allocs/op new allocs/op delta
ManySelects-12 82.0 ± 0% 81.0 ± 0% -1.22% (p=0.000 n=20+20)
```
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
After 85e3c7b087 `processResponse` method
sets `err` field or sets status in `statusRes` field of `contextCall`.
In previous implementation `ObjectWriter.Close` method returned
`ctxCall.err` on `false` return of `processResponse` method. This could
cause NPE-panic if status failure resolving was disabled.
Make `ObjectWriter.Close` to return internal `err` field only if it is
set, otherwise return status response.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>