morph: Get rid of container.List invocations #965

Merged
fyrchik merged 1 commit from fyrchik/frostfs-node:fix-morph into master 2024-02-07 08:56:29 +00:00
4 changed files with 9 additions and 9 deletions

View file

@ -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 {

View file

@ -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
}

View file

@ -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 {

View file

@ -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
}