Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBucketNotFound is non retriable error that is thrown when the bucket doesn't exist ErrBucketNotFound = errors.New("bucket not found") )
Functions ¶
This section is empty.
Types ¶
type BucketHandleWrapper ¶
type BucketHandleWrapper interface { Object(name string) ObjectHandleWrapper Objects(ctx context.Context, q *storage.Query) ObjectIteratorWrapper Attrs(ctx context.Context) (*storage.BucketAttrs, error) }
BucketHandleWrapper is an interface that expose some methods from gcloud storage bucket
type Client ¶
type Client interface { Upload(ctx context.Context, URI archiver.URI, fileName string, file []byte) error Get(ctx context.Context, URI archiver.URI, file string) ([]byte, error) Query(ctx context.Context, URI archiver.URI, fileNamePrefix string) ([]string, error) QueryWithFilters(ctx context.Context, URI archiver.URI, fileNamePrefix string, pageSize, offset int, filters []Precondition) ([]string, bool, int, error) Exist(ctx context.Context, URI archiver.URI, fileName string) (bool, error) }
Client is a wrapper around Google cloud storages client library.
func NewClient ¶
NewClient return a Cadence gcloudstorage.Client based on default google service account creadentials (ScopeFullControl required). Bucket must be created by Iaas scripts, in other words, this library doesn't create the required Bucket. Optionaly you can set your credential path throught "GOOGLE_APPLICATION_CREDENTIALS" environment variable or through cadence config file. You can find more info about "Google Setting Up Authentication for Server to Server Production Applications" under the following link https://cloud.google.com/docs/authentication/production
func NewClientWithParams ¶
func NewClientWithParams(clientD GcloudStorageClient) (Client, error)
NewClientWithParams return a gcloudstorage.Client based on input parameters
type GcloudStorageClient ¶
type GcloudStorageClient interface {
Bucket(URI string) BucketHandleWrapper
}
GcloudStorageClient is an interface that expose some methods from gcloud storage client
type ObjectHandleWrapper ¶
type ObjectHandleWrapper interface { NewWriter(ctx context.Context) WriterWrapper NewReader(ctx context.Context) (ReaderWrapper, error) Attrs(ctx context.Context) (*storage.ObjectAttrs, error) }
ObjectHandleWrapper is an interface that expose some methods from gcloud storage object
type ObjectIteratorWrapper ¶
type ObjectIteratorWrapper interface {
Next() (*storage.ObjectAttrs, error)
}
ObjectIteratorWrapper is an interface that expose some methods from gcloud storage objectIterator
type Precondition ¶
type Precondition func(subject interface{}) bool
Precondition is a function that allow you to filter a query result. If subject match params conditions then return true, else return false.
type ReaderWrapper ¶
ReaderWrapper is an interface that expose some methods from gcloud storage reader