Documentation ¶
Index ¶
- Constants
- Variables
- func BroadcastHandler(data interface{}, msg []byte) ([]byte, error)
- func BuildRsm(ctx context.Context, fd *FleetData, noBroadcast bool) error
- func EnsureLeaderActive(ctx context.Context, app *appdata.AppData) (bool, error)
- func IsLeader(fd *FleetData) bool
- func LeaderHandler(data interface{}, msg []byte) ([]byte, error)
- func LeaderLiveness(ctx context.Context, app *appdata.AppData)
- func MonitorRsmDrift(ctx context.Context, fd *FleetData)
- func NewRsm() *rsmT
- func NoLeader(fd *FleetData) bool
- func SendToLeader(ctx context.Context, app *appdata.AppData, m []byte, ...) ([]byte, error)
- type Accept
- type Accepted
- type FleetData
- type LearnValuesInput
- type LearnValuesOutput
- type LockState
- type MetaT
- type Prepare
- type Promise
- type ReachConsensusInput
- type ReachConsensusOutput
- type SendToLeaderExtra
- type SetValueHistoryT
Constants ¶
View Source
const (
EventSource = "juno/internal"
)
Variables ¶
View Source
var ( CtrlBroadcastTest = "CTRL_BROADCAST_TEST" CtrlBroadcastLeaderLiveness = "CTRL_BROADCAST_LEADER_LIVENESS" CtrlBroadcastWipRebuildRsm = "CTRL_BROADCAST_WIP_REBUILD_RSM" CtrlBroadcastPaxosPhase1Prepare = "CTRL_BROADCAST_PAXOS_PHASE1_PREPARE" CtrlBroadcastPaxosPhase2Accept = "CTRL_BROADCAST_PAXOS_PHASE2_ACCEPT" CtrlBroadcastPaxosSetValue = "CTRL_BROADCAST_PAXOS_SET_VALUE" CtrlBroadcastPaxosLearnValues = "CTRL_BROADCAST_PAXOS_LEARN_VALUES" CtrlBroadcastDoSnapshot = "CTRL_BROADCAST_DO_SNAPSHOT" )
View Source
var ( CmdTypeGetLock = "CMDTYPE_GET_LOCK" CmdTypeExtendLock = "CMDTYPE_EXTEND_LOCK" CmdTypeReleaseLock = "CMDTYPE_RELEASE_LOCK" CmdTypeAddToSet = "CMDTYPE_ADDTOSET" )
View Source
var ( ErrClusterOffline = fmt.Errorf("juno: Cluster not running.") ErrNoLeader = fmt.Errorf("juno: Leader unavailable. Please try again later.") ErrWipRebuild = fmt.Errorf("juno: State machine rebuild in progress. Please try again later.") )
View Source
var ( CtrlLeaderPingPong = "CTRL_PING_PONG" CtrlLeaderFwdConsensus = "CTRL_LEADER_FWD_CONSENSUS" CtrlLeaderGetLatestRound = "CTRL_LEADER_GET_LATEST_ROUND" )
Functions ¶
func BroadcastHandler ¶
func EnsureLeaderActive ¶
func LeaderHandler ¶
func MonitorRsmDrift ¶
MonitorRsmDrift monitors our local replicated log of missing indeces.
func SendToLeader ¶
Types ¶
type Accept ¶
type Accept struct { Round int64 `json:"round"` // multipaxos round number AcceptId int64 `json:"acceptId"` NodeId int64 `json:"nodeId"` // tie-breaker Value string `json:"value"` }
Phase 2a:
type Accepted ¶
type Accepted struct { Error error `json:"error"` // non-nil = NACK Round int64 `json:"round"` // multipaxos round number AcceptId int64 `json:"acceptId"` NodeId int64 `json:"nodeId"` // tie-breaker }
Phase 2b:
type FleetData ¶
type FleetData struct { App *appdata.AppData // global appdata StateMachine *rsmT // our replicated state machine BuildRsmWip *timedoff.TimedOff // pause ops when active BuildRsmOn int64 // non-zero means someone is rebuilding their RSM Online int32 // non-zero mean we are ready to serve SetValueMtx sync.RWMutex SetValueHistory map[int]*SetValueHistoryT // track incoming rounds since online, not complete SetValueLastRound int64 SetValueReady int32 // contains filtered or unexported fields }
type LearnValuesInput ¶
type LearnValuesInput struct {
Rounds []int `json:"rounds"`
}
type LearnValuesOutput ¶
type LearnValuesOutput struct {
Value Accept `json:"value"` // reuse
}
type Prepare ¶
type Prepare struct { PrepareId int64 `json:"prepareId"` // proposal NodeId int64 `json:"nodeId"` // tie-breaker Round int64 `json:"round"` // multipaxos round number }
Phase 1a:
type Promise ¶
type Promise struct { Error error `json:"error"` // non-nil = NACK PrepareId int64 `json:"prepareId"` // proposal NodeId int64 `json:"nodeId"` // tie-breaker Round int64 `json:"round"` // multipaxos round number LastPrepareId int64 `json:"lastPrepareId"` LastAcceptedId int64 `json:"lastAcceptedId"` Value string `json:"value"` }
Phase 1b:
type ReachConsensusInput ¶
type ReachConsensusOutput ¶
type ReachConsensusOutput struct { Round int64 `json:"round,omitempty"` Key string `json:"key,omitempty"` Value string `json:"value,omitempty"` }
func ReachConsensus ¶
func ReachConsensus(ctx context.Context, in *ReachConsensusInput) (*ReachConsensusOutput, error)
ReachConsensus is our generic function to reach consensus on a value across a quorum of nodes using the multi-paxos algorithm variant. Normally called by the leader.
type SendToLeaderExtra ¶
type SetValueHistoryT ¶
Click to show internal directories.
Click to hide internal directories.