utils

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package utils provides utility functions

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var ErrInvalidGCSPath = errors.New("invalid GCS path")

Functions

func NewClient

func NewClient(ctx context.Context, opts ...option.ClientOption) (*storage.Client, error)

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

func ParseGCSPath(path string) (string, string, int64, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL