Documentation ¶
Index ¶
- Variables
- func RegisterClusterServer(s grpc.ServiceRegistrar, srv ClusterServer)
- type ClusterClient
- type ClusterServer
- type Empty
- type HeartbeatRequest
- func (*HeartbeatRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HeartbeatRequest) GetLeader() string
- func (x *HeartbeatRequest) GetTerm() int64
- func (*HeartbeatRequest) ProtoMessage()
- func (x *HeartbeatRequest) ProtoReflect() protoreflect.Message
- func (x *HeartbeatRequest) Reset()
- func (x *HeartbeatRequest) String() string
- type HeartbeatResponse
- type HelloRequest
- func (*HelloRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HelloRequest) GetHostname() string
- func (x *HelloRequest) GetOs() string
- func (x *HelloRequest) GetTsHost() string
- func (*HelloRequest) ProtoMessage()
- func (x *HelloRequest) ProtoReflect() protoreflect.Message
- func (x *HelloRequest) Reset()
- func (x *HelloRequest) String() string
- type UnimplementedClusterServer
- func (UnimplementedClusterServer) Hello(context.Context, *HelloRequest) (*Empty, error)
- func (UnimplementedClusterServer) LeaderHeartbeat(context.Context, *HeartbeatRequest) (*HeartbeatResponse, error)
- func (UnimplementedClusterServer) RequestVote(context.Context, *VoteRequest) (*VoteResponse, error)
- type UnsafeClusterServer
- type VoteRequest
- func (*VoteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *VoteRequest) GetCandidate() string
- func (x *VoteRequest) GetTerm() int64
- func (*VoteRequest) ProtoMessage()
- func (x *VoteRequest) ProtoReflect() protoreflect.Message
- func (x *VoteRequest) Reset()
- func (x *VoteRequest) String() string
- type VoteResponse
- func (*VoteResponse) Descriptor() ([]byte, []int)deprecated
- func (x *VoteResponse) GetGranted() bool
- func (x *VoteResponse) GetTerm() int64
- func (*VoteResponse) ProtoMessage()
- func (x *VoteResponse) ProtoReflect() protoreflect.Message
- func (x *VoteResponse) Reset()
- func (x *VoteResponse) String() string
Constants ¶
This section is empty.
Variables ¶
var Cluster_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Cluster", HandlerType: (*ClusterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Hello", Handler: _Cluster_Hello_Handler, }, { MethodName: "RequestVote", Handler: _Cluster_RequestVote_Handler, }, { MethodName: "LeaderHeartbeat", Handler: _Cluster_LeaderHeartbeat_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "cluster.proto", }
Cluster_ServiceDesc is the grpc.ServiceDesc for Cluster service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_cluster_proto protoreflect.FileDescriptor
Functions ¶
func RegisterClusterServer ¶
func RegisterClusterServer(s grpc.ServiceRegistrar, srv ClusterServer)
Types ¶
type ClusterClient ¶
type ClusterClient interface { // When a new machine joins the cluster, we want to have this machine // introduce itself to the rest of the peers in the network. Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*Empty, error) // Requesting a vote, a machine asking another machine to vote for it. RequestVote(ctx context.Context, in *VoteRequest, opts ...grpc.CallOption) (*VoteResponse, error) // Heartbeat from leader to followers. LeaderHeartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (*HeartbeatResponse, error) }
ClusterClient is the client API for Cluster service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewClusterClient ¶
func NewClusterClient(cc grpc.ClientConnInterface) ClusterClient
type ClusterServer ¶
type ClusterServer interface { // When a new machine joins the cluster, we want to have this machine // introduce itself to the rest of the peers in the network. Hello(context.Context, *HelloRequest) (*Empty, error) // Requesting a vote, a machine asking another machine to vote for it. RequestVote(context.Context, *VoteRequest) (*VoteResponse, error) // Heartbeat from leader to followers. LeaderHeartbeat(context.Context, *HeartbeatRequest) (*HeartbeatResponse, error) // contains filtered or unexported methods }
ClusterServer is the server API for Cluster service. All implementations must embed UnimplementedClusterServer for forward compatibility
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
Empty message.
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type HeartbeatRequest ¶
type HeartbeatRequest struct { Term int64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` Leader string `protobuf:"bytes,2,opt,name=leader,proto3" json:"leader,omitempty"` // contains filtered or unexported fields }
func (*HeartbeatRequest) Descriptor
deprecated
func (*HeartbeatRequest) Descriptor() ([]byte, []int)
Deprecated: Use HeartbeatRequest.ProtoReflect.Descriptor instead.
func (*HeartbeatRequest) GetLeader ¶
func (x *HeartbeatRequest) GetLeader() string
func (*HeartbeatRequest) GetTerm ¶
func (x *HeartbeatRequest) GetTerm() int64
func (*HeartbeatRequest) ProtoMessage ¶
func (*HeartbeatRequest) ProtoMessage()
func (*HeartbeatRequest) ProtoReflect ¶
func (x *HeartbeatRequest) ProtoReflect() protoreflect.Message
func (*HeartbeatRequest) Reset ¶
func (x *HeartbeatRequest) Reset()
func (*HeartbeatRequest) String ¶
func (x *HeartbeatRequest) String() string
type HeartbeatResponse ¶
type HeartbeatResponse struct { Term int64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` // contains filtered or unexported fields }
func (*HeartbeatResponse) Descriptor
deprecated
func (*HeartbeatResponse) Descriptor() ([]byte, []int)
Deprecated: Use HeartbeatResponse.ProtoReflect.Descriptor instead.
func (*HeartbeatResponse) GetTerm ¶
func (x *HeartbeatResponse) GetTerm() int64
func (*HeartbeatResponse) ProtoMessage ¶
func (*HeartbeatResponse) ProtoMessage()
func (*HeartbeatResponse) ProtoReflect ¶
func (x *HeartbeatResponse) ProtoReflect() protoreflect.Message
func (*HeartbeatResponse) Reset ¶
func (x *HeartbeatResponse) Reset()
func (*HeartbeatResponse) String ¶
func (x *HeartbeatResponse) String() string
type HelloRequest ¶
type HelloRequest struct { TsHost string `protobuf:"bytes,1,opt,name=ts_host,json=tsHost,proto3" json:"ts_host,omitempty"` // Tailscale IP of this machine. Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"` Os string `protobuf:"bytes,3,opt,name=os,proto3" json:"os,omitempty"` // contains filtered or unexported fields }
func (*HelloRequest) Descriptor
deprecated
func (*HelloRequest) Descriptor() ([]byte, []int)
Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
func (*HelloRequest) GetHostname ¶
func (x *HelloRequest) GetHostname() string
func (*HelloRequest) GetOs ¶
func (x *HelloRequest) GetOs() string
func (*HelloRequest) GetTsHost ¶
func (x *HelloRequest) GetTsHost() string
func (*HelloRequest) ProtoMessage ¶
func (*HelloRequest) ProtoMessage()
func (*HelloRequest) ProtoReflect ¶
func (x *HelloRequest) ProtoReflect() protoreflect.Message
func (*HelloRequest) Reset ¶
func (x *HelloRequest) Reset()
func (*HelloRequest) String ¶
func (x *HelloRequest) String() string
type UnimplementedClusterServer ¶
type UnimplementedClusterServer struct { }
UnimplementedClusterServer must be embedded to have forward compatible implementations.
func (UnimplementedClusterServer) Hello ¶
func (UnimplementedClusterServer) Hello(context.Context, *HelloRequest) (*Empty, error)
func (UnimplementedClusterServer) LeaderHeartbeat ¶
func (UnimplementedClusterServer) LeaderHeartbeat(context.Context, *HeartbeatRequest) (*HeartbeatResponse, error)
func (UnimplementedClusterServer) RequestVote ¶
func (UnimplementedClusterServer) RequestVote(context.Context, *VoteRequest) (*VoteResponse, error)
type UnsafeClusterServer ¶
type UnsafeClusterServer interface {
// contains filtered or unexported methods
}
UnsafeClusterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ClusterServer will result in compilation errors.
type VoteRequest ¶
type VoteRequest struct { Term int64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` Candidate string `protobuf:"bytes,2,opt,name=candidate,proto3" json:"candidate,omitempty"` // contains filtered or unexported fields }
func (*VoteRequest) Descriptor
deprecated
func (*VoteRequest) Descriptor() ([]byte, []int)
Deprecated: Use VoteRequest.ProtoReflect.Descriptor instead.
func (*VoteRequest) GetCandidate ¶
func (x *VoteRequest) GetCandidate() string
func (*VoteRequest) GetTerm ¶
func (x *VoteRequest) GetTerm() int64
func (*VoteRequest) ProtoMessage ¶
func (*VoteRequest) ProtoMessage()
func (*VoteRequest) ProtoReflect ¶
func (x *VoteRequest) ProtoReflect() protoreflect.Message
func (*VoteRequest) Reset ¶
func (x *VoteRequest) Reset()
func (*VoteRequest) String ¶
func (x *VoteRequest) String() string
type VoteResponse ¶
type VoteResponse struct { Term int64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` Granted bool `protobuf:"varint,2,opt,name=granted,proto3" json:"granted,omitempty"` // contains filtered or unexported fields }
func (*VoteResponse) Descriptor
deprecated
func (*VoteResponse) Descriptor() ([]byte, []int)
Deprecated: Use VoteResponse.ProtoReflect.Descriptor instead.
func (*VoteResponse) GetGranted ¶
func (x *VoteResponse) GetGranted() bool
func (*VoteResponse) GetTerm ¶
func (x *VoteResponse) GetTerm() int64
func (*VoteResponse) ProtoMessage ¶
func (*VoteResponse) ProtoMessage()
func (*VoteResponse) ProtoReflect ¶
func (x *VoteResponse) ProtoReflect() protoreflect.Message
func (*VoteResponse) Reset ¶
func (x *VoteResponse) Reset()
func (*VoteResponse) String ¶
func (x *VoteResponse) String() string