gcsutil

package
v0.0.0-...-2148625 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Overview

Package gcsutil provides tools for accessing Google Cloud Storage until they can be completely replaced by cloud.google.com/go/storage.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRange = errors.New("gcsutil: requested range not satisfiable")

ErrInvalidRange is used when the server has returned http.StatusRequestedRangeNotSatisfiable.

Functions

func EnumerateObjects

func EnumerateObjects(ctx context.Context, bucket, after string, limit int) ([]*storage.ObjectAttrs, error)

EnumerateObjects lists the objects in a bucket. This function relies on the ctx oauth2.HTTPClient value being set to an OAuth2 authorized and authenticated HTTP client. If after is non-empty, listing will begin with lexically greater object names. If limit is non-zero, the length of the list will be limited to that number.

func GetPartialObject

func GetPartialObject(ctx context.Context, obj Object, offset, length int64) (io.ReadCloser, error)

GetPartialObject fetches part of a Google Cloud Storage object. This function relies on the ctx ctxutil.HTTPClient value being set to an OAuth2 authorized and authenticated HTTP client. If length is negative, the rest of the object is returned. It returns ErrInvalidRange if the server replies with http.StatusRequestedRangeNotSatisfiable. The caller must call Close on the returned value.

Types

type Object

type Object struct {
	Bucket string
	Key    string
}

An Object holds the name of an object (its bucket and key) within Google Cloud Storage.

func (*Object) String

func (o *Object) String() string

type SizedObject

type SizedObject struct {
	Object
	Size int64
}

A SizedObject holds the bucket, key, and size of an object.

func (SizedObject) String

func (so SizedObject) String() string

Jump to

Keyboard shortcuts

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