forked from TrueCloudLab/frostfs-node
[#211] blobstor: Rename Get operation to GetBig
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
4e8cc51e7b
commit
fb6857a1cb
2 changed files with 13 additions and 13 deletions
|
@ -9,23 +9,23 @@ import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetPrm groups the parameters of Get operation.
|
// GetBigPrm groups the parameters of GetBig operation.
|
||||||
type GetPrm struct {
|
type GetBigPrm struct {
|
||||||
addr *objectSDK.Address
|
addr *objectSDK.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRes groups resulting values of Get operation.
|
// GetBigRes groups resulting values of GetBig operation.
|
||||||
type GetRes struct {
|
type GetBigRes struct {
|
||||||
obj *object.Object
|
obj *object.Object
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrObjectNotFound is returns on read operations requested on a missing object.
|
// ErrObjectNotFound is returns on read operations requested on a missing object.
|
||||||
var ErrObjectNotFound = errors.New("object not found")
|
var ErrObjectNotFound = errors.New("object not found")
|
||||||
|
|
||||||
// WithAddress is a Get option to set the address of the requested object.
|
// WithAddress is a GetBig option to set the address of the requested object.
|
||||||
//
|
//
|
||||||
// Option is required.
|
// Option is required.
|
||||||
func (p *GetPrm) WithAddress(addr *objectSDK.Address) *GetPrm {
|
func (p *GetBigPrm) WithAddress(addr *objectSDK.Address) *GetBigPrm {
|
||||||
if p != nil {
|
if p != nil {
|
||||||
p.addr = addr
|
p.addr = addr
|
||||||
}
|
}
|
||||||
|
@ -34,15 +34,15 @@ func (p *GetPrm) WithAddress(addr *objectSDK.Address) *GetPrm {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Object returns the requested object.
|
// Object returns the requested object.
|
||||||
func (r *GetRes) Object() *object.Object {
|
func (r *GetBigRes) Object() *object.Object {
|
||||||
return r.obj
|
return r.obj
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get reads the object from BLOB storage.
|
// GetBig reads the object from shallow dir of BLOB storage by address.
|
||||||
//
|
//
|
||||||
// Returns any error encountered that
|
// Returns any error encountered that
|
||||||
// did not allow to completely read the object part.
|
// did not allow to completely read the object.
|
||||||
func (b *BlobStor) Get(prm *GetPrm) (*GetRes, error) {
|
func (b *BlobStor) GetBig(prm *GetBigPrm) (*GetBigRes, error) {
|
||||||
b.mtx.RLock()
|
b.mtx.RLock()
|
||||||
defer b.mtx.RUnlock()
|
defer b.mtx.RUnlock()
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ func (b *BlobStor) Get(prm *GetPrm) (*GetRes, error) {
|
||||||
return nil, errors.Wrap(err, "could not unmarshal the object")
|
return nil, errors.Wrap(err, "could not unmarshal the object")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &GetRes{
|
return &GetBigRes{
|
||||||
obj: obj,
|
obj: obj,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
|
@ -77,8 +77,8 @@ func (s *Shard) Get(prm *GetPrm) (*GetRes, error) {
|
||||||
if prm.ln < 0 {
|
if prm.ln < 0 {
|
||||||
// try to read from WriteCache
|
// try to read from WriteCache
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
res, err := s.blobStor.Get(
|
res, err := s.blobStor.GetBig(
|
||||||
new(blobstor.GetPrm).
|
new(blobstor.GetBigPrm).
|
||||||
WithAddress(prm.addr),
|
WithAddress(prm.addr),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue