discovery

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CandidateJoinAccumulator

type CandidateJoinAccumulator struct {
}

type ClusterBootstrapService

type ClusterBootstrapService struct {
	TransportService *transport.Service
}

func NewClusterBootstrapService

func NewClusterBootstrapService(service *transport.Service) *ClusterBootstrapService

type Coordinator

type Coordinator struct {
	TransportService *transport.Service
	PeerFinder       *CoordinatorPeerFinder
	PersistedState   state.PersistedState

	CoordinationState       state.CoordinationState
	ApplierState            *state.ClusterState
	ClusterApplierService   *cluster.ApplierService
	MasterService           *cluster.MasterService
	ClusterBootstrapService *ClusterBootstrapService

	PreVoteCollector *PreVoteCollector

	JoinHelper *JoinHelper

	Done func()

	Started bool
	// contains filtered or unexported fields
}

Coordinator

func NewCoordinator

func NewCoordinator(transportService *transport.Service, clusterApplierService *cluster.ApplierService, masterService *cluster.MasterService, persistedState state.PersistedState) *Coordinator

func (*Coordinator) Publish

func (c *Coordinator) Publish(event state.ClusterChangedEvent)

func (*Coordinator) Start

func (c *Coordinator) Start()

func (*Coordinator) StartInitialJoin

func (c *Coordinator) StartInitialJoin()

type CoordinatorPeerFinder

type CoordinatorPeerFinder struct {
	Coordinator *Coordinator

	LastAcceptedNodes *state.Nodes

	//TODO: 얘가 과연 *state.Node여야 할까?
	PeersByAddress map[string]*state.Node
	// contains filtered or unexported fields
}

func NewCoordinatorPeerFinder

func NewCoordinatorPeerFinder(coordinator *Coordinator) *CoordinatorPeerFinder

type FollowersChecker

type FollowersChecker struct {
}

type InitialJoinAccumulator

type InitialJoinAccumulator struct {
}

type JoinAccumulator

type JoinAccumulator interface {
	// contains filtered or unexported methods
}

type JoinHelper

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

func NewJoinHelper

func NewJoinHelper(
	transportService *transport.Service,
	joinLeaderInTerm func(request *StartJoinRequest) *state.Join,
	currentTermSupplier func() int64,
	joinHandler func(channel transport.ReplyChannel, req []byte)) *JoinHelper

func (*JoinHelper) SendJoinRequest

func (h *JoinHelper) SendJoinRequest(destination state.Node, term int64, join *state.Join)

func (*JoinHelper) SendStartJoinRequest

func (h *JoinHelper) SendStartJoinRequest(startJoinRequest StartJoinRequest, destination state.Node)

type JoinRequest

type JoinRequest struct {
	SourceNode  state.Node
	MinimumTerm int64
	Join        state.Join
}

func JoinRequestFromBytes

func JoinRequestFromBytes(b []byte) *JoinRequest

func (*JoinRequest) GetTerm

func (r *JoinRequest) GetTerm() int64

func (*JoinRequest) ToBytes

func (r *JoinRequest) ToBytes() []byte

type LeaderChecker

type LeaderChecker struct {
}

type Mode

type Mode int
const (
	INIT Mode = iota
	CANDIDATE
	LEADER
	FOLLOWER
	PREVOTING
)

type Module

type Module struct {
}

type PeersRequest

type PeersRequest struct {
	SourceNode state.Node
	KnownPeers []state.Node
}

func PeersRequestFromBytes

func PeersRequestFromBytes(b []byte) *PeersRequest

func (*PeersRequest) ToBytes

func (r *PeersRequest) ToBytes() []byte

type PeersResponse

type PeersResponse struct {
	MasterNode state.Node
	KnownPeers []state.Node
	Term       int64
}

func PeersResponseFromBytes

func PeersResponseFromBytes(b []byte) *PeersResponse

func (*PeersResponse) ToBytes

func (r *PeersResponse) ToBytes() []byte

type PreVoteCollector

type PreVoteCollector struct {
	Lock sync.RWMutex
	// contains filtered or unexported fields
}

func NewPreVoteCollector

func NewPreVoteCollector(transportService *transport.Service, startElection func(), updateMaxTermSeen func(term int64)) *PreVoteCollector

func (*PreVoteCollector) SetVote

func (p *PreVoteCollector) SetVote(key state.Node, value *PreVoteResponse)

func (*PreVoteCollector) Start

func (p *PreVoteCollector) Start()

type PreVoteRequest

type PreVoteRequest struct {
	SourceNode state.Node
	Term       int64
}

func NewPreVoteRequest

func NewPreVoteRequest(sourceNode state.Node, term int64) *PreVoteRequest

func PreVoteRequestFromBytes

func PreVoteRequestFromBytes(b []byte) *PreVoteRequest

func (*PreVoteRequest) ToBytes

func (p *PreVoteRequest) ToBytes() []byte

type PreVoteResponse

type PreVoteResponse struct {
	CurrentTerm int64
	Err         string
}

func NewPreVoteResponse

func NewPreVoteResponse(currentTerm int64) *PreVoteResponse

func PreVoteResponseFromBytes

func PreVoteResponseFromBytes(b []byte) *PreVoteResponse

func (*PreVoteResponse) ToBytes

func (p *PreVoteResponse) ToBytes() []byte

type StartJoinRequest

type StartJoinRequest struct {
	SourceNode state.Node
	Term       int64
}

Data Format

func StartJoinRequestFromBytes

func StartJoinRequestFromBytes(b []byte) *StartJoinRequest

func (*StartJoinRequest) ToBytes

func (r *StartJoinRequest) ToBytes() []byte

Jump to

Keyboard shortcuts

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