container: Add ListStream method #291
No reviewers
Labels
No labels
P0
P1
P2
P3
good first issue
pool
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-sdk-go#291
Loading…
Reference in a new issue
No description provided.
Delete branch "elebedeva/frostfs-sdk-go:feat/stream-for-list"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
TrueCloudLab/frostfs-node#1452
Signed-off-by: Ekaterina Lebedeva ekaterina.lebedeva@yadro.com
d8f1cc29f5
tof85d218adc
f85d218adc
tobbf3cb9478
bbf3cb9478
toce54462437
WIP: container: Add ListStream methodto container: Add ListStream method@ -0,0 +31,4 @@
// Required parameter.
//
// Deprecated: Use PrmContainerListStream.Account instead.
func (x *PrmContainerListStream) SetAccount(id user.ID) {
You can't get deprecated the method that has never been used as it's new :) So, you don't need this setter
Removed! 🙈
@ -0,0 +79,4 @@
func (x *ContainerListReader) Read(buf []cid.ID) (int, bool) {
if len(buf) == 0 {
panic("empty buffer in ContainerListReader.ReadList")
Read
instead ofRead.List
? :)To be honest, this panic looks unnecessarily. You can define
Why do we panic or error at all?
If we remove this
if
, will the code still work?If we remove this check the list command will hang indefinitely. I believe we should keep the panic as the clear indication of incorrect passed argument.
@ -0,0 +113,4 @@
if read == len(buf) {
// save the tail
x.tail = append(x.tail, ids[ln:]...)
Optional change
That's barely possible for listing containers but if read buffer is quite small and stream is going to send a big number of containers then such accumulation in the tail may lead to overflow.
Didn't you consider?
P.S. about small buffer:
Iterate
already uses such bufferI don't see how accumulation in the tail may lead to overflow. We do exactly the same in
Object.Search
here, and it seems there's been no problem so far.@ -0,0 +22,4 @@
type PrmContainerListStream struct {
XHeaders []string
Account user.ID
Please, leave a comment how this parameter is used :)
For request building, as in existing
Container.List
I meant - to leave a comment in the code :) to describe the field. But as far as I see you fixed the field's name. So, the comment is not required
@ -0,0 +23,4 @@
XHeaders []string
Account user.ID
Maybe
Account
->OwnerID
?It should be the same as
PrmContainerList
.Please, either use
Account
or renameAccount
toOwnerID
inPrmContainerList
(in a separate commit, of course).Fixed
@ -0,0 +77,4 @@
tail []refs.ContainerID
}
func (x *ContainerListReader) Read(buf []cid.ID) (int, bool) {
int
is count of read containers. What isbool
?bool
indicates ifRead()
was successful or not.ce54462437
tocdc94cf668
@ -83,0 +96,4 @@
req *container.ListStreamRequest,
opts ...client.CallOption,
) (*ListStreamResponseReader, error) {
wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceContainer, rpcContainerStream), req, opts...)
This line is also changed in the second commit, it shouldn't be there.
Fixed
cdc94cf668
to83b26b08b9
New commits pushed, approval review dismissed automatically according to repository settings
ff8ef25438
to5e7bc0588e
LGTM
@ -2887,6 +2959,22 @@ func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid.
return cnrIDs, nil
}
// // ListContainers requests identifiers of the account-owned containers.
Please, remove one
//
Also, fix the name.
Fixed
5e7bc0588e
toc4463df8d4
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings