mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
neofs: add ObjectSearchInitter
With ObjectSearchInitter ObjectSearch can can be done by both NeoFS SDK client and pool. Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
86ed214e8a
commit
2435484dc4
1 changed files with 7 additions and 2 deletions
|
@ -236,8 +236,13 @@ func parseRange(s string) (*object.Range, error) {
|
|||
return r, nil
|
||||
}
|
||||
|
||||
// ObjectSearchInitter defines the interface for initializing object search.
|
||||
type ObjectSearchInitter interface {
|
||||
ObjectSearchInit(ctx context.Context, containerID cid.ID, s user.Signer, prm client.PrmObjectSearch) (*client.ObjectListReader, error)
|
||||
}
|
||||
|
||||
// ObjectSearch returns a list of object IDs from the provided container.
|
||||
func ObjectSearch(ctx context.Context, c *client.Client, priv *keys.PrivateKey, containerIDStr string, prm client.PrmObjectSearch) ([]oid.ID, error) {
|
||||
func ObjectSearch(ctx context.Context, initter ObjectSearchInitter, priv *keys.PrivateKey, containerIDStr string, prm client.PrmObjectSearch) ([]oid.ID, error) {
|
||||
var (
|
||||
s = user.NewAutoIDSignerRFC6979(priv.PrivateKey)
|
||||
objectIDs []oid.ID
|
||||
|
@ -247,7 +252,7 @@ func ObjectSearch(ctx context.Context, c *client.Client, priv *keys.PrivateKey,
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrInvalidContainer, err)
|
||||
}
|
||||
reader, err := c.ObjectSearchInit(ctx, containerID, s, prm)
|
||||
reader, err := initter.ObjectSearchInit(ctx, containerID, s, prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to initiate object search: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue