forked from TrueCloudLab/frostfs-node
[#965] morph: Get rid of container.List invocations
ContainersOf() is better in almost every aspect, besides creating a session when the containers number is between 1024 and 2048 (prefetch script does limited unwrapping). Making List() private helps to ensure it is no longer used and can be safely removed in future. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
b1a1b2107d
commit
a6c9a337cd
4 changed files with 9 additions and 9 deletions
|
@ -210,7 +210,7 @@ type morphContainerReader struct {
|
|||
src containerCore.Source
|
||||
|
||||
lister interface {
|
||||
List(*user.ID) ([]cid.ID, error)
|
||||
ContainersOf(*user.ID) ([]cid.ID, error)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,8 +226,8 @@ func (x *morphContainerReader) GetEACL(id cid.ID) (*containerCore.EACL, error) {
|
|||
return x.eacl.GetEACL(id)
|
||||
}
|
||||
|
||||
func (x *morphContainerReader) List(id *user.ID) ([]cid.ID, error) {
|
||||
return x.lister.List(id)
|
||||
func (x *morphContainerReader) ContainersOf(id *user.ID) ([]cid.ID, error) {
|
||||
return x.lister.ContainersOf(id)
|
||||
}
|
||||
|
||||
type morphContainerWriter struct {
|
||||
|
|
|
@ -53,7 +53,7 @@ func (c *Client) ContainersOf(idUser *user.ID) ([]cid.ID, error) {
|
|||
err := c.client.Morph().TestInvokeIterator(cb, batchSize, cnrHash, containersOfMethod, rawID)
|
||||
if err != nil {
|
||||
if errors.Is(err, unwrap.ErrNoSessionID) {
|
||||
return c.List(idUser)
|
||||
return c.list(idUser)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -8,13 +8,13 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||
)
|
||||
|
||||
// List returns a list of container identifiers belonging
|
||||
// list returns a list of container identifiers belonging
|
||||
// to the specified user of FrostFS system. The list is composed
|
||||
// through Container contract call.
|
||||
//
|
||||
// Returns the identifiers of all FrostFS containers if pointer
|
||||
// to user identifier is nil.
|
||||
func (c *Client) List(idUser *user.ID) ([]cid.ID, error) {
|
||||
func (c *Client) list(idUser *user.ID) ([]cid.ID, error) {
|
||||
var rawID []byte
|
||||
|
||||
if idUser != nil {
|
||||
|
|
|
@ -26,10 +26,10 @@ type Reader interface {
|
|||
containercore.Source
|
||||
containercore.EACLSource
|
||||
|
||||
// List returns a list of container identifiers belonging
|
||||
// ContainersOf returns a list of container identifiers belonging
|
||||
// to the specified user of FrostFS system. Returns the identifiers
|
||||
// of all FrostFS containers if pointer to owner identifier is nil.
|
||||
List(*user.ID) ([]cid.ID, error)
|
||||
ContainersOf(*user.ID) ([]cid.ID, error)
|
||||
}
|
||||
|
||||
// Writer is an interface of container storage updater.
|
||||
|
@ -187,7 +187,7 @@ func (s *morphExecutor) List(_ context.Context, body *container.ListRequestBody)
|
|||
return nil, fmt.Errorf("invalid user ID: %w", err)
|
||||
}
|
||||
|
||||
cnrs, err := s.rdr.List(&id)
|
||||
cnrs, err := s.rdr.ContainersOf(&id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue