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.
- Copyright (c) 2019. Abstrium SAS <team (at) pydio.com>
- This file is part of Pydio Cells. *
- Pydio Cells is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- Pydio Cells is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details. *
- You should have received a copy of the GNU Affero General Public License
- along with Pydio Cells. If not, see <http://www.gnu.org/licenses/>. *
- The latest code can be found at <https://pydio.com>.
Index ¶
- Variables
- func BuildServiceMeta() map[string]string
- func FixedInstanceSelector(srvName string, targetAddress string) selector.SelectOption
- func GetClient(name string) (string, client.Client)
- func GetPeers() map[string]*Peer
- func GetProcesses() map[string]*Process
- func Init(opts ...Option)
- func NewMockFromMicroService(rs *registry.Service) *mockService
- func PeerClientSelector(srvName string, targetPeer string) selector.SelectOption
- type Cluster
- type Nodes
- type NullFSM
- type NullSnapshot
- 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 FixedInstanceSelector ¶
func FixedInstanceSelector(srvName string, targetAddress string) selector.SelectOption
PeerClientSelector creates a Selector Filter to restrict call to a given PeerAddress
func GetProcesses ¶ added in v1.4.0
func NewMockFromMicroService ¶
func PeerClientSelector ¶ added in v1.4.1
func PeerClientSelector(srvName string, targetPeer string) selector.SelectOption
PeerClientSelector creates a Selector Filter to restrict call to a given PeerAddress
Types ¶
type Cluster ¶
type Nodes ¶
Nodes wraps an array of registry nodes
func (Nodes) StringArray ¶
StringArray representation of the registry nodes
type NullSnapshot ¶
type NullSnapshot struct{}
func (*NullSnapshot) Persist ¶
func (n *NullSnapshot) Persist(sink raft.SnapshotSink) error
func (*NullSnapshot) Release ¶
func (n *NullSnapshot) Release()
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 Peer ¶ added in v1.2.2
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) GetAddress ¶ added in v1.4.1
func (*Peer) GetHostname ¶ added in v1.4.1
func (*Peer) GetServices ¶ added in v1.2.2
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 GetServiceByName(string) Service GetServicesByName(string) []Service GetPeers() map[string]*Peer GetProcesses() map[string]*Process ListServices(withExcluded ...bool) ([]Service, error) ListServicesWithFilter(func(Service) 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 DAO() interface{} IsGeneric() bool IsGRPC() bool IsREST() bool RequiresFork() bool ForkStart(retries ...int) 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
func ListServicesWithFilter ¶ added in v1.5.0
ListServicesWithFilter returns the list of services that are started in the system