storage

package
v0.0.0-...-187538d Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package storage implements the storage components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AAPCentralStorage

type AAPCentralStorage interface {
	// CreateAccount creates a new account.
	CreateAccount(email string) (*azmodels.Account, error)
	// DeleteAccount deletes an account.
	DeleteAccount(accountID int64) (*azmodels.Account, error)
	// GetAllAccounts returns all accounts.
	GetAllAccounts() ([]azmodels.Account, error)
}

AAPCentralStorage is the interface for the AAP central storage.

type CentralStorage

type CentralStorage interface {
	GetAAPCentralStorage() (AAPCentralStorage, error)
}

CentralStorage is the interface for the central storage.

type ProximityStorage

type ProximityStorage any

ProximityStorage is the interface for the proximity storage.

type StorageConnector

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

StorageConnector is the storage connector.

func NewStorageConnector

func NewStorageConnector(centralStorageEngine StorageKind, proximityStorageEngine StorageKind, facatories map[StorageKind]StorageFactoryProvider) (*StorageConnector, error)

NewStorageConnector creates a new storage connector.

func (StorageConnector) GetCentralStorage

func (s StorageConnector) GetCentralStorage(runtimeCotext azruntime.RuntimeContext) (CentralStorage, error)

GetCentralStorage returns the central storage.

func (StorageConnector) GetProximityStorage

func (s StorageConnector) GetProximityStorage(runtimeCotext azruntime.RuntimeContext) (ProximityStorage, error)

GetProximityStorage returns the proximity storage.

type StorageContext

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

StorageContext is the storage context.

func NewStorageContext

func NewStorageContext(runtimeContext azruntime.RuntimeContext, storage StorageKind) (*StorageContext, error)

NewStorageContext creates a new storage context.

func (*StorageContext) GetContext

func (s *StorageContext) GetContext() context.Context

GetContext returns the context.

func (*StorageContext) GetLogMessage

func (s *StorageContext) GetLogMessage(message string) string

GetLogMessage returns a well formatted log message.

func (*StorageContext) GetLogger

func (s *StorageContext) GetLogger() *zap.Logger

GetLogger returns the logger.

func (*StorageContext) GetParentLoggerMessage

func (s *StorageContext) GetParentLoggerMessage() string

GetParentLoggerMessage returns the parent logger message.

func (*StorageContext) GetStorage

func (s *StorageContext) GetStorage() StorageKind

GetStorage returns the storage.

type StorageFactory

type StorageFactory interface {
	// CreateCentralStorage creates a central storage.
	CreateCentralStorage(storageContext *StorageContext) (CentralStorage, error)
	// CreateProximityStorage creates a proximity storage.
	CreateProximityStorage(storageContext *StorageContext) (ProximityStorage, error)
}

StorageFactory is the storage factory.

type StorageFactoryConfig

type StorageFactoryConfig interface {
	azconfigs.Configurable
}

StorageFactoryConfig is the storage factory config.

type StorageFactoryProvider

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

StorageFactoryProvider is the storage provider.

func NewStorageFactoryProvider

func NewStorageFactoryProvider(funcSvcFactCfg func() (StorageFactoryConfig, error), funcSvcFact func(StorageFactoryConfig) (StorageFactory, error)) (*StorageFactoryProvider, error)

NewStorageFactoryProvider creates a new storage factory provider.

func (StorageFactoryProvider) CreateFactory

func (p StorageFactoryProvider) CreateFactory() (StorageFactory, error)

CreateFactory creates a new factory.

func (StorageFactoryProvider) GetFactoryConfig

func (p StorageFactoryProvider) GetFactoryConfig() (StorageFactoryConfig, error)

GetFactoryConfig returns the factory configuration.

type StorageInitializer

type StorageInitializer interface {
	// GetStorages returns the active storage kinds.
	GetStorages(centralStorageEngine StorageKind, proximityStorageEngine StorageKind) []StorageKind
	// GetStoragesFactories returns the list of the required storages factories providers.
	GetStoragesFactories(centralStorageEngine StorageKind, proximityStorageEngine StorageKind) (map[StorageKind]StorageFactoryProvider, error)
}

StorageInitializer is the storage initializer.

type StorageKind

type StorageKind string

StorageKind is the type of storage.

const (
	StorageNone     StorageKind = ""
	StorageBadger   StorageKind = "BADGER"
	StoragePostgres StorageKind = "POSTGRES"
)

func NewStorageKindFromString

func NewStorageKindFromString(storage string) (StorageKind, error)

NewStorageKindFromString creates a new storage kind from a string.

func (StorageKind) Equal

func (s StorageKind) Equal(storage StorageKind) bool

Equal returns true if the storage kind is equal to the input storage kind.

func (StorageKind) IsValid

func (s StorageKind) IsValid(storages []StorageKind) bool

IsValid returns true if the storage kind is valid.

func (StorageKind) String

func (s StorageKind) String() string

String returns the string representation of the storage kind.

Jump to

Keyboard shortcuts

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