 Documentation
      ¶
      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
- func ShortRequestTimeout() client.CallOption
- func Watch() (registry.Watcher, error)
- type Nodes
- type Option
- type Options
- type Peer
- type Process
- type RegisterOption
- type RegisterOptions
- type Registry
- type Service
- func GetRunningService(name string) ([]Service, error)
- func ListRunningServices() ([]Service, error)
- func ListServices(withExcluded ...bool) ([]Service, error)
- func ListServicesWithFilter(fn func(Service) bool) ([]Service, error)
- func ListServicesWithMicroMeta(metaName string, metaValue ...string) ([]Service, error)
 
Constants ¶
This section is empty.
Variables ¶
var ( // Default registry Default = NewRegistry() )
var (
	ProcessStartTags []string
)
    Functions ¶
func FixedInstanceSelector ¶
func FixedInstanceSelector(srvName string, targetAddress string) selector.SelectOption
PeerClientSelector creates a Selector Filter to restrict call to a given PeerAddress
func GetClient ¶
GetClient returns the default client for the service name
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
func ShortRequestTimeout ¶
func ShortRequestTimeout() client.CallOption
GetShortRequestTime returns a 1s RequestTimeout option
Types ¶
type Nodes ¶
Nodes wraps an array of registry nodes
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) Add ¶ added in v1.2.2
Add returns if the service was already registered
func (*Peer) Delete ¶ added in v1.2.2
Delete returns if the services existed before or not
type Process ¶ added in v1.4.1
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
	GetPeer(*registry.Node) *Peer
	GetCurrentProcess() *Process
	GetCurrentChildrenProcesses() []*Process
	GetProcesses() map[string]*Process
	GetProcess(*registry.Node) *Process
	ListServices(withExcluded ...bool) ([]Service, error)
	ListServicesWithFilter(func(Service) bool) ([]Service, error)
	GetRunningService(string) ([]Service, error)
	ListRunningServices() ([]Service, error)
	ListServicesWithMicroMeta(string, ...string) ([]Service, error)
	Filter(func(Service) bool) error
	Watch() (registry.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, ...}
type Service ¶
type Service interface {
	Start(context.Context)
	Stop()
	IsRunning() bool
	IsExcluded() bool
	SetExcluded(ex bool)
	Check(context.Context) error
	Name() string
	ID() 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(ctx context.Context, 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 GetRunningService ¶
GetRunningService returns the list of services that are started in the system
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.2
ListServicesWithFilter returns the list of services that are started in the system
       Source Files
      ¶
      Source Files
      ¶
    
- ctl.go
- mock-service.go
- options.go
- peer.go
- process.go
- registry.go
- running.go
- selectors.go
- service-meta.go
- services.go
- utils.go