forked from TrueCloudLab/frostfs-node
[#239] object/head: Implement new service processing
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
9dd83bdf0d
commit
0e1f05ff45
11 changed files with 348 additions and 140 deletions
|
@ -9,14 +9,12 @@ import (
|
|||
|
||||
// Get serves a request to get an object by address, and returns Streamer instance.
|
||||
func (s *Service) Get(ctx context.Context, prm Prm) error {
|
||||
return s.get(ctx, RangePrm{
|
||||
commonPrm: prm.commonPrm,
|
||||
}).err
|
||||
return s.get(ctx, prm.commonPrm).err
|
||||
}
|
||||
|
||||
// GetRange serves a request to get an object by address, and returns Streamer instance.
|
||||
func (s *Service) GetRange(ctx context.Context, prm RangePrm) error {
|
||||
return s.get(ctx, prm).err
|
||||
return s.get(ctx, prm.commonPrm, withPayloadRange(prm.rng)).err
|
||||
}
|
||||
|
||||
func (s *Service) GetRangeHash(ctx context.Context, prm RangeHashPrm) (*RangeHashRes, error) {
|
||||
|
@ -50,14 +48,28 @@ func (s *Service) GetRangeHash(ctx context.Context, prm RangeHashPrm) (*RangeHas
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (s *Service) get(ctx context.Context, prm RangePrm) statusError {
|
||||
// Head reads object header from container.
|
||||
//
|
||||
// Returns ErrNotFound if the header was not received for the call.
|
||||
// Returns SplitInfoError if object is virtual and raw flag is set.
|
||||
func (s *Service) Head(ctx context.Context, prm HeadPrm) error {
|
||||
return s.get(ctx, prm.commonPrm, headOnly()).err
|
||||
}
|
||||
|
||||
func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) statusError {
|
||||
exec := &execCtx{
|
||||
svc: s,
|
||||
ctx: ctx,
|
||||
prm: prm,
|
||||
svc: s,
|
||||
ctx: ctx,
|
||||
prm: RangePrm{
|
||||
commonPrm: prm,
|
||||
},
|
||||
infoSplit: objectSDK.NewSplitInfo(),
|
||||
}
|
||||
|
||||
for i := range opts {
|
||||
opts[i](exec)
|
||||
}
|
||||
|
||||
exec.setLogger(s.log)
|
||||
|
||||
exec.execute()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue