Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pager response design for containers and blobs should be improved #17153

Closed
kimprice opened this issue Feb 23, 2022 · 1 comment
Closed

Pager response design for containers and blobs should be improved #17153

kimprice opened this issue Feb 23, 2022 · 1 comment
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files)

Comments

@kimprice
Copy link
Contributor

kimprice commented Feb 23, 2022

This issue came up from the November Blob Storage UX study in a post discussion with @JeffreyRichter

 // EXAMPLE: List containers in a storage account
    for pager := service.ListContainers(nil); pager.NextPage(ctx); {
        // BUG: This design should be improved
        for _, con := range pager.PageResponse().ListContainersSegmentResponse.ContainerItems {
            fmt.Println(con.Name)
        }
    }

    // EXAMPLE: List blobs in a container
    for pager := container.ListBlobsFlat(nil); pager.NextPage(ctx); {
        // BUG: This design should be improved
        for _, b := range pager.PageResponse().ListBlobsFlatSegmentResponse.Segment.BlobItems {
            fmt.Println(b.Name)
        }
    }
@kimprice kimprice added the Storage Storage Service (Queues, Blobs, Files) label Feb 23, 2022
@RickWinter RickWinter added the Client This issue points to a problem in the data-plane of the library. label Feb 24, 2022
@jhendrixMSFT
Copy link
Member

We've updated azblob to use the new pattern for pagers. This is in v0.5.0.

pager := containerClient.NewListBlobsFlatPager(nil)

nameMap := testcommon.BlobListToMap(blobNames)

for pager.More() {
	resp, err := pager.NextPage(context.Background())
	// TODO: handle error

	for _, blob := range resp.Segment.BlobItems {
		// do something with blob
	}
}

@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

4 participants