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>
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>
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>
We should provide the ability to customize private of object HEAD /
DELETE ops.
Implement `UseKey` method on `PrmObjectHead` / `PrmObjectDelete` types.
Sign requests with the specified key if called.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add helper function which accepts container and object identifiers and
returns object instance read to the memory.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make `ObjectReader` / `ObjectRangeReader` to track number of bytes read
and return:
* `io.ErrUnexpectedEOF` if the stream finished by the server before
the last byte of the payload was read.
* an error if more object payload size bytes was read.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>