Use containersOf
in neofs-adm #200
1 changed files with 17 additions and 5 deletions
|
@ -42,15 +42,27 @@ func getContainerContractHash(cmd *cobra.Command, inv *invoker.Invoker, c Client
|
|||
}
|
||||
|
||||
func getContainersList(inv *invoker.Invoker, ch util.Uint160) ([][]byte, error) {
|
||||
res, err := inv.Call(ch, "list", "")
|
||||
sid, r, err := unwrap.SessionIterator(inv.Call(ch, "containersOf", ""))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
|
||||
}
|
||||
itm, err := unwrap.Item(res, err)
|
||||
if _, ok := itm.(stackitem.Null); !ok {
|
||||
return unwrap.ArrayOfBytes(res, err)
|
||||
// Nothing bad, except live session on the server, do not report to the user.
|
||||
defer func() { _ = inv.TerminateSession(sid) }()
|
||||
carpawell marked this conversation as resolved
|
||||
|
||||
var lst [][]byte
|
||||
|
||||
items, err := inv.TraverseIterator(sid, &r, 0)
|
||||
for err == nil && len(items) != 0 {
|
||||
for j := range items {
|
||||
b, err := items[j].TryBytes()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
|
||||
}
|
||||
lst = append(lst, b)
|
||||
}
|
||||
items, err = inv.TraverseIterator(sid, &r, 0)
|
||||
}
|
||||
return nil, nil
|
||||
return lst, err
|
||||
}
|
||||
|
||||
func dumpContainers(cmd *cobra.Command, _ []string) error {
|
||||
|
|
Loading…
Add table
Reference in a new issue
not sure exactly, but not that necessary as i remember according to my new neo-go API discoverings (4 months ago, could be wrong), actors do not do that as i remember (again, could be wrong)
That is why we ignore error.
I meant that it looks like
neo-go
team also thinks that we can dropdefer
at all. But not a problem.It costs us (almost) nothing and neo-go internals can change any time.