gcs

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRange = errors.New("invalid range")
)

Functions

This section is empty.

Types

type BucketHandle

type BucketHandle interface {
	Object(string) ObjectHandle
	Attrs(context.Context) (*storage.BucketAttrs, error)
}

type ObjectHandle

type ObjectHandle interface {
	NewReader(ctx context.Context) (Reader, error)
	NewRangeReader(ctx context.Context, offset, length int64) (Reader, error)
	Attrs(ctx context.Context) (attrs *storage.ObjectAttrs, err error)
}

type Options

type Options struct {
	// BucketName represents the name of the bucket
	BucketName string
	// CredentialsJSON holds the json data for credentials of a service account
	CredentialsJSON []byte
	// Client can be used to specify a heimdall.Client with hystrix like circuit breaker
	Client heimdall.Client
}

Options represents the Google Cloud Storage storage options

type Reader

type Reader interface {
	io.ReadCloser
}

type Storage

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

Storage holds the fields used by Google Cloud Storage implementation

func NewStorage

func NewStorage(opts Options) (*Storage, error)

NewStorage returns a new gcs.Storage instance

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, path string) storage.IResponse

Get takes in the Context and path as an argument and returns an IResponse interface implementation. This method figures out how to get the data from the S3 storage backend.

func (*Storage) GetPartially

GetPartially takes in the Context, path and opt as an argument and returns an IResponse interface implementation. This method figures out how to get partial data from the S3 storage backend.

Jump to

Keyboard shortcuts

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