Documentation ¶
Overview ¶
+kubebuilder:validation:Optional
Index ¶
- func RegisterPeerDiscoveryService(server *grpc.Server, pd *PeerDiscovery)
- type Constructor
- type PeerDiscovery
- func (pd *PeerDiscovery) DeregisterSelf(ctx context.Context) error
- func (pd *PeerDiscovery) GetPeer(address string) (*peersv1.Peer, error)
- func (pd *PeerDiscovery) GetPeerKeys() []string
- func (pd *PeerDiscovery) GetPeers() *peersv1.Peers
- func (pd *PeerDiscovery) RegisterSelf(ctx context.Context, advertiseAddr string) error
- func (pd *PeerDiscovery) RegisterService(name string, address string)
- func (pd *PeerDiscovery) Start() error
- func (pd *PeerDiscovery) Stop() error
- type PeerDiscoveryConfig
- type PeerDiscoveryIn
- type PeerDiscoveryPrefix
- type PeerDiscoveryService
- type PeerWatcher
- type PeerWatchers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterPeerDiscoveryService ¶ added in v0.2.1
func RegisterPeerDiscoveryService(server *grpc.Server, pd *PeerDiscovery)
RegisterPeerDiscoveryService registers a service for peer discovery.
Types ¶
type Constructor ¶
type Constructor struct { ConfigKey string DefaultConfig PeerDiscoveryConfig Service string }
Constructor holds fields to create and configure PeerDiscovery.
func (Constructor) Module ¶
func (constructor Constructor) Module() fx.Option
Module is a fx module that creates peer directory and provides peer discovery.
type PeerDiscovery ¶
type PeerDiscovery struct {
// contains filtered or unexported fields
}
PeerDiscovery holds fields to manage peer discovery.
func NewPeerDiscovery ¶
func NewPeerDiscovery(prefix string, client *etcdclient.Client, watchers PeerWatchers, ) (*PeerDiscovery, error)
NewPeerDiscovery creates a new PeerDiscovery.
func (*PeerDiscovery) DeregisterSelf ¶ added in v0.2.1
func (pd *PeerDiscovery) DeregisterSelf(ctx context.Context) error
DeregisterSelf deregisters self from etcd.
func (*PeerDiscovery) GetPeer ¶
func (pd *PeerDiscovery) GetPeer(address string) (*peersv1.Peer, error)
GetPeer returns the peer info in the PeerDiscovery with the given address.
func (*PeerDiscovery) GetPeerKeys ¶
func (pd *PeerDiscovery) GetPeerKeys() []string
GetPeerKeys returns all the peer keys that are added to PeerDiscovery.
func (*PeerDiscovery) GetPeers ¶
func (pd *PeerDiscovery) GetPeers() *peersv1.Peers
GetPeers returns all the peer info that are added to PeerDiscovery.
func (*PeerDiscovery) RegisterSelf ¶ added in v0.2.1
func (pd *PeerDiscovery) RegisterSelf(ctx context.Context, advertiseAddr string) error
RegisterSelf registers self to etcd.
func (*PeerDiscovery) RegisterService ¶
func (pd *PeerDiscovery) RegisterService(name string, address string)
RegisterService accepts a name, full address (host:port) and adds to the list of services in PeerDiscovery.
type PeerDiscoveryConfig ¶
type PeerDiscoveryConfig struct { // Network address of aperture server to advertise to peers - this address should be reachable from other agents. Used for nat traversal when provided. AdvertisementAddr string `json:"advertisement_addr" validate:"omitempty,hostname_port"` }
PeerDiscoveryConfig holds configuration for Agent Peer Discovery. swagger:model +kubebuilder:object:generate=true
func (*PeerDiscoveryConfig) DeepCopy ¶ added in v0.1.2
func (in *PeerDiscoveryConfig) DeepCopy() *PeerDiscoveryConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeerDiscoveryConfig.
func (*PeerDiscoveryConfig) DeepCopyInto ¶ added in v0.1.2
func (in *PeerDiscoveryConfig) DeepCopyInto(out *PeerDiscoveryConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PeerDiscoveryIn ¶
type PeerDiscoveryIn struct { fx.In Lifecycle fx.Lifecycle Unmarshaller config.Unmarshaller Client *etcdclient.Client Listener *listener.Listener StatusRegistry status.Registry Prefix PeerDiscoveryPrefix Watchers PeerWatchers `group:"peer-watchers"` }
PeerDiscoveryIn holds parameters for newPeerDiscovery.
type PeerDiscoveryPrefix ¶
type PeerDiscoveryPrefix string
PeerDiscoveryPrefix is the prefix for peer discovery service.
type PeerDiscoveryService ¶ added in v0.2.1
type PeerDiscoveryService struct { peersv1.UnimplementedPeerDiscoveryServiceServer // contains filtered or unexported fields }
PeerDiscoveryService is the implementation of peersv1.PeerDiscoveryServiceServer interface.
func (*PeerDiscoveryService) GetPeer ¶ added in v0.2.1
func (svc *PeerDiscoveryService) GetPeer(ctx context.Context, req *peersv1.PeerRequest) (*peersv1.Peer, error)
GetPeer returns a peer.
type PeerWatcher ¶
PeerWatcher is used for tracking changes to peers.
type PeerWatchers ¶
type PeerWatchers []PeerWatcher
PeerWatchers is a collection of PeerWatcher.
func (PeerWatchers) OnPeerAdded ¶
func (pw PeerWatchers) OnPeerAdded(peer *peersv1.Peer)
OnPeerAdded calls OnPeerAdded for each PeerWatcher in the collection.
func (PeerWatchers) OnPeerRemoved ¶
func (pw PeerWatchers) OnPeerRemoved(peer *peersv1.Peer)
OnPeerRemoved calls OnPeerRemoved for each PeerWatcher in the collection.