[#83] pkg/client: Support status returns

Make all `Client` methods to return structured values and error. Parse v2
status messages in all RPC and provide status getter from all result
structures. Returns status failures as status result instead of error.

Interface changes:
  * all methods return `<method>Res` structure;
  * rename some methods to be more clear;
  * unify TZ and SHA256 objecy payload hashing in single method.

Behavior changes:
  * client doesn't verify object header structure received via Object.Head.
    If the caller was tied to verification, now it must do it explicitly.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-11-16 21:17:25 +03:00 committed by LeL
parent 9dcff95a29
commit bf78cddf69
8 changed files with 835 additions and 372 deletions

View file

@ -7,7 +7,8 @@ type ResponseMetaInfo struct {
key []byte
}
type verificationHeaderGetter interface {
type responseV2 interface {
GetMetaHeader() *session.ResponseMetaHeader
GetVerificationHeader() *session.ResponseVerificationHeader
}
@ -26,7 +27,7 @@ func WithResponseInfoHandler(f func(ResponseMetaInfo) error) Option {
}
}
func (c *clientImpl) handleResponseInfoV2(_ *callOptions, resp verificationHeaderGetter) error {
func (c *clientImpl) handleResponseInfoV2(opts *callOptions, resp responseV2) error {
if c.opts.cbRespInfo == nil {
return nil
}