Documentation
¶
Index ¶
- Variables
- func NewAtomicContext(ctx context.Context) *testingAtomicContext
- func NoopLeaderEnsurer() leadership.Ensurer
- func SeedControllerConfig(c *gc.C, config controller.Config, controllerModelUUID coremodel.UUID, ...) controller.Config
- type ControllerTxnProvider
- type NamespaceWatcherFactory
- func (f *NamespaceWatcherFactory) Close()
- func (f *NamespaceWatcherFactory) FeedChange(ctx context.Context, namespace string, _ changestream.ChangeType, ...) error
- func (f *NamespaceWatcherFactory) NewNamespaceWatcher(namespace string, changeMask changestream.ChangeType, ...) (watcher.StringsWatcher, error)
Constants ¶
This section is empty.
Variables ¶
var IsAtomicContextChecker = gomock.AssignableToTypeOf(domain.AtomicContext(&testingAtomicContext{}))
IsAtomicContextChecker is a gomock.Matcher that checks if the argument is an AtomicContext.
Functions ¶
func NewAtomicContext ¶
NewAtomicContext returns a stub implementation of domain.AtomicContext. Used for testing.
func NoopLeaderEnsurer ¶
func NoopLeaderEnsurer() leadership.Ensurer
NoopLeaderEnsurer returns a leadership.Ensurer that will always allow leadership to be taken and held.
func SeedControllerConfig ¶
func SeedControllerConfig( c *gc.C, config controller.Config, controllerModelUUID coremodel.UUID, provider ControllerTxnProvider, ) controller.Config
Types ¶
type ControllerTxnProvider ¶
type ControllerTxnProvider interface {
ControllerTxnRunner() coredatabase.TxnRunner
}
type NamespaceWatcherFactory ¶
type NamespaceWatcherFactory struct { InitialStateFunc func() ([]string, error) WatcherChans map[string]chan []string }
NamespaceWatcherFactory implements a simple NamespaceWatcher creation process for tests. It supports channels of changes on to multiple namespaces. Channels created on this factory are buffered by 1 slot. This means that data needs to be consumed from the watcher before the next lot of data is placed to avoid a single goroutine lock.
func NewNamespaceWatcherFactory ¶
func NewNamespaceWatcherFactory(initial func() ([]string, error)) *NamespaceWatcherFactory
NewNamespaceWatcherFactory constructs a new NamespaceWatchFactory with a func that can provide initial state into newly minted watchers. initial func can be nil in which cash no initial state will be supplied to watchers.
func (*NamespaceWatcherFactory) Close ¶
func (f *NamespaceWatcherFactory) Close()
Close must be called after using this factory to safely clean up all the channels.
func (*NamespaceWatcherFactory) FeedChange ¶
func (f *NamespaceWatcherFactory) FeedChange( ctx context.Context, namespace string, _ changestream.ChangeType, change []string, ) error
FeedChange feeds the supplied change for the given namespace into any watchers that are open. If no watchers exist this func call evaluates to a noop. FeedChange will block until the watches channel can accept the data or the context is canceled.
func (*NamespaceWatcherFactory) NewNamespaceWatcher ¶
func (f *NamespaceWatcherFactory) NewNamespaceWatcher( namespace string, changeMask changestream.ChangeType, initialStateQuery eventsource.NamespaceQuery, ) (watcher.StringsWatcher, error)
NewNamespaceWatcher implements WatcherFactory.NewNamespaceWatcher