Documentation ¶
Overview ¶
Package registry provides the main glue between services
It wraps micro registry (running services declared to the discovery server) into a more generic registry where all actual plugins are self-declared.
Package registry provides the main glue between services ¶
It wraps micro registry (running services declared to the discovery server) into a more generic registry where all actual plugins are self-declared.
Package registry provides the main glue between services ¶
It wraps micro registry (running services declared to the discovery server) into a more generic registry where all actual plugins are self-declared.
Index ¶
- Variables
- func BuildServiceMeta() map[string]string
- func GetClient(name string) (string, client.Client)
- func GetPeers() map[string]*Peer
- func GetProcesses() map[string]*Process
- func Init(opts ...Option)
- type Nodes
- type Option
- type Options
- type Peer
- type Process
- type RegisterOption
- type RegisterOptions
- type Registry
- type Result
- type Service
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var ( // Default registry Default = NewRegistry() )
var (
ProcessStartTags []string
)
Functions ¶
func BuildServiceMeta ¶ added in v1.4.0
func GetProcesses ¶ added in v1.4.0
Types ¶
type Nodes ¶
Nodes wraps an array of registry nodes
func (Nodes) StringArray ¶
StringArray representation of the registry nodes
type Option ¶
type Option func(*Options)
Option is a gateway to setting Options to the Registry
func PollInterval ¶
PollInterval defines an interval option to a watcher
type Options ¶
type Options struct { Name string PollInterval time.Duration // Other options for implementations of the interface // can be stored in a context Context context.Context }
Options defines options to the Registry itself
type Process ¶ added in v1.4.0
type Process struct { Id string ParentId string MetricsPort int PeerId string PeerAddress string StartTag string Services map[string]string // contains filtered or unexported fields }
func NewProcess ¶ added in v1.4.0
type RegisterOption ¶
type RegisterOption func(*RegisterOptions)
RegisterOption is a gateway to setting RegisterOptions to a Registry Entry
func RegisterDependencies ¶
func RegisterDependencies(d ...string) RegisterOption
RegisterDependencies adds dependencies between services to the registry entry
func RegisterFlags ¶
func RegisterFlags(f ...*pflag.Flag) RegisterOption
RegisterFlags adds flags to the registry entry service
type RegisterOptions ¶
type RegisterOptions struct { Dependencies []string Flags []*pflag.Flag // Other options for implementations of the interface // can be stored in a context Context context.Context }
RegisterOptions defines different options for the Register entry
type Registry ¶
type Registry interface { Init(...Option) Register(Service, ...RegisterOption) error Deregister(Service) error GetService(string) ([]Service, error) GetServicesByName(string) []Service GetPeers() map[string]*Peer GetProcesses() map[string]*Process ListServices(withExcluded ...bool) ([]Service, error) ListRunningServices() ([]Service, error) ListServicesWithMicroMeta(string, ...string) ([]Service, error) SetServiceStopped(string) error Filter(func(Service) bool) error Watch() (Watcher, error) String() string Options() Options BeforeInit() error AfterInit() error }
Registry provides an interface for service discovery and an abstraction over varying implementations {consul, etcd, zookeeper, ...}
func NewRegistry ¶
NewRegistry provides a new registry object
type Service ¶
type Service interface { Start() Stop() IsRunning() bool IsExcluded() bool SetExcluded(ex bool) Check(context.Context) error Name() string Address() string Regexp() *regexp.Regexp Version() string Description() string Tags() []string GetDependencies() []Service AddDependency(string) SetRunningNodes([]*registry.Node) RunningNodes() []*registry.Node IsGeneric() bool IsGRPC() bool IsREST() bool RequiresFork() bool ForkStart() MustBeUnique() bool AutoStart() bool MatchesRegexp(string) bool BeforeInit() error AfterInit() error }
Service defines the primary functions a service must be able to answer to for the registry
func ListRunningServices ¶
ListRunningServices returns the list of services that are started in the system
func ListServices ¶
ListServices returns the list of services that are started in the system