blob

package
v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	// contains filtered or unexported fields
}

Bucket wraps a blob.Bucket with functionality for implementing the drivers.ObjectStore interface. NOTE: It currently only supports listing objects, but eventually we should refactor NewIterator to a member function of this struct.

func NewBucket

func NewBucket(bucket *blob.Bucket, logger *zap.Logger) (*Bucket, error)

NewBucket wraps a *blob.Bucket. It takes ownership of the bucket and will close it when Close is called.

func (*Bucket) Close

func (b *Bucket) Close() error

Close the underlying bucket.

func (*Bucket) Download

func (b *Bucket) Download(ctx context.Context, opts *DownloadOptions) (res drivers.FileIterator, resErr error)

Download returns an iterator for downloading objects matching a glob pattern. The downloaded objects will be stored in a temporary directory with the same file hierarchy the bucket, enabling parsing of hive partitioning on the downloaded files. The client should call Close() once done to release all resources. Calling Close() on the iterator will also close the bucket.

func (*Bucket) ListObjects

func (b *Bucket) ListObjects(ctx context.Context, path, delimiter string, pageSize uint32, pageToken string) ([]drivers.ObjectStoreEntry, string, error)

func (*Bucket) ListObjectsForGlob added in v0.78.0

func (b *Bucket) ListObjectsForGlob(ctx context.Context, glob string) ([]drivers.ObjectStoreEntry, error)

ListObjectsForGlob lists objects in the bucket that match the given glob pattern. The glob pattern should be a valid path *without* scheme or bucket name. E.g. to list gs://my-bucket/path/to/files/*, the glob pattern should be "path/to/files/*".

func (*Bucket) Underlying

func (b *Bucket) Underlying() *blob.Bucket

Underlying returns the underlying *blob.Bucket.

type DownloadOptions

type DownloadOptions struct {
	// Glob is the pattern to match files in the bucket
	Glob string
	// Format is the format of the files (e.g. "csv", "json", "parquet")
	Format string
	// TempDir where temporary files should be stored
	TempDir string
	// KeepFilesUntilClose if true, files will not be deleted until Close() is called.
	KeepFilesUntilClose bool
	// BatchSizeBytes is the size of the batch to download before sending it to the client.
	BatchSizeBytes int64
	// CloseBucket will close the bucket when the iterator is closed.
	CloseBucket bool
}

Options for Download

Jump to

Keyboard shortcuts

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