connector

package
v1.21.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package connector is a generated GoMock package.

Package connector is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBucketNotFound is non retryable 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

func NewClient(ctx context.Context, config *config.GstorageArchiver) (Client, error)

NewClient return a Temporal 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 temporal 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 MockBucketHandleWrapper added in v1.5.7

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

MockBucketHandleWrapper is a mock of BucketHandleWrapper interface.

func NewMockBucketHandleWrapper added in v1.5.7

func NewMockBucketHandleWrapper(ctrl *gomock.Controller) *MockBucketHandleWrapper

NewMockBucketHandleWrapper creates a new mock instance.

func (*MockBucketHandleWrapper) Attrs added in v1.5.7

Attrs mocks base method.

func (*MockBucketHandleWrapper) EXPECT added in v1.5.7

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBucketHandleWrapper) Object added in v1.5.7

Object mocks base method.

func (*MockBucketHandleWrapper) Objects added in v1.5.7

Objects mocks base method.

type MockBucketHandleWrapperMockRecorder added in v1.5.7

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

MockBucketHandleWrapperMockRecorder is the mock recorder for MockBucketHandleWrapper.

func (*MockBucketHandleWrapperMockRecorder) Attrs added in v1.5.7

func (mr *MockBucketHandleWrapperMockRecorder) Attrs(ctx interface{}) *gomock.Call

Attrs indicates an expected call of Attrs.

func (*MockBucketHandleWrapperMockRecorder) Object added in v1.5.7

func (mr *MockBucketHandleWrapperMockRecorder) Object(name interface{}) *gomock.Call

Object indicates an expected call of Object.

func (*MockBucketHandleWrapperMockRecorder) Objects added in v1.5.7

func (mr *MockBucketHandleWrapperMockRecorder) Objects(ctx, q interface{}) *gomock.Call

Objects indicates an expected call of Objects.

type MockClient added in v1.5.7

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

MockClient is a mock of Client interface.

func NewMockClient added in v1.5.7

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) EXPECT added in v1.5.7

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) Exist added in v1.5.7

func (m *MockClient) Exist(ctx context.Context, URI archiver.URI, fileName string) (bool, error)

Exist mocks base method.

func (*MockClient) Get added in v1.5.7

func (m *MockClient) Get(ctx context.Context, URI archiver.URI, file string) ([]byte, error)

Get mocks base method.

func (*MockClient) Query added in v1.5.7

func (m *MockClient) Query(ctx context.Context, URI archiver.URI, fileNamePrefix string) ([]string, error)

Query mocks base method.

func (*MockClient) QueryWithFilters added in v1.5.7

func (m *MockClient) QueryWithFilters(ctx context.Context, URI archiver.URI, fileNamePrefix string, pageSize, offset int, filters []Precondition) ([]string, bool, int, error)

QueryWithFilters mocks base method.

func (*MockClient) Upload added in v1.5.7

func (m *MockClient) Upload(ctx context.Context, URI archiver.URI, fileName string, file []byte) error

Upload mocks base method.

type MockClientMockRecorder added in v1.5.7

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Exist added in v1.5.7

func (mr *MockClientMockRecorder) Exist(ctx, URI, fileName interface{}) *gomock.Call

Exist indicates an expected call of Exist.

func (*MockClientMockRecorder) Get added in v1.5.7

func (mr *MockClientMockRecorder) Get(ctx, URI, file interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockClientMockRecorder) Query added in v1.5.7

func (mr *MockClientMockRecorder) Query(ctx, URI, fileNamePrefix interface{}) *gomock.Call

Query indicates an expected call of Query.

func (*MockClientMockRecorder) QueryWithFilters added in v1.5.7

func (mr *MockClientMockRecorder) QueryWithFilters(ctx, URI, fileNamePrefix, pageSize, offset, filters interface{}) *gomock.Call

QueryWithFilters indicates an expected call of QueryWithFilters.

func (*MockClientMockRecorder) Upload added in v1.5.7

func (mr *MockClientMockRecorder) Upload(ctx, URI, fileName, file interface{}) *gomock.Call

Upload indicates an expected call of Upload.

type MockGcloudStorageClient added in v1.5.7

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

MockGcloudStorageClient is a mock of GcloudStorageClient interface.

func NewMockGcloudStorageClient added in v1.5.7

func NewMockGcloudStorageClient(ctrl *gomock.Controller) *MockGcloudStorageClient

NewMockGcloudStorageClient creates a new mock instance.

func (*MockGcloudStorageClient) Bucket added in v1.5.7

Bucket mocks base method.

func (*MockGcloudStorageClient) EXPECT added in v1.5.7

EXPECT returns an object that allows the caller to indicate expected use.

type MockGcloudStorageClientMockRecorder added in v1.5.7

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

MockGcloudStorageClientMockRecorder is the mock recorder for MockGcloudStorageClient.

func (*MockGcloudStorageClientMockRecorder) Bucket added in v1.5.7

func (mr *MockGcloudStorageClientMockRecorder) Bucket(URI interface{}) *gomock.Call

Bucket indicates an expected call of Bucket.

type MockObjectHandleWrapper added in v1.5.7

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

MockObjectHandleWrapper is a mock of ObjectHandleWrapper interface.

func NewMockObjectHandleWrapper added in v1.5.7

func NewMockObjectHandleWrapper(ctrl *gomock.Controller) *MockObjectHandleWrapper

NewMockObjectHandleWrapper creates a new mock instance.

func (*MockObjectHandleWrapper) Attrs added in v1.5.7

Attrs mocks base method.

func (*MockObjectHandleWrapper) EXPECT added in v1.5.7

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockObjectHandleWrapper) NewReader added in v1.5.7

NewReader mocks base method.

func (*MockObjectHandleWrapper) NewWriter added in v1.5.7

NewWriter mocks base method.

type MockObjectHandleWrapperMockRecorder added in v1.5.7

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

MockObjectHandleWrapperMockRecorder is the mock recorder for MockObjectHandleWrapper.

func (*MockObjectHandleWrapperMockRecorder) Attrs added in v1.5.7

func (mr *MockObjectHandleWrapperMockRecorder) Attrs(ctx interface{}) *gomock.Call

Attrs indicates an expected call of Attrs.

func (*MockObjectHandleWrapperMockRecorder) NewReader added in v1.5.7

func (mr *MockObjectHandleWrapperMockRecorder) NewReader(ctx interface{}) *gomock.Call

NewReader indicates an expected call of NewReader.

func (*MockObjectHandleWrapperMockRecorder) NewWriter added in v1.5.7

func (mr *MockObjectHandleWrapperMockRecorder) NewWriter(ctx interface{}) *gomock.Call

NewWriter indicates an expected call of NewWriter.

type MockObjectIteratorWrapper added in v1.5.7

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

MockObjectIteratorWrapper is a mock of ObjectIteratorWrapper interface.

func NewMockObjectIteratorWrapper added in v1.5.7

func NewMockObjectIteratorWrapper(ctrl *gomock.Controller) *MockObjectIteratorWrapper

NewMockObjectIteratorWrapper creates a new mock instance.

func (*MockObjectIteratorWrapper) EXPECT added in v1.5.7

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockObjectIteratorWrapper) Next added in v1.5.7

Next mocks base method.

type MockObjectIteratorWrapperMockRecorder added in v1.5.7

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

MockObjectIteratorWrapperMockRecorder is the mock recorder for MockObjectIteratorWrapper.

func (*MockObjectIteratorWrapperMockRecorder) Next added in v1.5.7

Next indicates an expected call of Next.

type MockReaderWrapper added in v1.5.7

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

MockReaderWrapper is a mock of ReaderWrapper interface.

func NewMockReaderWrapper added in v1.5.7

func NewMockReaderWrapper(ctrl *gomock.Controller) *MockReaderWrapper

NewMockReaderWrapper creates a new mock instance.

func (*MockReaderWrapper) Close added in v1.5.7

func (m *MockReaderWrapper) Close() error

Close mocks base method.

func (*MockReaderWrapper) EXPECT added in v1.5.7

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockReaderWrapper) Read added in v1.5.7

func (m *MockReaderWrapper) Read(p []byte) (int, error)

Read mocks base method.

type MockReaderWrapperMockRecorder added in v1.5.7

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

MockReaderWrapperMockRecorder is the mock recorder for MockReaderWrapper.

func (*MockReaderWrapperMockRecorder) Close added in v1.5.7

Close indicates an expected call of Close.

func (*MockReaderWrapperMockRecorder) Read added in v1.5.7

func (mr *MockReaderWrapperMockRecorder) Read(p interface{}) *gomock.Call

Read indicates an expected call of Read.

type MockWriterWrapper added in v1.5.7

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

MockWriterWrapper is a mock of WriterWrapper interface.

func NewMockWriterWrapper added in v1.5.7

func NewMockWriterWrapper(ctrl *gomock.Controller) *MockWriterWrapper

NewMockWriterWrapper creates a new mock instance.

func (*MockWriterWrapper) Close added in v1.5.7

func (m *MockWriterWrapper) Close() error

Close mocks base method.

func (*MockWriterWrapper) CloseWithError added in v1.5.7

func (m *MockWriterWrapper) CloseWithError(err error) error

CloseWithError mocks base method.

func (*MockWriterWrapper) EXPECT added in v1.5.7

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockWriterWrapper) Write added in v1.5.7

func (m *MockWriterWrapper) Write(p []byte) (int, error)

Write mocks base method.

type MockWriterWrapperMockRecorder added in v1.5.7

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

MockWriterWrapperMockRecorder is the mock recorder for MockWriterWrapper.

func (*MockWriterWrapperMockRecorder) Close added in v1.5.7

Close indicates an expected call of Close.

func (*MockWriterWrapperMockRecorder) CloseWithError added in v1.5.7

func (mr *MockWriterWrapperMockRecorder) CloseWithError(err interface{}) *gomock.Call

CloseWithError indicates an expected call of CloseWithError.

func (*MockWriterWrapperMockRecorder) Write added in v1.5.7

func (mr *MockWriterWrapperMockRecorder) Write(p interface{}) *gomock.Call

Write indicates an expected call of Write.

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

type ReaderWrapper interface {
	Close() error
	Read(p []byte) (int, error)
}

ReaderWrapper is an interface that expose some methods from gcloud storage reader

type WriterWrapper

type WriterWrapper interface {
	Close() error
	Write(p []byte) (n int, err error)
	CloseWithError(err error) error
}

WriterWrapper is an interface that expose some methods from gcloud storage writer

Jump to

Keyboard shortcuts

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