roles

package
v0.0.0-...-f429149 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTest   = fmt.Errorf("proto: integer overflow")
)

Functions

func GetRoles

func GetRoles(state state.Manager, store store.Store) map[raft.RoleType]func(raft.Raft) raft.Role

GetRoles returns a mapping of role types to role factories

Types

type ActiveRole

type ActiveRole struct {
	*PassiveRole
}

ActiveRole implements a Raft follower

func (*ActiveRole) Append

func (r *ActiveRole) Append(ctx context.Context, request *raft.AppendRequest) (*raft.AppendResponse, error)

Append handles an append request

func (ActiveRole) Configure

func (r ActiveRole) Configure(ctx context.Context, request *raft.ConfigureRequest) (*raft.ConfigureResponse, error)

Configure handles a configure request

func (ActiveRole) Join

func (r ActiveRole) Join(ctx context.Context, request *raft.JoinRequest) (*raft.JoinResponse, error)

Join handles a join request

func (ActiveRole) Leave

func (r ActiveRole) Leave(ctx context.Context, request *raft.LeaveRequest) (*raft.LeaveResponse, error)

Leave handles a leave request

func (*ActiveRole) Poll

func (r *ActiveRole) Poll(ctx context.Context, request *raft.PollRequest) (*raft.PollResponse, error)

Poll handles a poll request

func (ActiveRole) Reconfigure

func (r ActiveRole) Reconfigure(ctx context.Context, request *raft.ReconfigureRequest) (*raft.ReconfigureResponse, error)

Reconfigure handles a reconfigure request

func (ActiveRole) Start

func (r ActiveRole) Start() error

Start starts the role

func (ActiveRole) Stop

func (r ActiveRole) Stop() error

Stop stops the role

func (ActiveRole) Transfer

func (r ActiveRole) Transfer(ctx context.Context, request *raft.TransferRequest) (*raft.TransferResponse, error)

Transfer handles a transfer request

func (*ActiveRole) Vote

func (r *ActiveRole) Vote(ctx context.Context, request *raft.VoteRequest) (*raft.VoteResponse, error)

Vote handles a vote request

type CandidateRole

type CandidateRole struct {
	*ActiveRole
	// contains filtered or unexported fields
}

CandidateRole implements a Raft candidate

func (CandidateRole) Configure

func (r CandidateRole) Configure(ctx context.Context, request *raft.ConfigureRequest) (*raft.ConfigureResponse, error)

Configure handles a configure request

func (CandidateRole) Join

func (r CandidateRole) Join(ctx context.Context, request *raft.JoinRequest) (*raft.JoinResponse, error)

Join handles a join request

func (CandidateRole) Leave

func (r CandidateRole) Leave(ctx context.Context, request *raft.LeaveRequest) (*raft.LeaveResponse, error)

Leave handles a leave request

func (CandidateRole) Reconfigure

func (r CandidateRole) Reconfigure(ctx context.Context, request *raft.ReconfigureRequest) (*raft.ReconfigureResponse, error)

Reconfigure handles a reconfigure request

func (*CandidateRole) Start

func (r *CandidateRole) Start() error

Start starts the candidate

func (*CandidateRole) Stop

func (r *CandidateRole) Stop() error

Stop stops the candidate

func (CandidateRole) Transfer

func (r CandidateRole) Transfer(ctx context.Context, request *raft.TransferRequest) (*raft.TransferResponse, error)

Transfer handles a transfer request

func (*CandidateRole) Type

func (r *CandidateRole) Type() raft.RoleType

Type is the role type

func (*CandidateRole) Vote

func (r *CandidateRole) Vote(ctx context.Context, request *raft.VoteRequest) (*raft.VoteResponse, error)

Vote handles a vote request

type FollowerRole

type FollowerRole struct {
	*ActiveRole
	// contains filtered or unexported fields
}

FollowerRole implements a Raft follower

func (*FollowerRole) Append

func (r *FollowerRole) Append(ctx context.Context, request *raft.AppendRequest) (*raft.AppendResponse, error)

Append handles an append request

func (*FollowerRole) Configure

func (r *FollowerRole) Configure(ctx context.Context, request *raft.ConfigureRequest) (*raft.ConfigureResponse, error)

Configure handles a configure request

func (*FollowerRole) Install

func (r *FollowerRole) Install(ch <-chan *raft.InstallStreamRequest) (*raft.InstallResponse, error)

Install handles an install request

func (FollowerRole) Join

func (r FollowerRole) Join(ctx context.Context, request *raft.JoinRequest) (*raft.JoinResponse, error)

Join handles a join request

func (FollowerRole) Leave

func (r FollowerRole) Leave(ctx context.Context, request *raft.LeaveRequest) (*raft.LeaveResponse, error)

Leave handles a leave request

func (FollowerRole) Reconfigure

func (r FollowerRole) Reconfigure(ctx context.Context, request *raft.ReconfigureRequest) (*raft.ReconfigureResponse, error)

Reconfigure handles a reconfigure request

func (*FollowerRole) Start

func (r *FollowerRole) Start() error

Start starts the follower

func (*FollowerRole) Stop

func (r *FollowerRole) Stop() error

Stop stops the follower

func (FollowerRole) Transfer

func (r FollowerRole) Transfer(ctx context.Context, request *raft.TransferRequest) (*raft.TransferResponse, error)

Transfer handles a transfer request

func (*FollowerRole) Type

func (r *FollowerRole) Type() raft.RoleType

Type is the role type

func (*FollowerRole) Vote

func (r *FollowerRole) Vote(ctx context.Context, request *raft.VoteRequest) (*raft.VoteResponse, error)

Vote handles a vote request

type GetRequest

type GetRequest struct {
}

Get request

func (*GetRequest) Descriptor

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

func (*GetRequest) Equal

func (this *GetRequest) Equal(that interface{}) bool

func (*GetRequest) Marshal

func (m *GetRequest) Marshal() (dAtA []byte, err error)

func (*GetRequest) MarshalTo

func (m *GetRequest) MarshalTo(dAtA []byte) (int, error)

func (*GetRequest) MarshalToSizedBuffer

func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) Reset

func (m *GetRequest) Reset()

func (*GetRequest) Size

func (m *GetRequest) Size() (n int)

func (*GetRequest) String

func (m *GetRequest) String() string

func (*GetRequest) Unmarshal

func (m *GetRequest) Unmarshal(dAtA []byte) error

func (*GetRequest) XXX_DiscardUnknown

func (m *GetRequest) XXX_DiscardUnknown()

func (*GetRequest) XXX_Marshal

func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetRequest) XXX_Merge

func (m *GetRequest) XXX_Merge(src proto.Message)

func (*GetRequest) XXX_Size

func (m *GetRequest) XXX_Size() int

func (*GetRequest) XXX_Unmarshal

func (m *GetRequest) XXX_Unmarshal(b []byte) error

type GetResponse

type GetResponse struct {
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
}

Get response

func (*GetResponse) Descriptor

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

func (*GetResponse) Equal

func (this *GetResponse) Equal(that interface{}) bool

func (*GetResponse) GetValue

func (m *GetResponse) GetValue() string

func (*GetResponse) Marshal

func (m *GetResponse) Marshal() (dAtA []byte, err error)

func (*GetResponse) MarshalTo

func (m *GetResponse) MarshalTo(dAtA []byte) (int, error)

func (*GetResponse) MarshalToSizedBuffer

func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) Reset

func (m *GetResponse) Reset()

func (*GetResponse) Size

func (m *GetResponse) Size() (n int)

func (*GetResponse) String

func (m *GetResponse) String() string

func (*GetResponse) Unmarshal

func (m *GetResponse) Unmarshal(dAtA []byte) error

func (*GetResponse) XXX_DiscardUnknown

func (m *GetResponse) XXX_DiscardUnknown()

func (*GetResponse) XXX_Marshal

func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetResponse) XXX_Merge

func (m *GetResponse) XXX_Merge(src proto.Message)

func (*GetResponse) XXX_Size

func (m *GetResponse) XXX_Size() int

func (*GetResponse) XXX_Unmarshal

func (m *GetResponse) XXX_Unmarshal(b []byte) error

type LeaderRole

type LeaderRole struct {
	*ActiveRole
	// contains filtered or unexported fields
}

LeaderRole implements a Raft leader

func (*LeaderRole) Append

func (r *LeaderRole) Append(ctx context.Context, request *raft.AppendRequest) (*raft.AppendResponse, error)

Append handles an append request

func (*LeaderRole) Command

func (r *LeaderRole) Command(request *raft.CommandRequest, responseCh chan<- *raft.CommandStreamResponse) error

Command handles a command request

func (LeaderRole) Configure

func (r LeaderRole) Configure(ctx context.Context, request *raft.ConfigureRequest) (*raft.ConfigureResponse, error)

Configure handles a configure request

func (LeaderRole) Join

func (r LeaderRole) Join(ctx context.Context, request *raft.JoinRequest) (*raft.JoinResponse, error)

Join handles a join request

func (LeaderRole) Leave

func (r LeaderRole) Leave(ctx context.Context, request *raft.LeaveRequest) (*raft.LeaveResponse, error)

Leave handles a leave request

func (*LeaderRole) Poll

func (r *LeaderRole) Poll(ctx context.Context, request *raft.PollRequest) (*raft.PollResponse, error)

Poll handles a poll request

func (*LeaderRole) Query

func (r *LeaderRole) Query(request *raft.QueryRequest, responseCh chan<- *raft.QueryStreamResponse) error

Query handles a query request

func (LeaderRole) Reconfigure

func (r LeaderRole) Reconfigure(ctx context.Context, request *raft.ReconfigureRequest) (*raft.ReconfigureResponse, error)

Reconfigure handles a reconfigure request

func (*LeaderRole) Start

func (r *LeaderRole) Start() error

Start starts the leader

func (*LeaderRole) Stop

func (r *LeaderRole) Stop() error

Stop stops the leader

func (LeaderRole) Transfer

func (r LeaderRole) Transfer(ctx context.Context, request *raft.TransferRequest) (*raft.TransferResponse, error)

Transfer handles a transfer request

func (*LeaderRole) Type

func (r *LeaderRole) Type() raft.RoleType

Type is the role type

func (*LeaderRole) Vote

func (r *LeaderRole) Vote(ctx context.Context, request *raft.VoteRequest) (*raft.VoteResponse, error)

Vote handles a vote request

type PassiveRole

type PassiveRole struct {
	// contains filtered or unexported fields
}

PassiveRole implements a Raft follower

func (*PassiveRole) Append

func (r *PassiveRole) Append(ctx context.Context, request *raft.AppendRequest) (*raft.AppendResponse, error)

Append handles an append request

func (*PassiveRole) Command

func (r *PassiveRole) Command(request *raft.CommandRequest, ch chan<- *raft.CommandStreamResponse) error

Command handles a command request

func (PassiveRole) Configure

func (r PassiveRole) Configure(ctx context.Context, request *raft.ConfigureRequest) (*raft.ConfigureResponse, error)

Configure handles a configure request

func (*PassiveRole) Install

func (r *PassiveRole) Install(ch <-chan *raft.InstallStreamRequest) (*raft.InstallResponse, error)

Install handles an install request

func (PassiveRole) Join

func (r PassiveRole) Join(ctx context.Context, request *raft.JoinRequest) (*raft.JoinResponse, error)

Join handles a join request

func (PassiveRole) Leave

func (r PassiveRole) Leave(ctx context.Context, request *raft.LeaveRequest) (*raft.LeaveResponse, error)

Leave handles a leave request

func (PassiveRole) Poll

func (r PassiveRole) Poll(ctx context.Context, request *raft.PollRequest) (*raft.PollResponse, error)

Poll handles a poll request

func (*PassiveRole) Query

func (r *PassiveRole) Query(request *raft.QueryRequest, ch chan<- *raft.QueryStreamResponse) error

Query handles a query request

func (PassiveRole) Reconfigure

func (r PassiveRole) Reconfigure(ctx context.Context, request *raft.ReconfigureRequest) (*raft.ReconfigureResponse, error)

Reconfigure handles a reconfigure request

func (PassiveRole) Start

func (r PassiveRole) Start() error

Start starts the role

func (PassiveRole) Stop

func (r PassiveRole) Stop() error

Stop stops the role

func (PassiveRole) Transfer

func (r PassiveRole) Transfer(ctx context.Context, request *raft.TransferRequest) (*raft.TransferResponse, error)

Transfer handles a transfer request

func (PassiveRole) Vote

func (r PassiveRole) Vote(ctx context.Context, request *raft.VoteRequest) (*raft.VoteResponse, error)

Vote handles a vote request

type SetRequest

type SetRequest struct {
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
}

Set request

func (*SetRequest) Descriptor

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

func (*SetRequest) Equal

func (this *SetRequest) Equal(that interface{}) bool

func (*SetRequest) GetValue

func (m *SetRequest) GetValue() string

func (*SetRequest) Marshal

func (m *SetRequest) Marshal() (dAtA []byte, err error)

func (*SetRequest) MarshalTo

func (m *SetRequest) MarshalTo(dAtA []byte) (int, error)

func (*SetRequest) MarshalToSizedBuffer

func (m *SetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SetRequest) ProtoMessage

func (*SetRequest) ProtoMessage()

func (*SetRequest) Reset

func (m *SetRequest) Reset()

func (*SetRequest) Size

func (m *SetRequest) Size() (n int)

func (*SetRequest) String

func (m *SetRequest) String() string

func (*SetRequest) Unmarshal

func (m *SetRequest) Unmarshal(dAtA []byte) error

func (*SetRequest) XXX_DiscardUnknown

func (m *SetRequest) XXX_DiscardUnknown()

func (*SetRequest) XXX_Marshal

func (m *SetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetRequest) XXX_Merge

func (m *SetRequest) XXX_Merge(src proto.Message)

func (*SetRequest) XXX_Size

func (m *SetRequest) XXX_Size() int

func (*SetRequest) XXX_Unmarshal

func (m *SetRequest) XXX_Unmarshal(b []byte) error

type SetResponse

type SetResponse struct {
}

Set response

func (*SetResponse) Descriptor

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

func (*SetResponse) Equal

func (this *SetResponse) Equal(that interface{}) bool

func (*SetResponse) Marshal

func (m *SetResponse) Marshal() (dAtA []byte, err error)

func (*SetResponse) MarshalTo

func (m *SetResponse) MarshalTo(dAtA []byte) (int, error)

func (*SetResponse) MarshalToSizedBuffer

func (m *SetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SetResponse) ProtoMessage

func (*SetResponse) ProtoMessage()

func (*SetResponse) Reset

func (m *SetResponse) Reset()

func (*SetResponse) Size

func (m *SetResponse) Size() (n int)

func (*SetResponse) String

func (m *SetResponse) String() string

func (*SetResponse) Unmarshal

func (m *SetResponse) Unmarshal(dAtA []byte) error

func (*SetResponse) XXX_DiscardUnknown

func (m *SetResponse) XXX_DiscardUnknown()

func (*SetResponse) XXX_Marshal

func (m *SetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetResponse) XXX_Merge

func (m *SetResponse) XXX_Merge(src proto.Message)

func (*SetResponse) XXX_Size

func (m *SetResponse) XXX_Size() int

func (*SetResponse) XXX_Unmarshal

func (m *SetResponse) XXX_Unmarshal(b []byte) error

type TestValueSnapshot

type TestValueSnapshot struct {
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
}

Test value snapshot

func (*TestValueSnapshot) Descriptor

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

func (*TestValueSnapshot) Equal

func (this *TestValueSnapshot) Equal(that interface{}) bool

func (*TestValueSnapshot) GetValue

func (m *TestValueSnapshot) GetValue() string

func (*TestValueSnapshot) Marshal

func (m *TestValueSnapshot) Marshal() (dAtA []byte, err error)

func (*TestValueSnapshot) MarshalTo

func (m *TestValueSnapshot) MarshalTo(dAtA []byte) (int, error)

func (*TestValueSnapshot) MarshalToSizedBuffer

func (m *TestValueSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TestValueSnapshot) ProtoMessage

func (*TestValueSnapshot) ProtoMessage()

func (*TestValueSnapshot) Reset

func (m *TestValueSnapshot) Reset()

func (*TestValueSnapshot) Size

func (m *TestValueSnapshot) Size() (n int)

func (*TestValueSnapshot) String

func (m *TestValueSnapshot) String() string

func (*TestValueSnapshot) Unmarshal

func (m *TestValueSnapshot) Unmarshal(dAtA []byte) error

func (*TestValueSnapshot) XXX_DiscardUnknown

func (m *TestValueSnapshot) XXX_DiscardUnknown()

func (*TestValueSnapshot) XXX_Marshal

func (m *TestValueSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TestValueSnapshot) XXX_Merge

func (m *TestValueSnapshot) XXX_Merge(src proto.Message)

func (*TestValueSnapshot) XXX_Size

func (m *TestValueSnapshot) XXX_Size() int

func (*TestValueSnapshot) XXX_Unmarshal

func (m *TestValueSnapshot) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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