raft

package
v0.0.0-...-1a6bc1e Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2017 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package raft is a generated protocol buffer package.

It is generated from these files:

raft/raft.proto

It has these top-level messages:

EmptyMessage
EntryRequest
AppendEntriesRequest
StateMachineCommand
KeyStateCommand
Node
Configuration
DemoCommand
Entry
LogEntry
AppendEntriesResponse
RequestVoteRequest
RequestVoteResponse
SnapshotRequest
SnapshotResponse

Index

Constants

This section is empty.

Variables

View Source
var Configuration_ConfigurationType_name = map[int32]string{
	0: "CurrentConfiguration",
	1: "FutureConfiguration",
}
View Source
var Configuration_ConfigurationType_value = map[string]int32{
	"CurrentConfiguration": 0,
	"FutureConfiguration":  1,
}
View Source
var Entry_EntryType_name = map[int32]string{
	0: "StateMachineCommand",
	1: "ConfigurationChange",
	2: "Demo",
	3: "KeyStateCommand",
}
View Source
var Entry_EntryType_value = map[string]int32{
	"StateMachineCommand": 0,
	"ConfigurationChange": 1,
	"Demo":                2,
	"KeyStateCommand":     3,
}
View Source
var KeyStateCommand_KSMType_name = map[int32]string{
	0: "UpdateKeyPiece",
	1: "NewGeneration",
	2: "OwnerComplete",
}
View Source
var KeyStateCommand_KSMType_value = map[string]int32{
	"UpdateKeyPiece": 0,
	"NewGeneration":  1,
	"OwnerComplete":  2,
}

Functions

func RegisterRaftNetworkServer

func RegisterRaftNetworkServer(s *grpc.Server, srv RaftNetworkServer)

Types

type AppendEntriesRequest

type AppendEntriesRequest struct {
	Term         uint64   `protobuf:"varint,1,opt,name=term" json:"term,omitempty"`
	LeaderId     string   `protobuf:"bytes,2,opt,name=leader_id" json:"leader_id,omitempty"`
	PrevLogIndex uint64   `protobuf:"varint,3,opt,name=prev_log_index" json:"prev_log_index,omitempty"`
	PrevLogTerm  uint64   `protobuf:"varint,4,opt,name=prev_log_term" json:"prev_log_term,omitempty"`
	Entries      []*Entry `protobuf:"bytes,5,rep,name=entries" json:"entries,omitempty"`
	LeaderCommit uint64   `protobuf:"varint,6,opt,name=leader_commit" json:"leader_commit,omitempty"`
}

func (*AppendEntriesRequest) Descriptor

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

func (*AppendEntriesRequest) GetEntries

func (m *AppendEntriesRequest) GetEntries() []*Entry

func (*AppendEntriesRequest) ProtoMessage

func (*AppendEntriesRequest) ProtoMessage()

func (*AppendEntriesRequest) Reset

func (m *AppendEntriesRequest) Reset()

func (*AppendEntriesRequest) String

func (m *AppendEntriesRequest) String() string

type AppendEntriesResponse

type AppendEntriesResponse struct {
	Term      uint64 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"`
	NextIndex uint64 `protobuf:"varint,2,opt,name=next_index" json:"next_index,omitempty"`
	Success   bool   `protobuf:"varint,3,opt,name=success" json:"success,omitempty"`
}

func (*AppendEntriesResponse) Descriptor

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

func (*AppendEntriesResponse) ProtoMessage

func (*AppendEntriesResponse) ProtoMessage()

func (*AppendEntriesResponse) Reset

func (m *AppendEntriesResponse) Reset()

func (*AppendEntriesResponse) String

func (m *AppendEntriesResponse) String() string

type Configuration

type Configuration struct {
	Type  Configuration_ConfigurationType `protobuf:"varint,1,opt,name=type,enum=raft.Configuration_ConfigurationType" json:"type,omitempty"`
	Nodes []*Node                         `protobuf:"bytes,2,rep,name=nodes" json:"nodes,omitempty"`
}

func (*Configuration) Descriptor

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

func (*Configuration) GetNodes

func (m *Configuration) GetNodes() []*Node

func (*Configuration) ProtoMessage

func (*Configuration) ProtoMessage()

func (*Configuration) Reset

func (m *Configuration) Reset()

func (*Configuration) String

func (m *Configuration) String() string

type Configuration_ConfigurationType

type Configuration_ConfigurationType int32
const (
	Configuration_CurrentConfiguration Configuration_ConfigurationType = 0
	Configuration_FutureConfiguration  Configuration_ConfigurationType = 1
)

func (Configuration_ConfigurationType) EnumDescriptor

func (Configuration_ConfigurationType) EnumDescriptor() ([]byte, []int)

func (Configuration_ConfigurationType) String

type DemoCommand

type DemoCommand struct {
	Number uint64 `protobuf:"varint,1,opt,name=number" json:"number,omitempty"`
}

func (*DemoCommand) Descriptor

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

func (*DemoCommand) ProtoMessage

func (*DemoCommand) ProtoMessage()

func (*DemoCommand) Reset

func (m *DemoCommand) Reset()

func (*DemoCommand) String

func (m *DemoCommand) String() string

type EmptyMessage

type EmptyMessage struct {
}

func (*EmptyMessage) Descriptor

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

func (*EmptyMessage) ProtoMessage

func (*EmptyMessage) ProtoMessage()

func (*EmptyMessage) Reset

func (m *EmptyMessage) Reset()

func (*EmptyMessage) String

func (m *EmptyMessage) String() string

type Entry

type Entry struct {
	Type       Entry_EntryType      `protobuf:"varint,1,opt,name=type,enum=raft.Entry_EntryType" json:"type,omitempty"`
	Uuid       string               `protobuf:"bytes,2,opt,name=uuid" json:"uuid,omitempty"`
	Command    *StateMachineCommand `protobuf:"bytes,3,opt,name=command" json:"command,omitempty"`
	Config     *Configuration       `protobuf:"bytes,4,opt,name=config" json:"config,omitempty"`
	Demo       *DemoCommand         `protobuf:"bytes,5,opt,name=demo" json:"demo,omitempty"`
	KeyCommand *KeyStateCommand     `protobuf:"bytes,6,opt,name=key_command" json:"key_command,omitempty"`
}

func (*Entry) Descriptor

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

func (*Entry) GetCommand

func (m *Entry) GetCommand() *StateMachineCommand

func (*Entry) GetConfig

func (m *Entry) GetConfig() *Configuration

func (*Entry) GetDemo

func (m *Entry) GetDemo() *DemoCommand

func (*Entry) GetKeyCommand

func (m *Entry) GetKeyCommand() *KeyStateCommand

func (*Entry) ProtoMessage

func (*Entry) ProtoMessage()

func (*Entry) Reset

func (m *Entry) Reset()

func (*Entry) String

func (m *Entry) String() string

type EntryRequest

type EntryRequest struct {
	SenderId string `protobuf:"bytes,1,opt,name=sender_id" json:"sender_id,omitempty"`
	Entry    *Entry `protobuf:"bytes,2,opt,name=entry" json:"entry,omitempty"`
}

func (*EntryRequest) Descriptor

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

func (*EntryRequest) GetEntry

func (m *EntryRequest) GetEntry() *Entry

func (*EntryRequest) ProtoMessage

func (*EntryRequest) ProtoMessage()

func (*EntryRequest) Reset

func (m *EntryRequest) Reset()

func (*EntryRequest) String

func (m *EntryRequest) String() string

type Entry_EntryType

type Entry_EntryType int32
const (
	Entry_StateMachineCommand Entry_EntryType = 0
	Entry_ConfigurationChange Entry_EntryType = 1
	Entry_Demo                Entry_EntryType = 2
	Entry_KeyStateCommand     Entry_EntryType = 3
)

func (Entry_EntryType) EnumDescriptor

func (Entry_EntryType) EnumDescriptor() ([]byte, []int)

func (Entry_EntryType) String

func (x Entry_EntryType) String() string

type KeyStateCommand

type KeyStateCommand struct {
	Type KeyStateCommand_KSMType `protobuf:"varint,1,opt,name=type,enum=raft.KeyStateCommand_KSMType" json:"type,omitempty"`
	// UpdateKeyPiece arguments
	KeyOwner   *Node `protobuf:"bytes,2,opt,name=key_owner" json:"key_owner,omitempty"`
	KeyHolder  *Node `protobuf:"bytes,3,opt,name=key_holder" json:"key_holder,omitempty"`
	Generation int64 `protobuf:"varint,4,opt,name=generation" json:"generation,omitempty"`
	// NewGeneration arguments
	NewNode string `protobuf:"bytes,5,opt,name=new_node" json:"new_node,omitempty"`
	// OwnerCompete arguments
	OwnerComplete string `protobuf:"bytes,6,opt,name=owner_complete" json:"owner_complete,omitempty"`
}

func (*KeyStateCommand) Descriptor

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

func (*KeyStateCommand) GetKeyHolder

func (m *KeyStateCommand) GetKeyHolder() *Node

func (*KeyStateCommand) GetKeyOwner

func (m *KeyStateCommand) GetKeyOwner() *Node

func (*KeyStateCommand) ProtoMessage

func (*KeyStateCommand) ProtoMessage()

func (*KeyStateCommand) Reset

func (m *KeyStateCommand) Reset()

func (*KeyStateCommand) String

func (m *KeyStateCommand) String() string

type KeyStateCommand_KSMType

type KeyStateCommand_KSMType int32
const (
	KeyStateCommand_UpdateKeyPiece KeyStateCommand_KSMType = 0
	KeyStateCommand_NewGeneration  KeyStateCommand_KSMType = 1
	KeyStateCommand_OwnerComplete  KeyStateCommand_KSMType = 2
)

func (KeyStateCommand_KSMType) EnumDescriptor

func (KeyStateCommand_KSMType) EnumDescriptor() ([]byte, []int)

func (KeyStateCommand_KSMType) String

func (x KeyStateCommand_KSMType) String() string

type LogEntry

type LogEntry struct {
	Term  uint64 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"`
	Entry *Entry `protobuf:"bytes,2,opt,name=entry" json:"entry,omitempty"`
}

func (*LogEntry) Descriptor

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

func (*LogEntry) GetEntry

func (m *LogEntry) GetEntry() *Entry

func (*LogEntry) ProtoMessage

func (*LogEntry) ProtoMessage()

func (*LogEntry) Reset

func (m *LogEntry) Reset()

func (*LogEntry) String

func (m *LogEntry) String() string

type Node

type Node struct {
	Ip         string `protobuf:"bytes,1,opt,name=ip" json:"ip,omitempty"`
	Port       string `protobuf:"bytes,2,opt,name=port" json:"port,omitempty"`
	CommonName string `protobuf:"bytes,3,opt,name=common_name" json:"common_name,omitempty"`
	NodeId     string `protobuf:"bytes,4,opt,name=node_id" json:"node_id,omitempty"`
}

func (*Node) Descriptor

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

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) Reset

func (m *Node) Reset()

func (*Node) String

func (m *Node) String() string

type RaftNetworkClient

type RaftNetworkClient interface {
	AppendEntries(ctx context.Context, in *AppendEntriesRequest, opts ...grpc.CallOption) (*AppendEntriesResponse, error)
	RequestVote(ctx context.Context, in *RequestVoteRequest, opts ...grpc.CallOption) (*RequestVoteResponse, error)
	ClientToLeaderRequest(ctx context.Context, in *EntryRequest, opts ...grpc.CallOption) (*EmptyMessage, error)
	InstallSnapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (*SnapshotResponse, error)
}

func NewRaftNetworkClient

func NewRaftNetworkClient(cc *grpc.ClientConn) RaftNetworkClient

type RaftNetworkServer

type RaftNetworkServer interface {
	AppendEntries(context.Context, *AppendEntriesRequest) (*AppendEntriesResponse, error)
	RequestVote(context.Context, *RequestVoteRequest) (*RequestVoteResponse, error)
	ClientToLeaderRequest(context.Context, *EntryRequest) (*EmptyMessage, error)
	InstallSnapshot(context.Context, *SnapshotRequest) (*SnapshotResponse, error)
}

type RequestVoteRequest

type RequestVoteRequest struct {
	Term         uint64 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"`
	CandidateId  string `protobuf:"bytes,2,opt,name=candidate_id" json:"candidate_id,omitempty"`
	LastLogIndex uint64 `protobuf:"varint,3,opt,name=last_log_index" json:"last_log_index,omitempty"`
	LastLogTerm  uint64 `protobuf:"varint,4,opt,name=last_log_term" json:"last_log_term,omitempty"`
}

func (*RequestVoteRequest) Descriptor

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

func (*RequestVoteRequest) ProtoMessage

func (*RequestVoteRequest) ProtoMessage()

func (*RequestVoteRequest) Reset

func (m *RequestVoteRequest) Reset()

func (*RequestVoteRequest) String

func (m *RequestVoteRequest) String() string

type RequestVoteResponse

type RequestVoteResponse struct {
	Term        uint64 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"`
	VoteGranted bool   `protobuf:"varint,2,opt,name=vote_granted" json:"vote_granted,omitempty"`
}

func (*RequestVoteResponse) Descriptor

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

func (*RequestVoteResponse) ProtoMessage

func (*RequestVoteResponse) ProtoMessage()

func (*RequestVoteResponse) Reset

func (m *RequestVoteResponse) Reset()

func (*RequestVoteResponse) String

func (m *RequestVoteResponse) String() string

type SnapshotRequest

type SnapshotRequest struct {
	Term              uint64 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"`
	LeaderId          string `protobuf:"bytes,2,opt,name=leader_id" json:"leader_id,omitempty"`
	LastIncludedIndex uint64 `protobuf:"varint,3,opt,name=last_included_index" json:"last_included_index,omitempty"`
	LastIncludedTerm  uint64 `protobuf:"varint,4,opt,name=last_included_term" json:"last_included_term,omitempty"`
	Offset            uint64 `protobuf:"varint,5,opt,name=offset" json:"offset,omitempty"`
	Data              []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
	Done              bool   `protobuf:"varint,7,opt,name=done" json:"done,omitempty"`
}

func (*SnapshotRequest) Descriptor

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

func (*SnapshotRequest) ProtoMessage

func (*SnapshotRequest) ProtoMessage()

func (*SnapshotRequest) Reset

func (m *SnapshotRequest) Reset()

func (*SnapshotRequest) String

func (m *SnapshotRequest) String() string

type SnapshotResponse

type SnapshotResponse struct {
	Term uint64 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"`
}

func (*SnapshotResponse) Descriptor

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

func (*SnapshotResponse) ProtoMessage

func (*SnapshotResponse) ProtoMessage()

func (*SnapshotResponse) Reset

func (m *SnapshotResponse) Reset()

func (*SnapshotResponse) String

func (m *SnapshotResponse) String() string

type StateMachineCommand

type StateMachineCommand struct {
	Type uint32 `protobuf:"varint,1,opt,name=type" json:"type,omitempty"`
	Path string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"`
	// Used for Write command
	Data   []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	Offset int64  `protobuf:"varint,4,opt,name=offset" json:"offset,omitempty"`
	// Used for Write and Truncate commands
	Length int64 `protobuf:"varint,5,opt,name=length" json:"length,omitempty"`
	// Used for Link and Rename commands
	OldPath string `protobuf:"bytes,6,opt,name=old_path" json:"old_path,omitempty"`
	NewPath string `protobuf:"bytes,7,opt,name=new_path" json:"new_path,omitempty"`
	// Used for Create, Chmod and Mkdir commands
	Mode uint32 `protobuf:"varint,8,opt,name=mode" json:"mode,omitempty"`
	// Used for Utimes command
	AccessSeconds     int64 `protobuf:"varint,9,opt,name=access_seconds" json:"access_seconds,omitempty"`
	AccessNanoseconds int64 `protobuf:"varint,10,opt,name=access_nanoseconds" json:"access_nanoseconds,omitempty"`
	ModifySeconds     int64 `protobuf:"varint,11,opt,name=modify_seconds" json:"modify_seconds,omitempty"`
	ModifyNanoseconds int64 `protobuf:"varint,12,opt,name=modify_nanoseconds" json:"modify_nanoseconds,omitempty"`
}

func (*StateMachineCommand) Descriptor

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

func (*StateMachineCommand) ProtoMessage

func (*StateMachineCommand) ProtoMessage()

func (*StateMachineCommand) Reset

func (m *StateMachineCommand) Reset()

func (*StateMachineCommand) String

func (m *StateMachineCommand) String() string

Jump to

Keyboard shortcuts

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