Skip to content

Commit

Permalink
feat(storage): support MatchGlob for gRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
tritone committed Oct 6, 2023
1 parent af0aa1e commit 6909a10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 1 addition & 5 deletions storage/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,18 +408,14 @@ func (c *grpcStorageClient) ListObjects(ctx context.Context, bucket string, q *Q
LexicographicStart: it.query.StartOffset,
LexicographicEnd: it.query.EndOffset,
IncludeTrailingDelimiter: it.query.IncludeTrailingDelimiter,
MatchGlob: it.query.MatchGlob,
ReadMask: q.toFieldMask(), // a nil Query still results in a "*" FieldMask
}
if s.userProject != "" {
ctx = setUserProjectMetadata(ctx, s.userProject)
}
gitr := c.raw.ListObjects(it.ctx, req, s.gax...)
fetch := func(pageSize int, pageToken string) (token string, err error) {
// MatchGlob not yet supported for gRPC.
// TODO: add support when b/287306063 resolved.
if q != nil && q.MatchGlob != "" {
return "", status.Errorf(codes.Unimplemented, "MatchGlob is not supported for gRPC")
}
var objects []*storagepb.Object
err = run(it.ctx, func() error {
objects, token, err = gitr.InternalFetch(pageSize, pageToken)
Expand Down
3 changes: 1 addition & 2 deletions storage/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1294,8 +1294,7 @@ func TestIntegration_ObjectIteration(t *testing.T) {
func TestIntegration_ObjectIterationMatchGlob(t *testing.T) {
// This is a separate test from the Object Iteration test above because
// MatchGlob is not yet implemented for gRPC.
ctx := skipGRPC("https://github.com/googleapis/google-cloud-go/issues/7727")
multiTransportTest(skipJSONReads(ctx, "no reads in test"), t, func(t *testing.T, ctx context.Context, _ string, prefix string, client *Client) {
multiTransportTest(skipJSONReads(context.Background(), "no reads in test"), t, func(t *testing.T, ctx context.Context, _ string, prefix string, client *Client) {
// Reset testTime, 'cause object last modification time should be within 5 min
// from test (test iteration if -count passed) start time.
testTime = time.Now().UTC()
Expand Down

0 comments on commit 6909a10

Please sign in to comment.