Documentation
¶
Index ¶
Constants ¶
View Source
const ( InvSingleOwner = "single_committed_owner" InvTokenMonotonic = "token_monotonic" InvStaleRelease = "stale_release_rejected" InvTransferBounded = "transfer_not_pending_forever" InvAbortNoAdvance = "abort_no_token_advance" InvCommitAdvancesOnce = "commit_advances_once" InvUnownedKeepsToken = "unowned_keeps_token" InvReservedHasOwner = "reserved_has_owner" InvCrashKeepsOwnership = "crash_candidate_keeps_ownership" InvSingleAcquireWinner = "single_acquire_winner" InvExpireKeepsToken = "expire_keeps_token" InvOverflowTerminal = "overflow_terminal" InvIdempotentNoDouble = "idempotent_no_double_advance" InvNoLocalLeaseInvent = "no_local_lease_extension_while_disconnected" InvProtectedEpoch = "protected_resource_epoch" )
Invariant names for failure records.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
Type ActionType `json:"type"`
Generation string `json:"generation,omitempty"`
Claim string `json:"claim,omitempty"`
Successor string `json:"successor,omitempty"`
OpID string `json:"operation_id,omitempty"`
Delta time.Duration `json:"delta,omitempty"`
}
Action is a single protocol step.
type ActionType ¶
type ActionType string
ActionType enumerates protocol actions.
const ( ActRegisterGeneration ActionType = "register_generation" ActPassReadiness ActionType = "pass_readiness" ActFailReadiness ActionType = "fail_readiness" ActRequestClaim ActionType = "request_claim" ActRenewClaim ActionType = "renew_claim" ActBeginDrain ActionType = "begin_drain" ActCompleteDrain ActionType = "complete_drain" ActPrepareTransfer ActionType = "prepare_transfer" ActCommitTransfer ActionType = "commit_transfer" ActAbortTransfer ActionType = "abort_transfer" ActPause ActionType = "pause" ActResume ActionType = "resume" ActDisconnect ActionType = "disconnect" ActReconnect ActionType = "reconnect" ActExpireLease ActionType = "expire_lease" ActCrashOwner ActionType = "crash_owner" ActCrashCandidate ActionType = "crash_candidate" ActRestartBackend ActionType = "restart_backend" ActForceRevoke ActionType = "force_revoke" ActAdvanceTime ActionType = "advance_time" ActReleaseClaim ActionType = "release_claim" )
type Claim ¶
type Claim struct {
Name string
Owner string
Token uint64
Phase ClaimPhase
PendingSuccessor string
ExpiresAt int64 // model time units
TransferDeadline int64
LastOpID string
OpResults map[string]opSnap // idempotency
}
Claim is model ownership state.
type ClaimPhase ¶
type ClaimPhase string
ClaimPhase mirrors shiftlock claim phases.
const ( PhaseUnowned ClaimPhase = "unowned" PhaseOwned ClaimPhase = "owned" PhaseReserved ClaimPhase = "reserved" PhaseDraining ClaimPhase = "draining" )
type FailureRecord ¶
type FailureRecord struct {
Seed int64 `json:"seed"`
Claim string `json:"claim"`
Actions []Action `json:"actions"`
Invariant string `json:"invariant"`
Detail string `json:"detail"`
}
FailureRecord is a minimal reproducible sequence.
func (FailureRecord) JSON ¶
func (f FailureRecord) JSON() string
func (FailureRecord) ReproduceCmd ¶
func (f FailureRecord) ReproduceCmd() string
type Generation ¶
type Generation struct {
ID string
State GenState
Paused bool
Connected bool
Ready bool
Draining bool
}
Generation is model state for one process generation.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator produces randomized legal-ish action sequences.
func NewGenerator ¶
NewGenerator creates a sequence generator.
type World ¶
type World struct {
Now int64
LeaseTTL int64
TransferTO int64
Gens map[string]*Generation
Claims map[string]*Claim
ProtectedEpoch map[string]uint64 // last accepted fencing token per claim (resource)
History []Action
}
World is the deterministic protocol world.
func (*World) Apply ¶
Apply executes one action against the world. Returns error on illegal transition.
func (*World) CheckInvariants ¶
CheckInvariants verifies all 15 invariants. Returns invariant name + detail on failure.
func (*World) TokenSnapshot ¶
Click to show internal directories.
Click to hide internal directories.