forked from TrueCloudLab/frostfs-node
[#1239] neofs-cli: Use pointer-less slices for object ID
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
882236a03b
commit
dd9bd05bac
3 changed files with 8 additions and 9 deletions
|
@ -631,11 +631,11 @@ func (x *SearchObjectsPrm) SetFilters(filters object.SearchFilters) {
|
||||||
|
|
||||||
// SearchObjectsRes groups resulting values of SearchObjects operation.
|
// SearchObjectsRes groups resulting values of SearchObjects operation.
|
||||||
type SearchObjectsRes struct {
|
type SearchObjectsRes struct {
|
||||||
ids []*oidSDK.ID
|
ids []oidSDK.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// IDList returns identifiers of the matched objects.
|
// IDList returns identifiers of the matched objects.
|
||||||
func (x SearchObjectsRes) IDList() []*oidSDK.ID {
|
func (x SearchObjectsRes) IDList() []oidSDK.ID {
|
||||||
return x.ids
|
return x.ids
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,15 +671,14 @@ func SearchObjects(prm SearchObjectsPrm) (*SearchObjectsRes, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := make([]oidSDK.ID, 10)
|
buf := make([]oidSDK.ID, 10)
|
||||||
var list []*oidSDK.ID
|
var list []oidSDK.ID
|
||||||
var n int
|
var n int
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
||||||
for {
|
for {
|
||||||
n, ok = rdr.Read(buf)
|
n, ok = rdr.Read(buf)
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
v := buf[i]
|
list = append(list, buf[i])
|
||||||
list = append(list, &v)
|
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
break
|
break
|
||||||
|
|
|
@ -624,8 +624,8 @@ func searchObject(cmd *cobra.Command, _ []string) {
|
||||||
ids := res.IDList()
|
ids := res.IDList()
|
||||||
|
|
||||||
cmd.Printf("Found %d objects.\n", len(ids))
|
cmd.Printf("Found %d objects.\n", len(ids))
|
||||||
for _, id := range ids {
|
for i := range ids {
|
||||||
cmd.Println(id)
|
cmd.Println(ids[i].String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,8 +286,8 @@ func listSG(cmd *cobra.Command, _ []string) {
|
||||||
|
|
||||||
cmd.Printf("Found %d storage groups.\n", len(ids))
|
cmd.Printf("Found %d storage groups.\n", len(ids))
|
||||||
|
|
||||||
for _, id := range ids {
|
for i := range ids {
|
||||||
cmd.Println(id)
|
cmd.Println(ids[i].String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue