From 3ceebdcc4af99e8b5f2e18b0c4de0369bc53d41f Mon Sep 17 00:00:00 2001 From: Darren Dowker Date: Wed, 5 Jun 2024 14:20:57 -0700 Subject: [PATCH] copy more missing code --- broker/client/reader.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/broker/client/reader.go b/broker/client/reader.go index ec25a99c..fe0f39fd 100644 --- a/broker/client/reader.go +++ b/broker/client/reader.go @@ -12,12 +12,14 @@ import ( "sync" "cloud.google.com/go/storage" + "github.com/gorilla/schema" "github.com/prometheus/client_golang/prometheus" log "github.com/sirupsen/logrus" "go.gazette.dev/core/broker/codecs" pb "go.gazette.dev/core/broker/protocol" "golang.org/x/oauth2/google" "golang.org/x/oauth2/jwt" + "google.golang.org/api/option" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -446,6 +448,12 @@ type gcsBackend struct { client *storage.Client clientMu sync.Mutex } +type GSStoreConfig struct { + bucket string + prefix string + + RewriterConfig +} // Arize Open routine with offset for use with consumers and signed URLs. func (s *gcsBackend) openWithOffset(ctx context.Context, ep *url.URL, fragment pb.Fragment, offset int64) (io.ReadCloser, error) { @@ -514,3 +522,15 @@ func (s *gcsBackend) gcsClient(ep *url.URL) (cfg GSStoreConfig, client *storage. return } + +func parseStoreArgs(ep *url.URL, args interface{}) error { + var decoder = schema.NewDecoder() + decoder.IgnoreUnknownKeys(false) + + if q, err := url.ParseQuery(ep.RawQuery); err != nil { + return err + } else if err = decoder.Decode(args, q); err != nil { + return fmt.Errorf("parsing store URL arguments: %s", err) + } + return nil +}