Documentation ¶
Overview ¶
Package consensus is a generated protocol buffer package. It is generated from these files: cluster.proto It has these top-level messages: NodeInfo ClusterInfo RaftJoinRequest RaftJoinResponse FetchSnapshotRequest Chunk InfoResponse InfoRequest Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func NewCMuxTCPTransport(node *RaftNode, maxPool int, timeout time.Duration, logOutput io.Writer) (*raft.NetworkTransport, error)
- func NewCMuxTCPTransportWithConfig(node *RaftNode, config *raft.NetworkTransportConfig) (*raft.NetworkTransport, error)
- func NewCMuxTCPTransportWithLogger(node *RaftNode, maxPool int, timeout time.Duration, logger *log.Logger) (*raft.NetworkTransport, error)
- func RegisterClusterServiceServer(s *grpc.Server, srv ClusterServiceServer)
- type Chunk
- func (*Chunk) Descriptor() ([]byte, []int)
- func (m *Chunk) GetContent() []byte
- func (m *Chunk) Marshal() (dAtA []byte, err error)
- func (m *Chunk) MarshalTo(dAtA []byte) (int, error)
- func (*Chunk) ProtoMessage()
- func (m *Chunk) Reset()
- func (m *Chunk) Size() (n int)
- func (m *Chunk) String() string
- func (m *Chunk) Unmarshal(dAtA []byte) error
- type ClusterInfo
- func (*ClusterInfo) Descriptor() ([]byte, []int)
- func (m *ClusterInfo) GetLeaderId() string
- func (m *ClusterInfo) GetNodes() map[string]*NodeInfo
- func (m *ClusterInfo) Marshal() (dAtA []byte, err error)
- func (m *ClusterInfo) MarshalTo(dAtA []byte) (int, error)
- func (*ClusterInfo) ProtoMessage()
- func (m *ClusterInfo) Reset()
- func (m *ClusterInfo) Size() (n int)
- func (m *ClusterInfo) String() string
- func (m *ClusterInfo) Unmarshal(dAtA []byte) error
- type ClusterServiceClient
- type ClusterServiceServer
- type ClusterService_FetchSnapshotClient
- type ClusterService_FetchSnapshotServer
- type ClusteringOptions
- type FetchSnapshotRequest
- func (*FetchSnapshotRequest) Descriptor() ([]byte, []int)
- func (m *FetchSnapshotRequest) GetEndSeqNum() uint64
- func (m *FetchSnapshotRequest) GetStartSeqNum() uint64
- func (m *FetchSnapshotRequest) Marshal() (dAtA []byte, err error)
- func (m *FetchSnapshotRequest) MarshalTo(dAtA []byte) (int, error)
- func (*FetchSnapshotRequest) ProtoMessage()
- func (m *FetchSnapshotRequest) Reset()
- func (m *FetchSnapshotRequest) Size() (n int)
- func (m *FetchSnapshotRequest) String() string
- func (m *FetchSnapshotRequest) Unmarshal(dAtA []byte) error
- type InfoRequest
- func (*InfoRequest) Descriptor() ([]byte, []int)
- func (m *InfoRequest) Marshal() (dAtA []byte, err error)
- func (m *InfoRequest) MarshalTo(dAtA []byte) (int, error)
- func (*InfoRequest) ProtoMessage()
- func (m *InfoRequest) Reset()
- func (m *InfoRequest) Size() (n int)
- func (m *InfoRequest) String() string
- func (m *InfoRequest) Unmarshal(dAtA []byte) error
- type InfoResponse
- func (*InfoResponse) Descriptor() ([]byte, []int)
- func (m *InfoResponse) GetNodeInfo() *NodeInfo
- func (m *InfoResponse) Marshal() (dAtA []byte, err error)
- func (m *InfoResponse) MarshalTo(dAtA []byte) (int, error)
- func (*InfoResponse) ProtoMessage()
- func (m *InfoResponse) Reset()
- func (m *InfoResponse) Size() (n int)
- func (m *InfoResponse) String() string
- func (m *InfoResponse) Unmarshal(dAtA []byte) error
- type NodeInfo
- func (*NodeInfo) Descriptor() ([]byte, []int)
- func (m *NodeInfo) GetHttpAddr() string
- func (m *NodeInfo) GetMetricsAddr() string
- func (m *NodeInfo) GetMgmtAddr() string
- func (m *NodeInfo) GetNodeId() string
- func (m *NodeInfo) GetRaftAddr() string
- func (m *NodeInfo) Marshal() (dAtA []byte, err error)
- func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error)
- func (*NodeInfo) ProtoMessage()
- func (m *NodeInfo) Reset()
- func (m *NodeInfo) Size() (n int)
- func (m *NodeInfo) String() string
- func (m *NodeInfo) Unmarshal(dAtA []byte) error
- type RaftJoinRequest
- func (*RaftJoinRequest) Descriptor() ([]byte, []int)
- func (m *RaftJoinRequest) GetNodeId() string
- func (m *RaftJoinRequest) GetRaftAddr() string
- func (m *RaftJoinRequest) Marshal() (dAtA []byte, err error)
- func (m *RaftJoinRequest) MarshalTo(dAtA []byte) (int, error)
- func (*RaftJoinRequest) ProtoMessage()
- func (m *RaftJoinRequest) Reset()
- func (m *RaftJoinRequest) Size() (n int)
- func (m *RaftJoinRequest) String() string
- func (m *RaftJoinRequest) Unmarshal(dAtA []byte) error
- type RaftJoinResponse
- func (*RaftJoinResponse) Descriptor() ([]byte, []int)
- func (m *RaftJoinResponse) Marshal() (dAtA []byte, err error)
- func (m *RaftJoinResponse) MarshalTo(dAtA []byte) (int, error)
- func (*RaftJoinResponse) ProtoMessage()
- func (m *RaftJoinResponse) Reset()
- func (m *RaftJoinResponse) Size() (n int)
- func (m *RaftJoinResponse) String() string
- func (m *RaftJoinResponse) Unmarshal(dAtA []byte) error
- type RaftNode
- func (n *RaftNode) Add(event []byte) (*balloon.Snapshot, error)
- func (n *RaftNode) AddBulk(bulk [][]byte) ([]*balloon.Snapshot, error)
- func (n *RaftNode) Apply(l *raft.Log) interface{}
- func (n *RaftNode) Close(wait bool) error
- func (n *RaftNode) ClusterInfo() *ClusterInfo
- func (n *RaftNode) CreateBackup() error
- func (n *RaftNode) DeleteBackup(backupID uint32) error
- func (n *RaftNode) FetchNodeInfo(ctx context.Context, req *InfoRequest) (*InfoResponse, error)
- func (n *RaftNode) FetchSnapshot(req *FetchSnapshotRequest, srv ClusterService_FetchSnapshotServer) error
- func (n *RaftNode) Info() *NodeInfo
- func (n *RaftNode) IsLeader() bool
- func (n *RaftNode) JoinCluster(ctx context.Context, req *RaftJoinRequest) (*RaftJoinResponse, error)
- func (n *RaftNode) ListBackups() []*storage.BackupInfo
- func (n *RaftNode) QueryConsistency(start, end uint64) (*balloon.IncrementalProof, error)
- func (n *RaftNode) QueryDigestMembership(keyDigest hashing.Digest) (*balloon.MembershipProof, error)
- func (n *RaftNode) QueryDigestMembershipConsistency(keyDigest hashing.Digest, version uint64) (*balloon.MembershipProof, error)
- func (n *RaftNode) QueryMembership(event []byte) (*balloon.MembershipProof, error)
- func (n *RaftNode) QueryMembershipConsistency(event []byte, version uint64) (*balloon.MembershipProof, error)
- func (n *RaftNode) RegisterMetrics(registry metrics.Registry)
- func (n *RaftNode) Restore(rc io.ReadCloser) error
- func (n *RaftNode) Snapshot() (raft.FSMSnapshot, error)
- func (n *RaftNode) StoreConfiguration(index uint64, config raft.Configuration)
- func (n *RaftNode) WaitForLeader(timeout time.Duration) error
- type TCPStreamLayer
- type VersionMetadata
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotLeader is raised when no a raft node tries to execute an operation // on a non-primary node. ErrNotLeader = errors.New("Not cluster leader") // ErrCannotJoin is raised when a node cannot join to any specified seed // (e.g. not leader). ErrCannotJoin = errors.New("Unable to join to the cluster") // ErrCannotSync is raised when a node cannot synchronize its cluster info. ErrCannotSync = errors.New("Unable to sync cluster info") )
var ( ErrInvalidLengthCluster = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCluster = fmt.Errorf("proto: integer overflow") )
var ( // ErrKeyNotFound is an error indicating a given key does not exist ErrKeyNotFound = errors.New("not found") )
Functions ¶
func NewCMuxTCPTransport ¶
func NewCMuxTCPTransport( node *RaftNode, maxPool int, timeout time.Duration, logOutput io.Writer, ) (*raft.NetworkTransport, error)
NewCMuxTCPTransport returns a NetworkTransport that is built on top of a TCP streaming transport layer.
func NewCMuxTCPTransportWithConfig ¶
func NewCMuxTCPTransportWithConfig( node *RaftNode, config *raft.NetworkTransportConfig, ) (*raft.NetworkTransport, error)
NewCMuxTCPTransportWithConfig returns a NetworkTransport that is built on top of a TCP streaming transport layer, using the given config struct.
func NewCMuxTCPTransportWithLogger ¶
func NewCMuxTCPTransportWithLogger( node *RaftNode, maxPool int, timeout time.Duration, logger *log.Logger, ) (*raft.NetworkTransport, error)
NewCMuxTCPTransportWithLogger returns a NetworkTransport that is built on top of a TCP streaming transport layer, with log output going to the supplied Logger
func RegisterClusterServiceServer ¶
func RegisterClusterServiceServer(s *grpc.Server, srv ClusterServiceServer)
Types ¶
type Chunk ¶
type Chunk struct {
Content []byte `protobuf:"bytes,1,opt,name=Content,proto3" json:"Content,omitempty"`
}
func (*Chunk) Descriptor ¶
func (*Chunk) GetContent ¶
func (*Chunk) ProtoMessage ¶
func (*Chunk) ProtoMessage()
type ClusterInfo ¶
type ClusterInfo struct { LeaderId string `protobuf:"bytes,1,opt,name=leader_id,json=leaderId,proto3" json:"leader_id,omitempty"` Nodes map[string]*NodeInfo `` /* 137-byte string literal not displayed */ }
func (*ClusterInfo) Descriptor ¶
func (*ClusterInfo) Descriptor() ([]byte, []int)
func (*ClusterInfo) GetLeaderId ¶
func (m *ClusterInfo) GetLeaderId() string
func (*ClusterInfo) GetNodes ¶
func (m *ClusterInfo) GetNodes() map[string]*NodeInfo
func (*ClusterInfo) Marshal ¶
func (m *ClusterInfo) Marshal() (dAtA []byte, err error)
func (*ClusterInfo) ProtoMessage ¶
func (*ClusterInfo) ProtoMessage()
func (*ClusterInfo) Reset ¶
func (m *ClusterInfo) Reset()
func (*ClusterInfo) Size ¶
func (m *ClusterInfo) Size() (n int)
func (*ClusterInfo) String ¶
func (m *ClusterInfo) String() string
func (*ClusterInfo) Unmarshal ¶
func (m *ClusterInfo) Unmarshal(dAtA []byte) error
type ClusterServiceClient ¶
type ClusterServiceClient interface { JoinCluster(ctx context.Context, in *RaftJoinRequest, opts ...grpc.CallOption) (*RaftJoinResponse, error) FetchSnapshot(ctx context.Context, in *FetchSnapshotRequest, opts ...grpc.CallOption) (ClusterService_FetchSnapshotClient, error) FetchNodeInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) }
func NewClusterServiceClient ¶
func NewClusterServiceClient(cc *grpc.ClientConn) ClusterServiceClient
type ClusterServiceServer ¶
type ClusterServiceServer interface { JoinCluster(context.Context, *RaftJoinRequest) (*RaftJoinResponse, error) FetchSnapshot(*FetchSnapshotRequest, ClusterService_FetchSnapshotServer) error FetchNodeInfo(context.Context, *InfoRequest) (*InfoResponse, error) }
type ClusterService_FetchSnapshotClient ¶
type ClusterService_FetchSnapshotClient interface { Recv() (*Chunk, error) grpc.ClientStream }
type ClusterService_FetchSnapshotServer ¶
type ClusterService_FetchSnapshotServer interface { Send(*Chunk) error grpc.ServerStream }
type ClusteringOptions ¶
type ClusteringOptions struct { NodeID string // ID of the node within the cluster. Addr string // IP address where to listen for Raft commands. MgmtAddr string // IP address where to listen for management operations. HttpAddr string // IP address where clients can connect (this is used to populate node info) Bootstrap bool // Bootstrap the cluster as a seed node if there is no existing state. Seeds []string // List of cluster peer node IDs to bootstrap the cluster state. RaftLogPath string // Path to Raft log store directory. LogCacheSize int // Number of Raft log entries to cache in memory to reduce disk IO. LogSnapshots int // Number of Raft log snapshots to retain. SnapshotThreshold uint64 // Controls how many outstanding logs there must be before we perform a snapshot. TrailingLogs uint64 // Number of logs left after a snapshot. Sync bool // Do a file sync after every write to the Raft log and stable store. RaftLogging bool // Enable logging of Raft library (disabled by default since really verbose). // These will be set to some sane defaults. Change only if experiencing raft issues. RaftHeartbeatTimeout time.Duration RaftElectionTimeout time.Duration RaftLeaseTimeout time.Duration RaftCommitTimeout time.Duration RaftApplyTimeout time.Duration // Amount of time we wait for the command to be started. }
ClusteringOptions contains node options related to clustering.
func DefaultClusteringOptions ¶
func DefaultClusteringOptions() *ClusteringOptions
type FetchSnapshotRequest ¶
type FetchSnapshotRequest struct { StartSeqNum uint64 `protobuf:"varint,1,opt,name=startSeqNum,proto3" json:"startSeqNum,omitempty"` EndSeqNum uint64 `protobuf:"varint,2,opt,name=endSeqNum,proto3" json:"endSeqNum,omitempty"` }
func (*FetchSnapshotRequest) Descriptor ¶
func (*FetchSnapshotRequest) Descriptor() ([]byte, []int)
func (*FetchSnapshotRequest) GetEndSeqNum ¶
func (m *FetchSnapshotRequest) GetEndSeqNum() uint64
func (*FetchSnapshotRequest) GetStartSeqNum ¶
func (m *FetchSnapshotRequest) GetStartSeqNum() uint64
func (*FetchSnapshotRequest) Marshal ¶
func (m *FetchSnapshotRequest) Marshal() (dAtA []byte, err error)
func (*FetchSnapshotRequest) MarshalTo ¶
func (m *FetchSnapshotRequest) MarshalTo(dAtA []byte) (int, error)
func (*FetchSnapshotRequest) ProtoMessage ¶
func (*FetchSnapshotRequest) ProtoMessage()
func (*FetchSnapshotRequest) Reset ¶
func (m *FetchSnapshotRequest) Reset()
func (*FetchSnapshotRequest) Size ¶
func (m *FetchSnapshotRequest) Size() (n int)
func (*FetchSnapshotRequest) String ¶
func (m *FetchSnapshotRequest) String() string
func (*FetchSnapshotRequest) Unmarshal ¶
func (m *FetchSnapshotRequest) Unmarshal(dAtA []byte) error
type InfoRequest ¶
type InfoRequest struct { }
func (*InfoRequest) Descriptor ¶
func (*InfoRequest) Descriptor() ([]byte, []int)
func (*InfoRequest) Marshal ¶
func (m *InfoRequest) Marshal() (dAtA []byte, err error)
func (*InfoRequest) ProtoMessage ¶
func (*InfoRequest) ProtoMessage()
func (*InfoRequest) Reset ¶
func (m *InfoRequest) Reset()
func (*InfoRequest) Size ¶
func (m *InfoRequest) Size() (n int)
func (*InfoRequest) String ¶
func (m *InfoRequest) String() string
func (*InfoRequest) Unmarshal ¶
func (m *InfoRequest) Unmarshal(dAtA []byte) error
type InfoResponse ¶
type InfoResponse struct {
NodeInfo *NodeInfo `protobuf:"bytes,1,opt,name=node_info,json=nodeInfo" json:"node_info,omitempty"`
}
func (*InfoResponse) Descriptor ¶
func (*InfoResponse) Descriptor() ([]byte, []int)
func (*InfoResponse) GetNodeInfo ¶
func (m *InfoResponse) GetNodeInfo() *NodeInfo
func (*InfoResponse) Marshal ¶
func (m *InfoResponse) Marshal() (dAtA []byte, err error)
func (*InfoResponse) ProtoMessage ¶
func (*InfoResponse) ProtoMessage()
func (*InfoResponse) Reset ¶
func (m *InfoResponse) Reset()
func (*InfoResponse) Size ¶
func (m *InfoResponse) Size() (n int)
func (*InfoResponse) String ¶
func (m *InfoResponse) String() string
func (*InfoResponse) Unmarshal ¶
func (m *InfoResponse) Unmarshal(dAtA []byte) error
type NodeInfo ¶
type NodeInfo struct { NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` RaftAddr string `protobuf:"bytes,2,opt,name=raft_addr,json=raftAddr,proto3" json:"raft_addr,omitempty"` MgmtAddr string `protobuf:"bytes,3,opt,name=mgmt_addr,json=mgmtAddr,proto3" json:"mgmt_addr,omitempty"` HttpAddr string `protobuf:"bytes,4,opt,name=http_addr,json=httpAddr,proto3" json:"http_addr,omitempty"` MetricsAddr string `protobuf:"bytes,5,opt,name=metrics_addr,json=metricsAddr,proto3" json:"metrics_addr,omitempty"` }
func (*NodeInfo) Descriptor ¶
func (*NodeInfo) GetHttpAddr ¶
func (*NodeInfo) GetMetricsAddr ¶
func (*NodeInfo) GetMgmtAddr ¶
func (*NodeInfo) GetRaftAddr ¶
func (*NodeInfo) ProtoMessage ¶
func (*NodeInfo) ProtoMessage()
type RaftJoinRequest ¶
type RaftJoinRequest struct { NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` RaftAddr string `protobuf:"bytes,2,opt,name=raft_addr,json=raftAddr,proto3" json:"raft_addr,omitempty"` }
func (*RaftJoinRequest) Descriptor ¶
func (*RaftJoinRequest) Descriptor() ([]byte, []int)
func (*RaftJoinRequest) GetNodeId ¶
func (m *RaftJoinRequest) GetNodeId() string
func (*RaftJoinRequest) GetRaftAddr ¶
func (m *RaftJoinRequest) GetRaftAddr() string
func (*RaftJoinRequest) Marshal ¶
func (m *RaftJoinRequest) Marshal() (dAtA []byte, err error)
func (*RaftJoinRequest) ProtoMessage ¶
func (*RaftJoinRequest) ProtoMessage()
func (*RaftJoinRequest) Reset ¶
func (m *RaftJoinRequest) Reset()
func (*RaftJoinRequest) Size ¶
func (m *RaftJoinRequest) Size() (n int)
func (*RaftJoinRequest) String ¶
func (m *RaftJoinRequest) String() string
func (*RaftJoinRequest) Unmarshal ¶
func (m *RaftJoinRequest) Unmarshal(dAtA []byte) error
type RaftJoinResponse ¶
type RaftJoinResponse struct { }
func (*RaftJoinResponse) Descriptor ¶
func (*RaftJoinResponse) Descriptor() ([]byte, []int)
func (*RaftJoinResponse) Marshal ¶
func (m *RaftJoinResponse) Marshal() (dAtA []byte, err error)
func (*RaftJoinResponse) ProtoMessage ¶
func (*RaftJoinResponse) ProtoMessage()
func (*RaftJoinResponse) Reset ¶
func (m *RaftJoinResponse) Reset()
func (*RaftJoinResponse) Size ¶
func (m *RaftJoinResponse) Size() (n int)
func (*RaftJoinResponse) String ¶
func (m *RaftJoinResponse) String() string
func (*RaftJoinResponse) Unmarshal ¶
func (m *RaftJoinResponse) Unmarshal(dAtA []byte) error
type RaftNode ¶
func NewRaftNode ¶
func NewRaftNode(opts *ClusteringOptions, store storage.ManagedStore, snapshotsCh chan *protocol.Snapshot) (*RaftNode, error)
func (*RaftNode) Add ¶
Add function applies an add operation into a Raft balloon. As a result, it returns a shapshot, but previously it sends the snapshot to the agents channel, in order to be published/queried.
func (*RaftNode) AddBulk ¶
AddBulk function applies an add bulk operation into a Raft balloon. As a result, it returns a bulk of shapshots, but previously it sends each snapshot of the bulk to the agents channel, in order to be published/queried.
func (*RaftNode) Close ¶
Close closes the RaftNode. If wait is true, waits for a graceful shutdown. Once closed, a RaftNode may not be re-opened.
func (*RaftNode) ClusterInfo ¶
func (n *RaftNode) ClusterInfo() *ClusterInfo
ClusterInfo function returns Raft current node info plus certain raft cluster info. Used in /info/shard.
func (*RaftNode) CreateBackup ¶
Backup function calls store's backup function, passing certain metadata. Previously, it gets balloon version to build this metadata.
func (*RaftNode) DeleteBackup ¶
DeleteBackup function is a passthough to store's equivalent funcion.
func (*RaftNode) FetchNodeInfo ¶
func (n *RaftNode) FetchNodeInfo(ctx context.Context, req *InfoRequest) (*InfoResponse, error)
func (*RaftNode) FetchSnapshot ¶
func (n *RaftNode) FetchSnapshot(req *FetchSnapshotRequest, srv ClusterService_FetchSnapshotServer) error
func (*RaftNode) JoinCluster ¶
func (n *RaftNode) JoinCluster(ctx context.Context, req *RaftJoinRequest) (*RaftJoinResponse, error)
JoinCluster joins a node, identified by id and located at addr, to this store. The node must be ready to respond to Raft communications at that address. This must be called from the Leader or it will fail.
func (*RaftNode) ListBackups ¶
func (n *RaftNode) ListBackups() []*storage.BackupInfo
BackupsInfo function is a passthough to store's equivalent funcion.
func (*RaftNode) QueryConsistency ¶
func (n *RaftNode) QueryConsistency(start, end uint64) (*balloon.IncrementalProof, error)
QueryConsistency acts as a passthrough when requesting an incremental proof.
func (*RaftNode) QueryDigestMembership ¶
func (n *RaftNode) QueryDigestMembership(keyDigest hashing.Digest) (*balloon.MembershipProof, error)
QueryDigestMembership acts as a passthrough when an event digest is given to request a membership proof against the last balloon version.
func (*RaftNode) QueryDigestMembershipConsistency ¶
func (n *RaftNode) QueryDigestMembershipConsistency(keyDigest hashing.Digest, version uint64) (*balloon.MembershipProof, error)
QueryDigestMembershipConsistency acts as a passthrough when an event digest is given to request a membership proof against a certain balloon version.
func (*RaftNode) QueryMembership ¶
func (n *RaftNode) QueryMembership(event []byte) (*balloon.MembershipProof, error)
QueryMembership acts as a passthrough when an event is given to request a membership proof against the last balloon version.
func (*RaftNode) QueryMembershipConsistency ¶
func (n *RaftNode) QueryMembershipConsistency(event []byte, version uint64) (*balloon.MembershipProof, error)
QueryMembershipConsistency acts as a passthrough when an event is given to request a membership proof against a certain balloon version.
func (*RaftNode) RegisterMetrics ¶
RegisterMetrics register raft metrics: prometheus collectors and raftLog metrics.
func (*RaftNode) Restore ¶
func (n *RaftNode) Restore(rc io.ReadCloser) error
Restore restores the node to a previous state.
func (*RaftNode) Snapshot ¶
func (n *RaftNode) Snapshot() (raft.FSMSnapshot, error)
Snapshot returns a snapshot of the key-value store. The caller must ensure that no Raft transaction is taking place during this call. Hashicorp Raft guarantees that this function will not be called concurrently with Apply.
func (*RaftNode) StoreConfiguration ¶
func (n *RaftNode) StoreConfiguration(index uint64, config raft.Configuration)
StoreConfiguration is invoked once a log entry containing a configuration change is committed. It takes the index at which the configuration was written and the configuration value.
type TCPStreamLayer ¶
type TCPStreamLayer struct {
// contains filtered or unexported fields
}
TCPStreamLayer implements StreamLayer interface for plain TCP.
func (*TCPStreamLayer) Accept ¶
func (t *TCPStreamLayer) Accept() (c net.Conn, err error)
Accept implements the net.Listener interface.
func (*TCPStreamLayer) Addr ¶
func (t *TCPStreamLayer) Addr() net.Addr
Addr implements the net.Listener interface.
func (*TCPStreamLayer) Close ¶
func (t *TCPStreamLayer) Close() (err error)
Close implements the net.Listener interface.
func (*TCPStreamLayer) Dial ¶
func (t *TCPStreamLayer) Dial(address raft.ServerAddress, timeout time.Duration) (net.Conn, error)
Dial implements the StreamLayer interface.