Documentation ¶
Overview ¶
Copyright 2018 The tiglabs raft Authors.
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.
Copyright 2018 The tiglabs raft Authors.
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 ¶
Constants ¶
const ( ConfAddNode ConfChangeType = 0 ConfRemoveNode ConfChangeType = 1 ConfUpdateNode ConfChangeType = 2 EntryNormal EntryType = 0 EntryConfChange EntryType = 1 PeerNormal PeerType = 0 PeerArbiter PeerType = 1 )
Variables ¶
This section is empty.
Functions ¶
func EncodeHBConext ¶
func EncodeHBConext(ctx HeartbeatContext) (buf []byte)
func ReturnMessage ¶
func ReturnMessage(msg *Message)
Types ¶
type ConfChange ¶
type ConfChange struct { Type ConfChangeType Peer Peer Context []byte }
func (*ConfChange) Decode ¶
func (c *ConfChange) Decode(datas []byte)
func (*ConfChange) String ¶
func (cc *ConfChange) String() string
type ConfChangeType ¶
type ConfChangeType byte
func (ConfChangeType) String ¶
func (t ConfChangeType) String() string
type HeartbeatContext ¶
type HeartbeatContext []uint64
func DecodeHBContext ¶
func DecodeHBContext(buf []byte) (ctx HeartbeatContext)
type Message ¶
type Message struct { Type MsgType ForceVote bool Reject bool RejectIndex uint64 ID uint64 From uint64 To uint64 Term uint64 LogTerm uint64 Index uint64 Commit uint64 SnapshotMeta SnapshotMeta Entries []*Entry Context []byte Snapshot Snapshot // No need for codec }
Message is the transport message.
func GetMessage ¶
func GetMessage() *Message
func (*Message) IsElectionMsg ¶
func (*Message) IsHeartbeatMsg ¶
func (*Message) IsResponseMsg ¶
type Peer ¶
type SnapIterator ¶
type Snapshot ¶
type Snapshot interface { SnapIterator ApplyIndex() uint64 Close() }
The Snapshot interface is supplied by the application to access the snapshot data of application.
type SnapshotMeta ¶
func (*SnapshotMeta) Decode ¶
func (m *SnapshotMeta) Decode(datas []byte)