forked from TrueCloudLab/frostfs-node
[#211] blobstor: Refactor GetBig parameters and result
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
fb6857a1cb
commit
6813f40665
3 changed files with 44 additions and 23 deletions
|
@ -11,33 +11,17 @@ import (
|
|||
|
||||
// GetBigPrm groups the parameters of GetBig operation.
|
||||
type GetBigPrm struct {
|
||||
addr *objectSDK.Address
|
||||
address
|
||||
}
|
||||
|
||||
// GetBigRes groups resulting values of GetBig operation.
|
||||
type GetBigRes struct {
|
||||
obj *object.Object
|
||||
roObject
|
||||
}
|
||||
|
||||
// ErrObjectNotFound is returns on read operations requested on a missing object.
|
||||
var ErrObjectNotFound = errors.New("object not found")
|
||||
|
||||
// WithAddress is a GetBig option to set the address of the requested object.
|
||||
//
|
||||
// Option is required.
|
||||
func (p *GetBigPrm) WithAddress(addr *objectSDK.Address) *GetBigPrm {
|
||||
if p != nil {
|
||||
p.addr = addr
|
||||
}
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
// Object returns the requested object.
|
||||
func (r *GetBigRes) Object() *object.Object {
|
||||
return r.obj
|
||||
}
|
||||
|
||||
// GetBig reads the object from shallow dir of BLOB storage by address.
|
||||
//
|
||||
// Returns any error encountered that
|
||||
|
@ -68,7 +52,9 @@ func (b *BlobStor) GetBig(prm *GetBigPrm) (*GetBigRes, error) {
|
|||
}
|
||||
|
||||
return &GetBigRes{
|
||||
obj: obj,
|
||||
roObject: roObject{
|
||||
obj: obj,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue