Use containersOf in neofs-adm #200

Merged
fyrchik merged 2 commits from fyrchik/frostfs-node:fix-containers-of into master 2023-04-04 07:26:24 +00:00
Owner

Fix (partially) #175.

Fix (partially) #175.
fyrchik added 1 commit 2023-04-03 11:47:38 +00:00
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
acid-ant approved these changes 2023-04-03 13:22:42 +00:00
dstepanov-yadro requested changes 2023-04-03 14:20:18 +00:00
@ -117,3 +125,3 @@
}
out, err := json.Marshal(containers)
_, err = f.Write([]byte{']'})

If written = 0, then only one parenthesis will go to the file?

If written = 0, then only one parenthesis will go to the file?
Author
Owner

Fixed

Fixed
fyrchik marked this conversation as resolved
fyrchik force-pushed fix-containers-of from 7294708168 to 6e693335e1 2023-04-03 15:53:54 +00:00 Compare
dstepanov-yadro approved these changes 2023-04-03 16:58:35 +00:00
aarifullin reviewed 2023-04-03 21:59:37 +00:00
@ -113,1 +115,3 @@
cnt.EACL = ea
// Writing directly to the file is ok, because json.Encoder does no internal buffering.
if written != 0 {
_, err = f.Write([]byte{','})
Member

Just for my curiosity.
Are cnt-s big? It they are not, wouldn't be better to collect them in one slice?

var cnts []Container

and then invoke data, err := json.Marshal(&cnts) and just ioutil.WriteFile() for once?

If they are big, then yes - stream marshalling is not supported by encoding/json and the such way is needed

Just for my curiosity. Are `cnt`-s big? It they are not, wouldn't be better to collect them in one slice? ``` var cnts []Container ``` and then invoke `data, err := json.Marshal(&cnts)` and just `ioutil.WriteFile()` for once? If they are big, then yes - stream marshalling is not supported by `encoding/json` and the such way is needed
Author
Owner

It was done like this before.
We have no limits on the number of containers: there can be a lot of them and eACL can be big too (64kb is the limit, already happened in practice).

It was done like this before. We have no limits on the number of containers: there can be a lot of them and `eACL` can be big too (64kb is the limit, already happened in practice).
carpawell reviewed 2023-04-04 07:21:27 +00:00
@ -50,2 +49,2 @@
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) }()
Contributor

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)

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)
Author
Owner

That is why we ignore error.

That is why we ignore error.
Contributor

I meant that it looks like neo-go team also thinks that we can drop defer at all. But not a problem.

I meant that it looks like `neo-go` team also thinks that we can drop `defer` at all. But not a problem.
Author
Owner

It costs us (almost) nothing and neo-go internals can change any time.

It costs us (almost) nothing and neo-go internals can change any time.
carpawell marked this conversation as resolved
@ -120,0 +133,4 @@
func dumpSingleContainer(bw *io.BufBinWriter, ch util.Uint160, inv *invoker.Invoker, id []byte) (*Container, error) {
bw.Reset()
emit.AppCall(bw.BinWriter, ch, "get", callflag.All, id)
Contributor

can we use (tuned) Call here?

can we use (tuned) `Call` here?
Contributor

mean Invoker's method

mean `Invoker`'s method
Author
Owner

We can, but this PR is only about containersOf refactoring.

We can, but this PR is only about `containersOf` refactoring.
carpawell marked this conversation as resolved
carpawell approved these changes 2023-04-04 07:23:47 +00:00
fyrchik merged commit 49cc23e03c into master 2023-04-04 07:26:24 +00:00
fyrchik deleted branch fix-containers-of 2023-04-04 07:26:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#200
No description provided.