dataprovider

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package dataprovider is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedStorageProvider = errors.New("unsupported storage provider")
	ErrStorageNotFound            = errors.New("storage provider not found")
)

Functions

func InitETCDClient

func InitETCDClient(ctx context.Context, opt StorageProviderOptions, _ string) (store.StorageClient, error)

InitETCDClient checks if the ETCD client is in memory and if the client is not nil, then it initializes the storage client and returns an ETCDClient. If either of these conditions are not met, an error is returned.

Types

type APIServerOptions

type APIServerOptions struct {
	// Context configures the Kubernetes context name to use for the connection. Use this for NON-production scenarios to test
	// against a specific cluster.
	Context string `yaml:"context"`

	// Namespace configures the Kubernetes namespace used for data-storage. The namespace must already exist.
	Namespace string `yaml:"namespace"`
}

APIServerOptions represents options for the configuring the Kubernetes APIServer store.

type CosmosDBOptions

type CosmosDBOptions struct {
	Url                  string `yaml:"url"`
	Database             string `yaml:"database"`
	MasterKey            string `yaml:"masterKey"`
	CollectionThroughput int    `yaml:"collectionThroughput,omitempty"`
}

CosmosDBOptions represents cosmosdb options for data storage provider.

type DataStorageProvider

type DataStorageProvider interface {
	// GetStorageClient creates or gets storage client.
	GetStorageClient(context.Context, string) (store.StorageClient, error)
}

DataStorageProvider is an interfae to provide storage client.

func NewStorageProvider

func NewStorageProvider(opts StorageProviderOptions) DataStorageProvider

NewStorageProvider creates a new instance of the "storageProvider" struct with the given "StorageProviderOptions" and returns it.

type ETCDOptions

type ETCDOptions struct {
	// InMemory configures the etcd store to run in-memory with the resource provider. This is not suitable for production use.
	InMemory bool `yaml:"inmemory"`

	// Client is used to access the etcd client when running in memory.
	//
	// NOTE: when we run etcd in memory it will be registered as its own hosting.Service with its own startup/shutdown lifecyle.
	// We need a way to share state between the etcd service and the things that want to consume it. This is that.
	Client *hosting.AsyncValue[etcdclient.Client] `yaml:"-"`
}

ETCDOptions represents options for the configuring the etcd store.

type MockDataStorageProvider

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

MockDataStorageProvider is a mock of DataStorageProvider interface.

func NewMockDataStorageProvider

func NewMockDataStorageProvider(ctrl *gomock.Controller) *MockDataStorageProvider

NewMockDataStorageProvider creates a new mock instance.

func (*MockDataStorageProvider) EXPECT

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

func (*MockDataStorageProvider) GetStorageClient

func (m *MockDataStorageProvider) GetStorageClient(arg0 context.Context, arg1 string) (store.StorageClient, error)

GetStorageClient mocks base method.

type MockDataStorageProviderMockRecorder

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

MockDataStorageProviderMockRecorder is the mock recorder for MockDataStorageProvider.

func (*MockDataStorageProviderMockRecorder) GetStorageClient

func (mr *MockDataStorageProviderMockRecorder) GetStorageClient(arg0, arg1 interface{}) *gomock.Call

GetStorageClient indicates an expected call of GetStorageClient.

type StorageProviderOptions

type StorageProviderOptions struct {
	// Provider configures the storage provider.
	Provider StorageProviderType `yaml:"provider"`

	// APIServer configures options for the Kubernetes APIServer store. Will be ignored if another store is configured.
	APIServer APIServerOptions `yaml:"apiserver,omitempty"`

	// CosmosDB configures options for the CosmosDB store. Will be ignored if another store is configured.
	CosmosDB CosmosDBOptions `yaml:"cosmosdb,omitempty"`

	// ETCD configures options for the etcd store. Will be ignored if another store is configured.
	ETCD ETCDOptions `yaml:"etcd,omitempty"`
}

StorageProviderOptions represents the data storage provider options.

type StorageProviderType

type StorageProviderType string

StorageProviderType represents types of storage provider.

const (
	// TypeAPIServer represents the Kubernetes APIServer provider.
	TypeAPIServer StorageProviderType = "apiserver"

	// TypeCosmosDB represents CosmosDB provider.
	TypeCosmosDB StorageProviderType = "cosmosdb"

	// TypeETCD represents the etcd provider.
	TypeETCD StorageProviderType = "etcd"
)

Jump to

Keyboard shortcuts

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