Connection pool package should not define `Pool` type as an interface
since it provides single particular implementation.
Make `pool.Pool` type a struct instead of interface. Also remove
`Object`, `Container` and `Accounting` interfaces.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Get rid of `Option` pattern. Define `Init`, `Dial` and `Close` methods
for the corresponding stages of use.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
All NeoFS object must have at least container and owner identifiers.
Add `InitCreation` function which write all required fields to the
object instance. Extend `Object` type docs with all the constructors.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Some callbacks, such as `close()` -> `result(v2)` may
generate new errors, so `processCall` should not ignore
them.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
`SignData`: use `ECDSAWithSHA512` by default. `SignWithRFC6979` option
switches the scheme to `RFC6979WithSHA256`.
`VerifyData`: if scheme is not fixed (like by `SignWithRFC6979` option)
then scheme from the message is processed.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Extend docs with supported status returns. Add several helper functions
which allow to check the particular status.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define `SessionTokenNotFound`/`SessionTokenExpired` types for
`TOKEN_NOT_FOUND`/`TOKEN_EXPIRED` codes.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define `ObjectAccessDenied` type for `ACCESS_DENIED` code. Provide
method to write/read human-readable reason.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add `TypeLock` value to `Type` enum. Implement `Lock` type compatible
with corresponding message. Implement `ObjectLocked` and
`IrregularObjectLock` errors in `apistatus` package.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Allow `SignOption` to set 2 parameters:
1. Default signature scheme, which is used in case scheme is
unspecified.
2. Restrict scheme option which also checks that scheme is either
unspecified or equal to the restricted scheme. This is only used
for verification and is necessary because some of the signatures
are used in smart-contracts.
Also provide signature struct to sign/verify functions in helpers.
The constant names differ a bit from those in API because of linter
complaints.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
In previous implementation `Close` method of `ObjectReader` /
`ObjectRangeReader` could incorrectly return `io.ErrUnexpectedEOF` of
payload wasn't read by `Read` method (in this case
`remainingPayloadLen` state var is not updated).
Return `io.ErrUnexpectedEOF` from `Read` method only.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
In previous implementation all `Read` methods read single response
per-call, so buffer could be incompletely filled w/o an error. In order
to follow `io.Reader` docs we need to continue filling the buffer while
it is possible.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
In previous implementation `ObjectListReader.Read` returned `false` on
server responded with empty ID list. This could cause premature end of
reading since the protocol does not forbid intermediate empty lists.
Do not stop if ID list from response body is empty.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
In previous implementation we wrote up to 4KB payload chunk per-call.
This led to sending a large number of messages with a large
amount of payload.
Increase buffer length limit to 3MB.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
In previous implementation payload chunks were split into pieces with
512B length. This led to sending a large number of messages with a large
amount of payload.
Increase per-message payload chunk limit to 3MB.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Use call private key parameterized in `HeadObject` / `DeleteObject`
methods of `Pool` as corresponding key for `ObjectHead` / `ObjectDelete`
methods of `Client`.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>