manager

package
v5.0.0-...-2679821 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: AGPL-3.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandStart   = "start"
	CommandStop    = "stop"
	CommandRestart = "restart"
)

Variables

View Source
var ContextKey = managerKey{}

Functions

func CloseStoragesForContext

func CloseStoragesForContext(ctx context.Context, opts ...ResolveOption) error

func DSNtoContextDAO

func DSNtoContextDAO(ctx context.Context, dsn []string, daoFunc any) (context.Context, error)

func MockServicesToContextDAO

func MockServicesToContextDAO(ctx context.Context, dsn map[string]string, servicesWithDAO map[string]map[string]any) (context.Context, error)

func MustGetConfig

func MustGetConfig(ctx context.Context) config.Store

func Resolve

func Resolve[T any](ctx context.Context, opts ...ResolveOption) (s T, final error)

func StorageMigration

func StorageMigration(opts ...ResolveOption) func(ctx2 context.Context) error

StorageMigration produces a function for Resolving a storage.Migrator and apply its Migrate function

Types

type Bootstrap

type Bootstrap struct {
	config.Store
	// contains filtered or unexported fields
}

Bootstrap wraps a config.Store and is loaded from yaml templates or additional environment data

func NewBootstrap

func NewBootstrap(ctx context.Context) (*Bootstrap, error)

func (*Bootstrap) MustReset

func (bs *Bootstrap) MustReset(ctx context.Context, conf *openurl.Pool[config.Store])

MustReset triggers a full reload of the config

func (*Bootstrap) RegisterTemplate

func (bs *Bootstrap) RegisterTemplate(typ string, tpl string) error

RegisterTemplate adds a new template to the list

func (*Bootstrap) String

func (bs *Bootstrap) String() string

func (*Bootstrap) Viper

func (bs *Bootstrap) Viper() *Viper

type InitProvider

type InitProvider interface {
	Init(ctx context.Context, store configx.Values) error
}

type Manager

type Manager interface {
	Context() context.Context
	Registry() registry.Registry
	ServeAll(...server.ServeOption) error
	StopAll()
	SetServeOptions(...server.ServeOption)
	WatchServicesConfigs()
	WatchBroker(ctx context.Context, br broker.Broker) error

	RegisterBootstrapTemplate(typ string, data string) error
	RegisterStorage(scheme string, options ...controller.Option[storage.Storage])
	RegisterConfig(scheme string, config ...controller.Option[*openurl.Pool[config.Store]])
	RegisterQueue(scheme string, opts ...controller.Option[broker.AsyncQueuePool])
	RegisterCache(scheme string, opts ...controller.Option[*openurl.Pool[cache.Cache]])

	GetRootID() string
	GetStorage(ctx context.Context, name string, out any) error
	GetQueue(ctx context.Context, name string, resolutionData map[string]interface{}, openerID string, openerFunc broker.OpenWrapper) (broker.AsyncQueue, func() (bool, error), error)
	GetQueuePool(name string) (broker.AsyncQueuePool, error)
	GetCache(ctx context.Context, name string, resolutionData map[string]interface{}) (cache.Cache, error)
}

func NewManager

func NewManager(ctx context.Context, namespace string, logger log.ZapLogger) (Manager, error)

type ResolveOption

type ResolveOption func(*ResolveOptions)

func WithCleanBeforeClose

func WithCleanBeforeClose() ResolveOption

func WithName

func WithName(name string) ResolveOption

type ResolveOptions

type ResolveOptions struct {
	Name             string
	CleanBeforeClose bool
}

type Viper

type Viper struct {
	*viper.Viper
}

Jump to

Keyboard shortcuts

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