Documentation ¶
Overview ¶
Package storage contains logic around the Service Manager persistent storage
Index ¶
- Variables
- func NewNotificationQueue(size int) (*notificationQueue, error)
- func NewSQLHealthIndicator(pingFunc PingFunc) (health.Indicator, error)
- type CreateAroundTxInterceptor
- type CreateAroundTxInterceptorChain
- type CreateAroundTxInterceptorProvider
- type CreateInterceptor
- type CreateInterceptorChain
- type CreateInterceptorProvider
- type CreateOnTxInterceptor
- type CreateOnTxInterceptorChain
- type CreateOnTxInterceptorProvider
- type DeleteAroundTxInterceptor
- type DeleteAroundTxInterceptorChain
- type DeleteAroundTxInterceptorProvider
- type DeleteInterceptor
- type DeleteInterceptorChain
- type DeleteInterceptorProvider
- type DeleteOnTxInterceptor
- type DeleteOnTxInterceptorChain
- type DeleteOnTxInterceptorProvider
- type Entity
- type InterceptCreateAroundTxFunc
- type InterceptCreateOnTxFunc
- type InterceptDeleteAroundTxFunc
- type InterceptDeleteOnTxFunc
- type InterceptUpdateAroundTxFunc
- type InterceptUpdateOnTxFunc
- type InterceptableTransactionalRepository
- func (itr *InterceptableTransactionalRepository) AddCreateAroundTxInterceptorProvider(objectType types.ObjectType, provider CreateAroundTxInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) AddCreateInterceptorProvider(objectType types.ObjectType, provider CreateInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) AddCreateOnTxInterceptorProvider(objectType types.ObjectType, provider CreateOnTxInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) AddDeleteAroundTxInterceptorProvider(objectType types.ObjectType, provider DeleteAroundTxInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) AddDeleteInterceptorProvider(objectType types.ObjectType, provider DeleteInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) AddDeleteOnTxInterceptorProvider(objectType types.ObjectType, provider DeleteOnTxInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) AddUpdateAroundTxInterceptorProvider(objectType types.ObjectType, provider UpdateAroundTxInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) AddUpdateInterceptorProvider(objectType types.ObjectType, provider UpdateInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) AddUpdateOnTxInterceptorProvider(objectType types.ObjectType, provider UpdateOnTxInterceptorProvider, ...)
- func (itr *InterceptableTransactionalRepository) Count(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (int, error)
- func (itr *InterceptableTransactionalRepository) Create(ctx context.Context, obj types.Object) (types.Object, error)
- func (itr *InterceptableTransactionalRepository) Delete(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error)
- func (itr *InterceptableTransactionalRepository) Get(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.Object, error)
- func (itr *InterceptableTransactionalRepository) InTransaction(ctx context.Context, f func(ctx context.Context, storage Repository) error) error
- func (itr *InterceptableTransactionalRepository) List(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error)
- func (itr *InterceptableTransactionalRepository) Update(ctx context.Context, obj types.Object, labelChanges query.LabelChanges, ...) (types.Object, error)
- type InterceptorOrder
- type InterceptorPosition
- type KeyStore
- type Label
- type NotificationCleaner
- type NotificationQueue
- type NotificationSettings
- type Notificator
- type OpenCloser
- type OrderedCreateAroundTxInterceptorProvider
- type OrderedCreateInterceptorProvider
- type OrderedCreateOnTxInterceptorProvider
- type OrderedDeleteAroundTxInterceptorProvider
- type OrderedDeleteInterceptorProvider
- type OrderedDeleteOnTxInterceptorProvider
- type OrderedUpdateAroundTxInterceptorProvider
- type OrderedUpdateInterceptorProvider
- type OrderedUpdateOnTxInterceptorProvider
- type PingFunc
- type Pinger
- type PositionType
- type ReceiversFilterFunc
- type Repository
- type SQLHealthIndicator
- type Settings
- type Storage
- type TransactionalEncryptingRepository
- func (er TransactionalEncryptingRepository) Count(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (int, error)
- func (er TransactionalEncryptingRepository) Create(ctx context.Context, obj types.Object) (types.Object, error)
- func (er TransactionalEncryptingRepository) Delete(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error)
- func (er TransactionalEncryptingRepository) Get(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.Object, error)
- func (er *TransactionalEncryptingRepository) InTransaction(ctx context.Context, f func(ctx context.Context, storage Repository) error) error
- func (er TransactionalEncryptingRepository) List(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error)
- func (er TransactionalEncryptingRepository) Update(ctx context.Context, obj types.Object, labelChanges query.LabelChanges, ...) (types.Object, error)
- type TransactionalRepository
- type TransactionalRepositoryDecorator
- type UpdateAroundTxInterceptor
- type UpdateAroundTxInterceptorChain
- type UpdateAroundTxInterceptorProvider
- type UpdateInterceptor
- type UpdateInterceptorChain
- type UpdateInterceptorProvider
- type UpdateOnTxInterceptor
- type UpdateOnTxInterceptorChain
- type UpdateOnTxInterceptorProvider
Constants ¶
This section is empty.
Variables ¶
var ErrQueueClosed = errors.New("queue closed")
ErrQueueClosed error stating that the queue is closed
var ErrQueueFull = errors.New("queue is full")
ErrQueueFull error stating that the queue is full
Functions ¶
func NewNotificationQueue ¶ added in v0.3.0
NewNotificationQueue returns new NotificationQueue with specific size
Types ¶
type CreateAroundTxInterceptor ¶ added in v0.7.3
type CreateAroundTxInterceptor interface {
AroundTxCreate(f InterceptCreateAroundTxFunc) InterceptCreateAroundTxFunc
}
CreateAroundTxInterceptor provides hooks on entity creation during AroundTx
type CreateAroundTxInterceptorChain ¶ added in v0.7.3
type CreateAroundTxInterceptorChain struct {
// contains filtered or unexported fields
}
func (*CreateAroundTxInterceptorChain) AroundTxCreate ¶ added in v0.7.3
func (c *CreateAroundTxInterceptorChain) AroundTxCreate(f InterceptCreateAroundTxFunc) InterceptCreateAroundTxFunc
AroundTxCreate wraps the provided InterceptCreateAroundTxFunc into all the existing aroundTx funcs
type CreateAroundTxInterceptorProvider ¶ added in v0.7.3
type CreateAroundTxInterceptorProvider interface { web.Named Provide() CreateAroundTxInterceptor }
type CreateInterceptor ¶ added in v0.2.0
type CreateInterceptor interface { CreateAroundTxInterceptor CreateOnTxInterceptor }
CreateInterceptor provides hooks on entity creation both during AroundTx and OnTx
type CreateInterceptorChain ¶ added in v0.2.0
type CreateInterceptorChain struct { *CreateAroundTxInterceptorChain *CreateOnTxInterceptorChain }
CreateInterceptorChain is an interceptor tha provides and chains a list of ordered interceptor providers.
type CreateInterceptorProvider ¶ added in v0.2.0
type CreateInterceptorProvider interface { web.Named Provide() CreateInterceptor }
CreateInterceptorProvider provides CreateInterceptors for each request
type CreateOnTxInterceptor ¶ added in v0.7.3
type CreateOnTxInterceptor interface {
OnTxCreate(f InterceptCreateOnTxFunc) InterceptCreateOnTxFunc
}
CreateOnTxInterceptor provides hooks on entity creation during OnTx
type CreateOnTxInterceptorChain ¶ added in v0.7.3
type CreateOnTxInterceptorChain struct {
// contains filtered or unexported fields
}
func (*CreateOnTxInterceptorChain) OnTxCreate ¶ added in v0.7.3
func (c *CreateOnTxInterceptorChain) OnTxCreate(f InterceptCreateOnTxFunc) InterceptCreateOnTxFunc
OnTxCreate wraps the provided InterceptCreateOnTxFunc into all the existing onTx funcs
type CreateOnTxInterceptorProvider ¶ added in v0.7.3
type CreateOnTxInterceptorProvider interface { web.Named Provide() CreateOnTxInterceptor }
type DeleteAroundTxInterceptor ¶ added in v0.7.3
type DeleteAroundTxInterceptor interface {
AroundTxDelete(f InterceptDeleteAroundTxFunc) InterceptDeleteAroundTxFunc
}
DeleteAroundTxInterceptor provides hooks on entity deletion during AroundTx
type DeleteAroundTxInterceptorChain ¶ added in v0.7.3
type DeleteAroundTxInterceptorChain struct {
// contains filtered or unexported fields
}
func (*DeleteAroundTxInterceptorChain) AroundTxDelete ¶ added in v0.7.3
func (c *DeleteAroundTxInterceptorChain) AroundTxDelete(f InterceptDeleteAroundTxFunc) InterceptDeleteAroundTxFunc
AroundTxDelete wraps the provided InterceptDeleteAroundTxFunc into all the existing aroundTx funcs
type DeleteAroundTxInterceptorProvider ¶ added in v0.7.3
type DeleteAroundTxInterceptorProvider interface { web.Named Provide() DeleteAroundTxInterceptor }
type DeleteInterceptor ¶ added in v0.2.0
type DeleteInterceptor interface { DeleteAroundTxInterceptor DeleteOnTxInterceptor }
DeleteInterceptor provides hooks on entity deletion both during AroundTx and OnTx
type DeleteInterceptorChain ¶ added in v0.2.0
type DeleteInterceptorChain struct { *DeleteAroundTxInterceptorChain *DeleteOnTxInterceptorChain }
DeleteInterceptorChain is an interceptor tha provides and chains a list of ordered interceptor providers.
type DeleteInterceptorProvider ¶ added in v0.2.0
type DeleteInterceptorProvider interface { web.Named Provide() DeleteInterceptor }
DeleteInterceptorProvider provides DeleteInterceptors for each request
type DeleteOnTxInterceptor ¶ added in v0.7.3
type DeleteOnTxInterceptor interface {
OnTxDelete(f InterceptDeleteOnTxFunc) InterceptDeleteOnTxFunc
}
DeleteOnTxInterceptor provides hooks on entity deletion during OnTx
type DeleteOnTxInterceptorChain ¶ added in v0.7.3
type DeleteOnTxInterceptorChain struct {
// contains filtered or unexported fields
}
func (*DeleteOnTxInterceptorChain) OnTxDelete ¶ added in v0.7.3
func (c *DeleteOnTxInterceptorChain) OnTxDelete(f InterceptDeleteOnTxFunc) InterceptDeleteOnTxFunc
OnTxDelete wraps the provided InterceptDeleteOnTxFunc into all the existing onTx funcs
type DeleteOnTxInterceptorProvider ¶ added in v0.7.3
type DeleteOnTxInterceptorProvider interface { web.Named Provide() DeleteOnTxInterceptor }
type InterceptCreateAroundTxFunc ¶ added in v0.2.0
InterceptCreateAroundTxFunc hook for entity creation outside of transaction
type InterceptCreateOnTxFunc ¶ added in v0.2.0
type InterceptCreateOnTxFunc func(ctx context.Context, txStorage Repository, obj types.Object) (types.Object, error)
InterceptCreateOnTxFunc hook for entity creation in transaction
type InterceptDeleteAroundTxFunc ¶ added in v0.2.0
type InterceptDeleteAroundTxFunc func(ctx context.Context, deletionCriteria ...query.Criterion) (types.ObjectList, error)
InterceptDeleteAroundTxFunc hook for entity deletion outside of transaction
type InterceptDeleteOnTxFunc ¶ added in v0.2.0
type InterceptDeleteOnTxFunc func(ctx context.Context, txStorage Repository, objects types.ObjectList, deletionCriteria ...query.Criterion) (types.ObjectList, error)
InterceptDeleteOnTxFunc hook for entity deletion in transaction
type InterceptUpdateAroundTxFunc ¶ added in v0.2.0
type InterceptUpdateAroundTxFunc func(ctx context.Context, newObj types.Object, labelChanges ...*query.LabelChange) (types.Object, error)
InterceptUpdateAroundTxFunc hook for entity update outside of transaction
type InterceptUpdateOnTxFunc ¶ added in v0.2.0
type InterceptUpdateOnTxFunc func(ctx context.Context, txStorage Repository, oldObj, newObj types.Object, labelChanges ...*query.LabelChange) (types.Object, error)
InterceptUpdateOnTxFunc hook for entity update in transaction
type InterceptableTransactionalRepository ¶ added in v0.2.0
type InterceptableTransactionalRepository struct {
// contains filtered or unexported fields
}
func NewInterceptableTransactionalRepository ¶ added in v0.2.0
func NewInterceptableTransactionalRepository(repository TransactionalRepository) *InterceptableTransactionalRepository
func (*InterceptableTransactionalRepository) AddCreateAroundTxInterceptorProvider ¶ added in v0.7.3
func (itr *InterceptableTransactionalRepository) AddCreateAroundTxInterceptorProvider(objectType types.ObjectType, provider CreateAroundTxInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) AddCreateInterceptorProvider ¶ added in v0.2.0
func (itr *InterceptableTransactionalRepository) AddCreateInterceptorProvider(objectType types.ObjectType, provider CreateInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) AddCreateOnTxInterceptorProvider ¶ added in v0.7.3
func (itr *InterceptableTransactionalRepository) AddCreateOnTxInterceptorProvider(objectType types.ObjectType, provider CreateOnTxInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) AddDeleteAroundTxInterceptorProvider ¶ added in v0.7.3
func (itr *InterceptableTransactionalRepository) AddDeleteAroundTxInterceptorProvider(objectType types.ObjectType, provider DeleteAroundTxInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) AddDeleteInterceptorProvider ¶ added in v0.2.0
func (itr *InterceptableTransactionalRepository) AddDeleteInterceptorProvider(objectType types.ObjectType, provider DeleteInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) AddDeleteOnTxInterceptorProvider ¶ added in v0.7.3
func (itr *InterceptableTransactionalRepository) AddDeleteOnTxInterceptorProvider(objectType types.ObjectType, provider DeleteOnTxInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) AddUpdateAroundTxInterceptorProvider ¶ added in v0.7.3
func (itr *InterceptableTransactionalRepository) AddUpdateAroundTxInterceptorProvider(objectType types.ObjectType, provider UpdateAroundTxInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) AddUpdateInterceptorProvider ¶ added in v0.2.0
func (itr *InterceptableTransactionalRepository) AddUpdateInterceptorProvider(objectType types.ObjectType, provider UpdateInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) AddUpdateOnTxInterceptorProvider ¶ added in v0.7.3
func (itr *InterceptableTransactionalRepository) AddUpdateOnTxInterceptorProvider(objectType types.ObjectType, provider UpdateOnTxInterceptorProvider, order InterceptorOrder)
func (*InterceptableTransactionalRepository) Count ¶ added in v0.6.0
func (itr *InterceptableTransactionalRepository) Count(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (int, error)
func (*InterceptableTransactionalRepository) Delete ¶ added in v0.2.0
func (itr *InterceptableTransactionalRepository) Delete(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error)
func (*InterceptableTransactionalRepository) Get ¶ added in v0.2.0
func (itr *InterceptableTransactionalRepository) Get(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.Object, error)
func (*InterceptableTransactionalRepository) InTransaction ¶ added in v0.2.0
func (itr *InterceptableTransactionalRepository) InTransaction(ctx context.Context, f func(ctx context.Context, storage Repository) error) error
func (*InterceptableTransactionalRepository) List ¶ added in v0.2.0
func (itr *InterceptableTransactionalRepository) List(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error)
type InterceptorOrder ¶ added in v0.2.0
type InterceptorOrder struct { OnTxPosition InterceptorPosition AroundTxPosition InterceptorPosition }
type InterceptorPosition ¶ added in v0.2.0
type InterceptorPosition struct { PositionType PositionType Name string }
type KeyStore ¶ added in v0.3.3
type KeyStore interface { // Lock locks the storage so that only one process can manipulate the encryption key. Returns an error if the process has already acquired the lock Lock(ctx context.Context) error // Unlock releases the acquired lock. Unlock(ctx context.Context) error // GetEncryptionKey returns the encryption key from the storage after applying the specified transformation function GetEncryptionKey(ctx context.Context, transformationFunc func(context.Context, []byte, []byte) ([]byte, error)) ([]byte, error) // SetEncryptionKey sets the provided encryption key in the KeyStore after applying the specified transformation function SetEncryptionKey(ctx context.Context, key []byte, transformationFunc func(context.Context, []byte, []byte) ([]byte, error)) error }
KeyStore interface for encryption key operations
type NotificationCleaner ¶ added in v0.3.0
type NotificationCleaner struct { Storage Repository Settings Settings // contains filtered or unexported fields }
NotificationCleaner schedules a go routine which cleans old notifications
type NotificationQueue ¶ added in v0.3.0
type NotificationQueue interface { // Enqueue adds a new notification for processing. Enqueue(notification *types.Notification) error // Channel returns the go channel with received notifications which has to be processed. Channel() <-chan *types.Notification // Close closes the queue. Close() // ID returns unique queue identifier ID() string }
NotificationQueue is used for receiving notifications
type NotificationSettings ¶ added in v0.3.0
type NotificationSettings struct { QueuesSize int `mapstructure:"queues_size" description:"maximum number of notifications queued for sending to a client"` MinReconnectInterval time.Duration `mapstructure:"min_reconnect_interval" description:"minimum timeout between storage listen reconnects"` MaxReconnectInterval time.Duration `mapstructure:"max_reconnect_interval" description:"maximum timeout between storage listen reconnects"` CleanInterval time.Duration `mapstructure:"clean_interval" description:"time between notification clean-up"` KeepFor time.Duration `mapstructure:"keep_for" description:"the time to keep a notification in the storage"` }
NotificationSettings type to be loaded from the environment
func DefaultNotificationSettings ¶ added in v0.3.0
func DefaultNotificationSettings() *NotificationSettings
DefaultNotificationSettings returns default values for Notificator settings
func (*NotificationSettings) Validate ¶ added in v0.3.0
func (s *NotificationSettings) Validate() error
Validate validates the Notification settings
type Notificator ¶ added in v0.3.0
type Notificator interface { // Start starts the Notificator Start(ctx context.Context, group *sync.WaitGroup) error // RegisterConsumer returns notification queue, last_known_revision and error if any. // Notifications after lastKnownRevision will be added to the queue. // If lastKnownRevision is -1 no previous notifications will be sent. // When consumer wants to stop listening for notifications it must unregister the notification queue. RegisterConsumer(consumer *types.Platform, lastKnownRevision int64) (NotificationQueue, int64, error) // UnregisterConsumer must be called to stop receiving notifications in the queue UnregisterConsumer(queue NotificationQueue) error // RegisterFilter adds a new filter which decides if a platform should receive given notification RegisterFilter(f ReceiversFilterFunc) }
Notificator is used for receiving notifications for SM events
type OpenCloser ¶ added in v0.1.2
type OpenCloser interface { // Open initializes the storage, e.g. opens a connection to the underlying storage Open(options *Settings) error // Close clears resources associated with this storage, e.g. closes the connection the underlying storage Close() error }
OpenCloser represents an openable and closeable storage
type OrderedCreateAroundTxInterceptorProvider ¶ added in v0.7.3
type OrderedCreateAroundTxInterceptorProvider struct { InterceptorOrder CreateAroundTxInterceptorProvider }
type OrderedCreateInterceptorProvider ¶ added in v0.2.0
type OrderedCreateInterceptorProvider struct { InterceptorOrder CreateInterceptorProvider }
type OrderedCreateOnTxInterceptorProvider ¶ added in v0.7.3
type OrderedCreateOnTxInterceptorProvider struct { InterceptorOrder CreateOnTxInterceptorProvider }
type OrderedDeleteAroundTxInterceptorProvider ¶ added in v0.7.3
type OrderedDeleteAroundTxInterceptorProvider struct { InterceptorOrder DeleteAroundTxInterceptorProvider }
type OrderedDeleteInterceptorProvider ¶ added in v0.2.0
type OrderedDeleteInterceptorProvider struct { InterceptorOrder DeleteInterceptorProvider }
type OrderedDeleteOnTxInterceptorProvider ¶ added in v0.7.3
type OrderedDeleteOnTxInterceptorProvider struct { InterceptorOrder DeleteOnTxInterceptorProvider }
type OrderedUpdateAroundTxInterceptorProvider ¶ added in v0.7.3
type OrderedUpdateAroundTxInterceptorProvider struct { InterceptorOrder UpdateAroundTxInterceptorProvider }
type OrderedUpdateInterceptorProvider ¶ added in v0.2.0
type OrderedUpdateInterceptorProvider struct { InterceptorOrder UpdateInterceptorProvider }
type OrderedUpdateOnTxInterceptorProvider ¶ added in v0.7.3
type OrderedUpdateOnTxInterceptorProvider struct { InterceptorOrder UpdateOnTxInterceptorProvider }
type PingFunc ¶ added in v0.1.2
PingFunc is an adapter that allows to use regular functions as Pinger
type Pinger ¶ added in v0.1.2
type Pinger interface { // PingContext verifies a connection to the database is still alive, establishing a connection if necessary. PingContext(context.Context) error }
Pinger allows pinging the storage to check liveliness
type PositionType ¶ added in v0.2.0
type PositionType int
PositionType could be "before", "after" or "none"
const ( // PositionNone states that a position is not set and the item will be appended PositionNone PositionType = iota // PositionBefore states that a position should be calculated before another position PositionBefore // PositionAfter states that a position should be calculated after another position PositionAfter )
type ReceiversFilterFunc ¶ added in v0.3.3
type ReceiversFilterFunc func(recipients []*types.Platform, notification *types.Notification) (filteredRecipients []*types.Platform)
ReceiversFilterFunc filters recipients for a given notifications
type Repository ¶ added in v0.1.2
type Repository interface { // Create stores an object in SM DB Create(ctx context.Context, obj types.Object) (types.Object, error) // Get retrieves an object using the provided id from SM DB Get(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.Object, error) // List retrieves all object from SM DB List(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error) // Count retrieves number of objects of particular type in SM DB Count(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (int, error) // Delete deletes an object from SM DB Delete(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error) // Update updates an object from SM DB Update(ctx context.Context, obj types.Object, labelChanges query.LabelChanges, criteria ...query.Criterion) (types.Object, error) }
type SQLHealthIndicator ¶ added in v0.5.0
SQLHealthIndicator returns a new indicator for SQL storage
func (*SQLHealthIndicator) Name ¶ added in v0.5.0
func (i *SQLHealthIndicator) Name() string
Name returns the name of the storage component
type Settings ¶
type Settings struct { URI string `mapstructure:"uri" description:"URI of the storage"` MigrationsURL string `mapstructure:"migrations_url" description:"location of a directory containing sql migrations scripts"` EncryptionKey string `mapstructure:"encryption_key" description:"key to use for encrypting database entries"` SkipSSLValidation bool `mapstructure:"skip_ssl_validation" description:"whether to skip ssl verification when connecting to the storage"` MaxIdleConnections int `mapstructure:"max_idle_connections" description:"sets the maximum number of connections in the idle connection pool"` Notification *NotificationSettings `mapstructure:"notification"` }
Settings type to be loaded from the environment
func DefaultSettings ¶
func DefaultSettings() *Settings
DefaultSettings returns default values for storage settings
type Storage ¶
type Storage interface { OpenCloser TransactionalRepository Pinger Introduce(entity Entity) }
Storage interface provides entity-specific storages
type TransactionalEncryptingRepository ¶ added in v0.3.3
type TransactionalEncryptingRepository struct {
// contains filtered or unexported fields
}
TransactionalEncryptingRepository is a TransactionalRepository with that also encrypts credentials of Secured objects before storing in the database them and decrypts credentials of Secured objects when reading them from the database
func NewEncryptingRepository ¶ added in v0.3.3
func NewEncryptingRepository(repository TransactionalRepository, encrypter security.Encrypter, key []byte) (*TransactionalEncryptingRepository, error)
NewEncryptingRepository creates a new TransactionalEncryptingRepository using the specified encrypter and encryption key
func (TransactionalEncryptingRepository) Delete ¶ added in v0.3.3
func (er TransactionalEncryptingRepository) Delete(ctx context.Context, objectType types.ObjectType, criteria ...query.Criterion) (types.ObjectList, error)
func (*TransactionalEncryptingRepository) InTransaction ¶ added in v0.3.3
func (er *TransactionalEncryptingRepository) InTransaction(ctx context.Context, f func(ctx context.Context, storage Repository) error) error
InTransaction wraps repository passed in the transaction to also encypt/decrypt credentials
type TransactionalRepository ¶ added in v0.2.0
type TransactionalRepository interface { Repository // InTransaction initiates a transaction and allows passing a function to be executed within the transaction InTransaction(ctx context.Context, f func(ctx context.Context, storage Repository) error) error }
TransactionalRepository is a storage repository that can initiate a transaction
func InitializeWithSafeTermination ¶ added in v0.3.3
func InitializeWithSafeTermination(ctx context.Context, s Storage, settings *Settings, wg *sync.WaitGroup, decorators ...TransactionalRepositoryDecorator) (TransactionalRepository, error)
type TransactionalRepositoryDecorator ¶ added in v0.3.3
type TransactionalRepositoryDecorator func(TransactionalRepository) (TransactionalRepository, error)
TransactionalRepositoryDecorator allows decorating a TransactionalRepository
func EncryptingDecorator ¶ added in v0.3.3
func EncryptingDecorator(ctx context.Context, encrypter security.Encrypter, keyStore KeyStore) TransactionalRepositoryDecorator
EncryptingDecorator creates a TransactionalRepositoryDecorator that can be used to add encrypting/decrypting logic to a TransactionalRepository
type UpdateAroundTxInterceptor ¶ added in v0.7.3
type UpdateAroundTxInterceptor interface {
AroundTxUpdate(h InterceptUpdateAroundTxFunc) InterceptUpdateAroundTxFunc
}
UpdateAroundTxInterceptor provides hooks on entity update during AroundTx
type UpdateAroundTxInterceptorChain ¶ added in v0.7.3
type UpdateAroundTxInterceptorChain struct {
// contains filtered or unexported fields
}
func (*UpdateAroundTxInterceptorChain) AroundTxUpdate ¶ added in v0.7.3
func (c *UpdateAroundTxInterceptorChain) AroundTxUpdate(f InterceptUpdateAroundTxFunc) InterceptUpdateAroundTxFunc
AroundTxUpdate wraps the provided InterceptUpdateAroundTxFunc into all the existing aroundTx funcs
type UpdateAroundTxInterceptorProvider ¶ added in v0.7.3
type UpdateAroundTxInterceptorProvider interface { web.Named Provide() UpdateAroundTxInterceptor }
type UpdateInterceptor ¶ added in v0.2.0
type UpdateInterceptor interface { UpdateAroundTxInterceptor UpdateOnTxInterceptor }
UpdateInterceptor provides hooks on entity update
type UpdateInterceptorChain ¶ added in v0.2.0
type UpdateInterceptorChain struct { *UpdateAroundTxInterceptorChain *UpdateOnTxInterceptorChain }
UpdateInterceptorChain is an interceptor tha provides and chains a list of ordered interceptor providers.
type UpdateInterceptorProvider ¶ added in v0.2.0
type UpdateInterceptorProvider interface { web.Named Provide() UpdateInterceptor }
UpdateInterceptorProvider provides UpdateInterceptors for each request
type UpdateOnTxInterceptor ¶ added in v0.7.3
type UpdateOnTxInterceptor interface {
OnTxUpdate(f InterceptUpdateOnTxFunc) InterceptUpdateOnTxFunc
}
UpdateOnTxInterceptor provides hooks on entity update during OnTx
type UpdateOnTxInterceptorChain ¶ added in v0.7.3
type UpdateOnTxInterceptorChain struct {
// contains filtered or unexported fields
}
func (*UpdateOnTxInterceptorChain) OnTxUpdate ¶ added in v0.7.3
func (c *UpdateOnTxInterceptorChain) OnTxUpdate(f InterceptUpdateOnTxFunc) InterceptUpdateOnTxFunc
OnTxUpdate wraps the provided InterceptUpdateOnTxFunc into all the existing onTx funcs
type UpdateOnTxInterceptorProvider ¶ added in v0.7.3
type UpdateOnTxInterceptorProvider interface { web.Named Provide() UpdateOnTxInterceptor }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
notification_connection/notification_connectionfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
postgresfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Code generated by counterfeiter.
|
Code generated by counterfeiter. |