cluster

package
v0.0.0-...-abf550e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2020 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_cluster_proto protoreflect.FileDescriptor

Functions

func RegisterClusterServer

func RegisterClusterServer(s *grpc.Server, srv ClusterServer)

Types

type ClusterClient

type ClusterClient interface {
	// RaftLocalJoin ask local server to try joining cluster
	RaftLocalJoin(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GenericResponse, error)
	// RaftJoin ask for join the node on the cluster
	RaftJoin(ctx context.Context, in *JoinRequest, opts ...grpc.CallOption) (*Key, error)
	// RaftLeave leaves the cluster
	RaftLeave(ctx context.Context, in *LeaveRequest, opts ...grpc.CallOption) (*GenericResponse, error)
	// RaftUnseal is used to exchange unseal keys between servers
	RaftUnseal(ctx context.Context, in *Key, opts ...grpc.CallOption) (*GenericResponse, error)
	// RaftSeal tells the members of the cluster to seal its database
	RaftSeal(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GenericResponse, error)
	// RaftAnnounce sets the remote peer information if unknown
	RaftAnnounce(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*GenericResponse, 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 {
	// RaftLocalJoin ask local server to try joining cluster
	RaftLocalJoin(context.Context, *Empty) (*GenericResponse, error)
	// RaftJoin ask for join the node on the cluster
	RaftJoin(context.Context, *JoinRequest) (*Key, error)
	// RaftLeave leaves the cluster
	RaftLeave(context.Context, *LeaveRequest) (*GenericResponse, error)
	// RaftUnseal is used to exchange unseal keys between servers
	RaftUnseal(context.Context, *Key) (*GenericResponse, error)
	// RaftSeal tells the members of the cluster to seal its database
	RaftSeal(context.Context, *Empty) (*GenericResponse, error)
	// RaftAnnounce sets the remote peer information if unknown
	RaftAnnounce(context.Context, *Peer) (*GenericResponse, 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 is an empty message

func (*Empty) Descriptor deprecated

func (*Empty) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

func (x *Empty) ProtoReflect() protoreflect.Message

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type GenericResponse

type GenericResponse struct {
	Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` // operation success
	// contains filtered or unexported fields
}

Generic response

func (*GenericResponse) Descriptor deprecated

func (*GenericResponse) Descriptor() ([]byte, []int)

Deprecated: Use GenericResponse.ProtoReflect.Descriptor instead.

func (*GenericResponse) GetOk

func (x *GenericResponse) GetOk() bool

func (*GenericResponse) ProtoMessage

func (*GenericResponse) ProtoMessage()

func (*GenericResponse) ProtoReflect

func (x *GenericResponse) ProtoReflect() protoreflect.Message

func (*GenericResponse) Reset

func (x *GenericResponse) Reset()

func (*GenericResponse) String

func (x *GenericResponse) String() string

type JoinRequest

type JoinRequest struct {
	Id        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`                                 // Server ID used to identify the remote on the cluster
	RaftAddr  string `protobuf:"bytes,2,opt,name=raft_addr,json=raftAddr,proto3" json:"raft_addr,omitempty"`     // IP:Port where the RAFT services is listening on the remote machine
	ApiAddr   string `protobuf:"bytes,3,opt,name=api_addr,json=apiAddr,proto3" json:"api_addr,omitempty"`        // address where the server is servicing the API, needed for proxy requests to leader
	PrevIndex uint64 `protobuf:"varint,4,opt,name=prev_index,json=prevIndex,proto3" json:"prev_index,omitempty"` // index of configuration
	Timeout   int64  `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"`                      // If nonzero, timeout is how long this server should wait before the configuration change log entry is appended.
	Voter     bool   `protobuf:"varint,6,opt,name=voter,proto3" json:"voter,omitempty"`                          // If the server has voter capabilities
	// contains filtered or unexported fields
}

JoinRequest is the message send to the cluster

func (*JoinRequest) Descriptor deprecated

func (*JoinRequest) Descriptor() ([]byte, []int)

Deprecated: Use JoinRequest.ProtoReflect.Descriptor instead.

func (*JoinRequest) GetApiAddr

func (x *JoinRequest) GetApiAddr() string

func (*JoinRequest) GetId

func (x *JoinRequest) GetId() string

func (*JoinRequest) GetPrevIndex

func (x *JoinRequest) GetPrevIndex() uint64

func (*JoinRequest) GetRaftAddr

func (x *JoinRequest) GetRaftAddr() string

func (*JoinRequest) GetTimeout

func (x *JoinRequest) GetTimeout() int64

func (*JoinRequest) GetVoter

func (x *JoinRequest) GetVoter() bool

func (*JoinRequest) ProtoMessage

func (*JoinRequest) ProtoMessage()

func (*JoinRequest) ProtoReflect

func (x *JoinRequest) ProtoReflect() protoreflect.Message

func (*JoinRequest) Reset

func (x *JoinRequest) Reset()

func (*JoinRequest) String

func (x *JoinRequest) String() string

type Key

type Key struct {
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // unsealkey
	// contains filtered or unexported fields
}

Key is used to exchange the key on peers

func (*Key) Descriptor deprecated

func (*Key) Descriptor() ([]byte, []int)

Deprecated: Use Key.ProtoReflect.Descriptor instead.

func (*Key) GetKey

func (x *Key) GetKey() []byte

func (*Key) ProtoMessage

func (*Key) ProtoMessage()

func (*Key) ProtoReflect

func (x *Key) ProtoReflect() protoreflect.Message

func (*Key) Reset

func (x *Key) Reset()

func (*Key) String

func (x *Key) String() string

type LeaveRequest

type LeaveRequest struct {
	Id        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`                                 // Server ID used to identify the remote on the cluster
	PrevIndex uint64 `protobuf:"varint,2,opt,name=prev_index,json=prevIndex,proto3" json:"prev_index,omitempty"` // index of configuration
	Timeout   int64  `protobuf:"varint,3,opt,name=timeout,proto3" json:"timeout,omitempty"`                      // If nonzero, timeout is how long this server should wait before the configuration change log entry is appended.
	// contains filtered or unexported fields
}

LeaveRequest is the message send to the cluster

func (*LeaveRequest) Descriptor deprecated

func (*LeaveRequest) Descriptor() ([]byte, []int)

Deprecated: Use LeaveRequest.ProtoReflect.Descriptor instead.

func (*LeaveRequest) GetId

func (x *LeaveRequest) GetId() string

func (*LeaveRequest) GetPrevIndex

func (x *LeaveRequest) GetPrevIndex() uint64

func (*LeaveRequest) GetTimeout

func (x *LeaveRequest) GetTimeout() int64

func (*LeaveRequest) ProtoMessage

func (*LeaveRequest) ProtoMessage()

func (*LeaveRequest) ProtoReflect

func (x *LeaveRequest) ProtoReflect() protoreflect.Message

func (*LeaveRequest) Reset

func (x *LeaveRequest) Reset()

func (*LeaveRequest) String

func (x *LeaveRequest) String() string

type Peer

type Peer struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	State    string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

Peer information

func (*Peer) Descriptor deprecated

func (*Peer) Descriptor() ([]byte, []int)

Deprecated: Use Peer.ProtoReflect.Descriptor instead.

func (*Peer) GetEndpoint

func (x *Peer) GetEndpoint() string

func (*Peer) GetId

func (x *Peer) GetId() string

func (*Peer) GetState

func (x *Peer) GetState() string

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) ProtoReflect

func (x *Peer) ProtoReflect() protoreflect.Message

func (*Peer) Reset

func (x *Peer) Reset()

func (*Peer) String

func (x *Peer) String() string

type UnimplementedClusterServer

type UnimplementedClusterServer struct {
}

UnimplementedClusterServer must be embedded to have forward compatible implementations.

func (*UnimplementedClusterServer) RaftAnnounce

func (*UnimplementedClusterServer) RaftJoin

func (*UnimplementedClusterServer) RaftLeave

func (*UnimplementedClusterServer) RaftLocalJoin

func (*UnimplementedClusterServer) RaftSeal

func (*UnimplementedClusterServer) RaftUnseal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL