Documentation
¶
Overview ¶
Package utils provides utility functions
Index ¶
- Variables
- func NewClient(ctx context.Context, opts ...option.ClientOption) (*storage.Client, error)
- func ParseGCSPath(path string) (string, string, int64, error)
- func RetryBucket(client *storage.Client, name string) *storage.BucketHandle
- func RetryObject(bucket *storage.BucketHandle, name string) *storage.ObjectHandle
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidArgs = errors.New("invalid arguments") ErrOnlyGCS = errors.New("only gs:// paths are supported") ErrGenerationRequired = errors.New("generation number is required") ErrURLRequired = errors.New("URL [URL ...]: Must be specified") ErrObjectRequired = errors.New("URL must include an object name") )
var ErrInvalidGCSPath = errors.New("invalid GCS path")
Functions ¶
func NewClient ¶
NewClient creates a new GCS client using the gRPC transport. The gRPC client enables DirectPath on GCP infrastructure, routing traffic over Google's internal network for significantly higher throughput.
gRPC client metrics are disabled by default: the SDK logs a warning when it cannot find a GCP project to export telemetry to Cloud Monitoring, which is noise for a CLI tool. Callers that want metrics can pass their own meterProvider via storage options.
func ParseGCSPath ¶
ParseGCSPath parses a GCS path of the form "gs://bucket/object[#generation]" and returns the bucket, object, and generation.
func RetryBucket ¶
func RetryBucket(client *storage.Client, name string) *storage.BucketHandle
RetryBucket returns a BucketHandle with RetryAlways policy.
func RetryObject ¶
func RetryObject(bucket *storage.BucketHandle, name string) *storage.ObjectHandle
RetryObject returns an ObjectHandle with RetryAlways policy.
Types ¶
This section is empty.