Documentation
¶
Overview ¶
Package repo is responsilbe to store services and servers in a (etcd) repository.
Index ¶
- Variables
- func IDGenerator() func(string) string
- type Event
- type Namespace
- func (n *Namespace) Chan(ctx context.Context, errorHandler func(error)) <-chan *NamespaceEvent
- func (n *Namespace) Delete(name string) error
- func (n *Namespace) Get(namespaceName string) (*discovery.Namespace, error)
- func (n *Namespace) List() (discovery.Namespaces, error)
- func (n *Namespace) Save(namespace discovery.Namespace) (*discovery.Namespace, error)
- type NamespaceEvent
- type Server
- func (s *Server) Chan(ctx context.Context, errorHandler func(error)) <-chan *ServerEvent
- func (s *Server) Delete(name string) error
- func (s *Server) Get(serverName string) (*discovery.Server, error)
- func (s *Server) List(selector string) (discovery.Servers, error)
- func (s *Server) Save(server discovery.Server) (*discovery.Server, error)
- type ServerEvent
- type Service
- func (s *Service) Chan(ctx context.Context, errorHandler func(error)) <-chan *ServiceEvent
- func (s *Service) Delete(id, namespace string) error
- func (s *Service) DeleteFromNamespace(namespace string) error
- func (s *Service) Get(id, namespace string) (*discovery.Service, error)
- func (s *Service) List(namespace, selector string) (discovery.Services, error)
- func (s *Service) Save(svc discovery.Service) (*discovery.Service, error)
- type ServiceEvent
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotFound = errors.New("not found")
)
Common errors
Functions ¶
Types ¶
type Event ¶
type Event int
Event represents a repo event. The possible valid values are Change and Delete.
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace represents the server repository.
func NewNamespace ¶
NewNamespace creates a new namespace repo.
func (*Namespace) Chan ¶ added in v0.2.2
func (n *Namespace) Chan(ctx context.Context, errorHandler func(error)) <-chan *NamespaceEvent
Chan returns read-only channel of server events.
type NamespaceEvent ¶ added in v0.2.2
NamespaceEvent contains the server and the event (change or delete).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the server repository.
func (*Server) Chan ¶
func (s *Server) Chan(ctx context.Context, errorHandler func(error)) <-chan *ServerEvent
Chan returns read-only channel of server events.
type ServerEvent ¶
ServerEvent contains the server and the event (change or delete).
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents the service repository.
func NewService ¶
NewService creates a new service repo.
func (*Service) Chan ¶
func (s *Service) Chan(ctx context.Context, errorHandler func(error)) <-chan *ServiceEvent
Chan returns read-only channel of service events.
func (*Service) DeleteFromNamespace ¶
DeleteFromNamespace deletes all services in namespace.
type ServiceEvent ¶
ServiceEvent contains the service and the event (change or delete).