Documentation ¶
Overview ¶
Package privateapi is a generated protocol buffer package.
It is generated from these files:
pkg/privateapi/cluster.proto
It has these top-level messages:
PingRequest PingResponse PeerInfo View LeaderNotificationRequest LeaderNotificationResponse
Index ¶
- func RegisterClusterServiceServer(s *grpc.Server, srv ClusterServiceServer)
- type ClusterServiceClient
- type ClusterServiceServer
- type LeaderNotificationRequest
- type LeaderNotificationResponse
- func (*LeaderNotificationResponse) Descriptor() ([]byte, []int)
- func (m *LeaderNotificationResponse) GetAccepted() bool
- func (m *LeaderNotificationResponse) GetView() *View
- func (*LeaderNotificationResponse) ProtoMessage()
- func (m *LeaderNotificationResponse) Reset()
- func (m *LeaderNotificationResponse) String() string
- type PeerId
- type PeerInfo
- type Peers
- type PingRequest
- type PingResponse
- type Server
- func (s *Server) AssertLeadership(ctx context.Context, leadershipToken string) error
- func (s *Server) BecomeLeader(ctx context.Context) ([]PeerId, string, error)
- func (s *Server) GetPeerClient(peerId PeerId) (*grpc.ClientConn, error)
- func (s *Server) GrpcServer() *grpc.Server
- func (s *Server) IsLeader(leadershipToken string) bool
- func (s *Server) LeaderNotification(ctx grpccontext.Context, request *LeaderNotificationRequest) (*LeaderNotificationResponse, error)
- func (s *Server) ListenAndServe(ctx context.Context, listen string) error
- func (s *Server) MyPeerId() PeerId
- func (s *Server) Peers() []*PeerInfo
- func (s *Server) Ping(ctx context.Context, request *PingRequest) (*PingResponse, error)
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterClusterServiceServer ¶
func RegisterClusterServiceServer(s *grpc.Server, srv ClusterServiceServer)
Types ¶
type ClusterServiceClient ¶
type ClusterServiceClient interface { // Ping just pings another node, part of the discovery protocol Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) // LeaderNotification is sent by a node that (thinks it) is the leader LeaderNotification(ctx context.Context, in *LeaderNotificationRequest, opts ...grpc.CallOption) (*LeaderNotificationResponse, error) }
func NewClusterServiceClient ¶
func NewClusterServiceClient(cc *grpc.ClientConn) ClusterServiceClient
type ClusterServiceServer ¶
type ClusterServiceServer interface { // Ping just pings another node, part of the discovery protocol Ping(context.Context, *PingRequest) (*PingResponse, error) // LeaderNotification is sent by a node that (thinks it) is the leader LeaderNotification(context.Context, *LeaderNotificationRequest) (*LeaderNotificationResponse, error) }
type LeaderNotificationRequest ¶
type LeaderNotificationRequest struct {
View *View `protobuf:"bytes,1,opt,name=view" json:"view,omitempty"`
}
func (*LeaderNotificationRequest) Descriptor ¶
func (*LeaderNotificationRequest) Descriptor() ([]byte, []int)
func (*LeaderNotificationRequest) GetView ¶
func (m *LeaderNotificationRequest) GetView() *View
func (*LeaderNotificationRequest) ProtoMessage ¶
func (*LeaderNotificationRequest) ProtoMessage()
func (*LeaderNotificationRequest) Reset ¶
func (m *LeaderNotificationRequest) Reset()
func (*LeaderNotificationRequest) String ¶
func (m *LeaderNotificationRequest) String() string
type LeaderNotificationResponse ¶
type LeaderNotificationResponse struct { // True if this node acknowledges the new leader Accepted bool `protobuf:"varint,1,opt,name=accepted" json:"accepted,omitempty"` // If the node has a different (bigger) view, it rejects the leadership bid and sends the view View *View `protobuf:"bytes,2,opt,name=view" json:"view,omitempty"` }
func (*LeaderNotificationResponse) Descriptor ¶
func (*LeaderNotificationResponse) Descriptor() ([]byte, []int)
func (*LeaderNotificationResponse) GetAccepted ¶
func (m *LeaderNotificationResponse) GetAccepted() bool
func (*LeaderNotificationResponse) GetView ¶
func (m *LeaderNotificationResponse) GetView() *View
func (*LeaderNotificationResponse) ProtoMessage ¶
func (*LeaderNotificationResponse) ProtoMessage()
func (*LeaderNotificationResponse) Reset ¶
func (m *LeaderNotificationResponse) Reset()
func (*LeaderNotificationResponse) String ¶
func (m *LeaderNotificationResponse) String() string
type PeerId ¶
type PeerId string
func PersistentPeerId ¶
PersistentPeerId reads the id from the base directory, creating and saving it if it does not exists
type PeerInfo ¶
type PeerInfo struct { Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` Endpoints []string `protobuf:"bytes,2,rep,name=endpoints" json:"endpoints,omitempty"` }
func (*PeerInfo) Descriptor ¶
func (*PeerInfo) GetEndpoints ¶
func (*PeerInfo) ProtoMessage ¶
func (*PeerInfo) ProtoMessage()
type PingRequest ¶
type PingRequest struct {
Info *PeerInfo `protobuf:"bytes,1,opt,name=info" json:"info,omitempty"`
}
func (*PingRequest) Descriptor ¶
func (*PingRequest) Descriptor() ([]byte, []int)
func (*PingRequest) GetInfo ¶
func (m *PingRequest) GetInfo() *PeerInfo
func (*PingRequest) ProtoMessage ¶
func (*PingRequest) ProtoMessage()
func (*PingRequest) Reset ¶
func (m *PingRequest) Reset()
func (*PingRequest) String ¶
func (m *PingRequest) String() string
type PingResponse ¶
type PingResponse struct {
Info *PeerInfo `protobuf:"bytes,1,opt,name=info" json:"info,omitempty"`
}
func (*PingResponse) Descriptor ¶
func (*PingResponse) Descriptor() ([]byte, []int)
func (*PingResponse) GetInfo ¶
func (m *PingResponse) GetInfo() *PeerInfo
func (*PingResponse) ProtoMessage ¶
func (*PingResponse) ProtoMessage()
func (*PingResponse) Reset ¶
func (m *PingResponse) Reset()
func (*PingResponse) String ¶
func (m *PingResponse) String() string
type Server ¶
type Server struct { // DiscoveryPollInterval is the interval with which we request peers from discovery DiscoveryPollInterval time.Duration // PingInterval is the interval between pings to each of our peers PingInterval time.Duration // HealthyTimeout is the time after which we will consider a peer down if we have not heard a ping from it // HealthyTimeout should be a moderate multiple of PingInterval (e.g. 10x) HealthyTimeout time.Duration // contains filtered or unexported fields }
func (*Server) AssertLeadership ¶
func (*Server) BecomeLeader ¶
func (*Server) GetPeerClient ¶
func (s *Server) GetPeerClient(peerId PeerId) (*grpc.ClientConn, error)
func (*Server) GrpcServer ¶
func (*Server) LeaderNotification ¶
func (s *Server) LeaderNotification(ctx grpccontext.Context, request *LeaderNotificationRequest) (*LeaderNotificationResponse, error)
func (*Server) ListenAndServe ¶
func (*Server) Ping ¶
func (s *Server) Ping(ctx context.Context, request *PingRequest) (*PingResponse, error)
Ping is just nodes pinging each other, part of the discovery protocol
type View ¶
type View struct { Leader *PeerInfo `protobuf:"bytes,1,opt,name=leader" json:"leader,omitempty"` LeadershipToken string `protobuf:"bytes,2,opt,name=leadership_token,json=leadershipToken" json:"leadership_token,omitempty"` Healthy []*PeerInfo `protobuf:"bytes,3,rep,name=healthy" json:"healthy,omitempty"` }
func (*View) Descriptor ¶
func (*View) GetHealthy ¶
func (*View) GetLeadershipToken ¶
func (*View) ProtoMessage ¶
func (*View) ProtoMessage()
Click to show internal directories.
Click to hide internal directories.