Documentation ¶
Index ¶
- Constants
- func ItemsAs[T any](ii []Item) (converted []T)
- func NewBalancer(r Registry)
- type AdjacentItemOption
- func WithAdjacentEdgeItems(items []Item) AdjacentItemOption
- func WithAdjacentEdgeOptions(opts ...Option) AdjacentItemOption
- func WithAdjacentSourceItems(items []Item) AdjacentItemOption
- func WithAdjacentSourceOptions(opts ...Option) AdjacentItemOption
- func WithAdjacentTargetItems(items []Item) AdjacentItemOption
- func WithAdjacentTargetOptions(opts ...Option) AdjacentItemOption
- type AdjacentItemOptions
- type Backend
- type Balancer
- type Context
- type Convertible
- type Dao
- type Edge
- type Endpoint
- type FuncWrapper
- type FuncWrapperOption
- type FuncWrapperOptions
- type Generic
- type Item
- type MetaSetter
- type MetaWrapper
- type Node
- type Option
- type Options
- type RawRegistry
- type RegisterOption
- type RegisterOptions
- type Registry
- func GraphRegistry(r RawRegistry) Registry
- func NewCombinedRegistry(main Registry, next Registry) Registry
- func NewFuncWrapper(reg Registry, opt ...FuncWrapperOption) Registry
- func NewMetaWrapper(reg Registry, f func(map[string]string), opts ...Option) Registry
- func NewTransientWrapper(reg Registry, opts ...Option) Registry
- func OpenRegistry(ctx context.Context, urlstr string) (Registry, error)
- type Result
- type RichItem
- type Server
- type Service
- type Status
- type StatusReporter
- type StatusWatcher
- type TransientWrapper
- type URLMux
- type URLOpener
- type Watcher
Constants ¶
const ( ContextKey registryKey = iota ContextSOTWKey )
const ( MetaStatusKey = "status" StatusStopped Status = "stopped" StatusStarting Status = "starting" StatusReady Status = "ready" StatusError Status = "error" StatusStopping Status = "stopping" StatusTransient Status = "transient" StatusWaiting Status = "waiting" MetaDescriptionKey = "description" MetaUniqueKey = "unique" MetaTimestampKey = "timestamp" )
const (
ServiceMetaOverride = "service-override"
)
Variables ¶
This section is empty.
Functions ¶
func NewBalancer ¶
func NewBalancer(r Registry)
Types ¶
type AdjacentItemOption ¶
type AdjacentItemOption func(options *AdjacentItemOptions)
func WithAdjacentEdgeItems ¶
func WithAdjacentEdgeItems(items []Item) AdjacentItemOption
func WithAdjacentEdgeOptions ¶
func WithAdjacentEdgeOptions(opts ...Option) AdjacentItemOption
func WithAdjacentSourceItems ¶
func WithAdjacentSourceItems(items []Item) AdjacentItemOption
func WithAdjacentSourceOptions ¶
func WithAdjacentSourceOptions(opts ...Option) AdjacentItemOption
func WithAdjacentTargetItems ¶
func WithAdjacentTargetItems(items []Item) AdjacentItemOption
func WithAdjacentTargetOptions ¶
func WithAdjacentTargetOptions(opts ...Option) AdjacentItemOption
type AdjacentItemOptions ¶
type AdjacentItemOptions struct {
// contains filtered or unexported fields
}
type Backend ¶
type Backend struct { Alive bool ReverseProxy *httputil.ReverseProxy // contains filtered or unexported fields }
type Convertible ¶
type Convertible interface {
As(interface{}) bool
}
type FuncWrapper ¶
type FuncWrapper struct { Registry // contains filtered or unexported fields }
func (*FuncWrapper) Deregister ¶
func (m *FuncWrapper) Deregister(item Item, opts ...RegisterOption) error
func (*FuncWrapper) Register ¶
func (m *FuncWrapper) Register(item Item, opts ...RegisterOption) error
type FuncWrapperOption ¶
type FuncWrapperOption func(*FuncWrapperOptions)
func OnDeregister ¶
func OnDeregister(fn func(*Item, *[]RegisterOption)) FuncWrapperOption
func OnRegister ¶
func OnRegister(fn func(*Item, *[]RegisterOption)) FuncWrapperOption
type FuncWrapperOptions ¶
type FuncWrapperOptions struct { OnRegister []func(*Item, *[]RegisterOption) OnDeregister []func(*Item, *[]RegisterOption) }
type MetaSetter ¶
type MetaWrapper ¶
type MetaWrapper struct { Registry // contains filtered or unexported fields }
func (*MetaWrapper) Register ¶
func (m *MetaWrapper) Register(item Item, opts ...RegisterOption) error
type Option ¶
type Option func(*Options)
func WithAction ¶
func WithAction(a pb.ActionType) Option
func WithContext ¶
func WithFailFast ¶
func WithFailFast() Option
func WithFilter ¶
type Options ¶
type Options struct { Context context.Context FailFast bool Actions []pb.ActionType IDs []string Names []string Types []pb.ItemType Filters []func(item Item) bool }
func (*Options) ActionsMatch ¶
func (o *Options) ActionsMatch(eventAction pb.ActionType) bool
ActionsMatch checks if an Action filter matches input
type RawRegistry ¶
type RawRegistry interface { Start(Item) error Stop(Item) error Register(Item, ...RegisterOption) error Deregister(Item, ...RegisterOption) error Get(string, ...Option) (Item, error) List(...Option) ([]Item, error) Watch(...Option) (Watcher, error) NewLocker(name string) sync.Locker Close() error Done() <-chan struct{} As(interface{}) bool }
type RegisterOption ¶
type RegisterOption func(options *RegisterOptions)
func WithContextR ¶
func WithContextR(ctx context.Context) RegisterOption
func WithDeregisterFull ¶
func WithDeregisterFull() RegisterOption
func WithEdgeTo ¶
func WithEdgeTo(id, label string, meta map[string]string) RegisterOption
func WithRegisterFailFast ¶
func WithRegisterFailFast() RegisterOption
func WithWatch ¶
func WithWatch(wi StatusReporter) RegisterOption
type RegisterOptions ¶
type Registry ¶
type Registry interface { RawRegistry RegisterEdge(item1, item2, edgeLabel string, metadata map[string]string, oo ...RegisterOption) (Edge, error) ListAdjacentItems(options ...AdjacentItemOption) (items []Item) }
func GraphRegistry ¶
func GraphRegistry(r RawRegistry) Registry
func NewCombinedRegistry ¶
func NewFuncWrapper ¶
func NewFuncWrapper(reg Registry, opt ...FuncWrapperOption) Registry
func NewMetaWrapper ¶
func NewTransientWrapper ¶
func OpenRegistry ¶
OpenRegistry opens the Registry identified by the URL given. See the URLOpener documentation in driver subpackages for details on supported URL formats, and https://gocloud.dev/concepts/urls for more information.
type Result ¶
type Result interface { Action() pb.ActionType Items() []Item }
type RichItem ¶
type RichItem[T any] struct { UUID string RichName string Meta map[string]string Typ registry.ItemType // contains filtered or unexported fields }
func (*RichItem[T]) SetMetadata ¶
type Service ¶
type Service interface { Item Version() string Tags() []string Start(oo ...RegisterOption) error Stop(oo ...RegisterOption) error ServerScheme() string }
Service represents an instantiated service in the registry
type StatusReporter ¶
type StatusReporter interface {
WatchStatus() (StatusWatcher, error)
}
type StatusWatcher ¶
type TransientWrapper ¶
type TransientWrapper struct { Registry // contains filtered or unexported fields }
func (*TransientWrapper) Register ¶
func (m *TransientWrapper) Register(item Item, opts ...RegisterOption) error
type URLMux ¶
type URLMux struct {
// contains filtered or unexported fields
}
URLMux is a URL opener multiplexer. It matches the scheme of the URLs against a set of registered schemes and calls the opener that matches the URL's scheme. See https://gocloud.dev/concepts/urls/ for more information.
The zero value is a multiplexer with no registered schemes.
func DefaultURLMux ¶
func DefaultURLMux() *URLMux
DefaultURLMux returns the URLMux used by OpenTopic and OpenSubscription.
Driver packages can use this to register their TopicURLOpener and/or SubscriptionURLOpener on the mux.
func (*URLMux) OpenRegistry ¶
OpenRegistry calls OpenTopicURL with the URL parsed from urlstr. OpenRegistry is safe to call from multiple goroutines.
func (*URLMux) Register ¶
Register registers the opener with the given scheme. If an opener already exists for the scheme, Register panics.
func (*URLMux) ValidScheme ¶
ValidScheme returns true if scheme has been registered.