forked from TrueCloudLab/frostfs-node
[#277] getsvc: Do not return status error
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
3bac5a485d
commit
8fc082b688
2 changed files with 8 additions and 10 deletions
|
@ -128,10 +128,8 @@ func (exec *execCtx) GetObject(ctx context.Context, id oid.ID, rng *objectSDK.Ra
|
||||||
p.addr.SetContainer(exec.containerID())
|
p.addr.SetContainer(exec.containerID())
|
||||||
p.addr.SetObject(id)
|
p.addr.SetObject(id)
|
||||||
|
|
||||||
statusError := exec.svc.get(ctx, p.commonPrm, withPayloadRange(rng))
|
if err := exec.svc.get(ctx, p.commonPrm, withPayloadRange(rng)); err != nil {
|
||||||
|
return nil, err
|
||||||
if statusError.err != nil {
|
|
||||||
return nil, statusError.err
|
|
||||||
}
|
}
|
||||||
return w.Object(), nil
|
return w.Object(), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
// Get serves a request to get an object by address, and returns Streamer instance.
|
// Get serves a request to get an object by address, and returns Streamer instance.
|
||||||
func (s *Service) Get(ctx context.Context, prm Prm) error {
|
func (s *Service) Get(ctx context.Context, prm Prm) error {
|
||||||
return s.get(ctx, prm.commonPrm).err
|
return s.get(ctx, prm.commonPrm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRange serves a request to get an object by address, and returns Streamer instance.
|
// GetRange serves a request to get an object by address, and returns Streamer instance.
|
||||||
|
@ -19,8 +19,8 @@ func (s *Service) GetRange(ctx context.Context, prm RangePrm) error {
|
||||||
return s.getRange(ctx, prm)
|
return s.getRange(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) getRange(ctx context.Context, prm RangePrm, opts ...execOption) error {
|
func (s *Service) getRange(ctx context.Context, prm RangePrm) error {
|
||||||
return s.get(ctx, prm.commonPrm, append(opts, withPayloadRange(prm.rng))...).err
|
return s.get(ctx, prm.commonPrm, withPayloadRange(prm.rng))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) GetRangeHash(ctx context.Context, prm RangeHashPrm) (*RangeHashRes, error) {
|
func (s *Service) GetRangeHash(ctx context.Context, prm RangeHashPrm) (*RangeHashRes, error) {
|
||||||
|
@ -60,10 +60,10 @@ func (s *Service) GetRangeHash(ctx context.Context, prm RangeHashPrm) (*RangeHas
|
||||||
// Returns ErrNotFound if the header was not received for the call.
|
// Returns ErrNotFound if the header was not received for the call.
|
||||||
// Returns SplitInfoError if object is virtual and raw flag is set.
|
// Returns SplitInfoError if object is virtual and raw flag is set.
|
||||||
func (s *Service) Head(ctx context.Context, prm HeadPrm) error {
|
func (s *Service) Head(ctx context.Context, prm HeadPrm) error {
|
||||||
return s.get(ctx, prm.commonPrm, headOnly()).err
|
return s.get(ctx, prm.commonPrm, headOnly())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) statusError {
|
func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) error {
|
||||||
exec := &execCtx{
|
exec := &execCtx{
|
||||||
svc: s,
|
svc: s,
|
||||||
prm: RangePrm{
|
prm: RangePrm{
|
||||||
|
@ -80,7 +80,7 @@ func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) st
|
||||||
|
|
||||||
exec.execute(ctx)
|
exec.execute(ctx)
|
||||||
|
|
||||||
return exec.statusError
|
return exec.statusError.err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (exec *execCtx) execute(ctx context.Context) {
|
func (exec *execCtx) execute(ctx context.Context) {
|
||||||
|
|
Loading…
Reference in a new issue