Documentation ¶
Overview ¶
Package dataprovider is a generated GoMock package.
Index ¶
- Variables
- func InitETCDClient(ctx context.Context, opt StorageProviderOptions, _ string) (store.StorageClient, error)
- type APIServerOptions
- type CosmosDBOptions
- type DataStorageProvider
- type ETCDOptions
- type MockDataStorageProvider
- type MockDataStorageProviderGetStorageClientCall
- func (c *MockDataStorageProviderGetStorageClientCall) Do(f func(context.Context, string) (store.StorageClient, error)) *MockDataStorageProviderGetStorageClientCall
- func (c *MockDataStorageProviderGetStorageClientCall) DoAndReturn(f func(context.Context, string) (store.StorageClient, error)) *MockDataStorageProviderGetStorageClientCall
- func (c *MockDataStorageProviderGetStorageClientCall) Return(arg0 store.StorageClient, arg1 error) *MockDataStorageProviderGetStorageClientCall
- type MockDataStorageProviderMockRecorder
- type StorageProviderOptions
- type StorageProviderType
Constants ¶
This section is empty.
Variables ¶
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 ¶
func (m *MockDataStorageProvider) EXPECT() *MockDataStorageProviderMockRecorder
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 MockDataStorageProviderGetStorageClientCall ¶ added in v0.35.0
MockDataStorageProviderGetStorageClientCall wrap *gomock.Call
func (*MockDataStorageProviderGetStorageClientCall) Do ¶ added in v0.35.0
func (c *MockDataStorageProviderGetStorageClientCall) Do(f func(context.Context, string) (store.StorageClient, error)) *MockDataStorageProviderGetStorageClientCall
Do rewrite *gomock.Call.Do
func (*MockDataStorageProviderGetStorageClientCall) DoAndReturn ¶ added in v0.35.0
func (c *MockDataStorageProviderGetStorageClientCall) DoAndReturn(f func(context.Context, string) (store.StorageClient, error)) *MockDataStorageProviderGetStorageClientCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockDataStorageProviderGetStorageClientCall) Return ¶ added in v0.35.0
func (c *MockDataStorageProviderGetStorageClientCall) Return(arg0 store.StorageClient, arg1 error) *MockDataStorageProviderGetStorageClientCall
Return rewrite *gomock.Call.Return
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 any) *MockDataStorageProviderGetStorageClientCall
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" )