Documentation
¶
Overview ¶
Package multihost implements the evidence-bounded hub/peer protocol.
Index ¶
- Constants
- Variables
- type AbortRequest
- type AbortResultDTO
- type ErrorDTO
- type FinishAcceptedDTO
- type FinishRunRequest
- type Hub
- func (h *Hub) Abort(ctx context.Context, run *HubRun) ([]PeerResult, string)
- func (h *Hub) Finish(ctx context.Context, run *HubRun, hubBytes int64) ([]PeerResult, string)
- func (h *Hub) Preflight(ctx context.Context) []PeerResult
- func (h *Hub) Start(ctx context.Context, runID, nonce string) (*HubRun, error)
- type HubConfig
- type HubPeerConfig
- type HubRun
- type LeaseDTO
- type LocalSnapshot
- type ParticipantFailureDTO
- type Peer
- type PeerInfoDTO
- type PeerOptions
- type PeerResult
- type RunStatusDTO
- type SectionIssueDTO
- type SnapshotBudgetDTO
- type SnapshotMetaDTO
- type StartResultDTO
- type StartRunRequest
- type TargetSummaryDTO
Constants ¶
View Source
const ( ProtocolVersion = 1 SchemaVersion = 1 MaxPeers = 8 RetainedRuns = 2 NonceHistoryMax = 64 MaxRequestBytes = 64 << 10 PeerSelfCapBytes = 8 << 20 TotalSnapshotCap = 32 << 20 HubSelfReserve = 16 << 20 PerPeerDefaultBytes = 4 << 20 MinPeerBytes = 512 << 10 BudgetReserve = 4 << 10 PeerStartedLease = 45 * time.Second PeerStartedLeaseMax = 90 * time.Second PeerAckLease = 90 * time.Second )
Variables ¶
View Source
var ( ErrPeerDisabled = errors.New("isutools: peer disabled") ErrPeerConfig = errors.New("isutools: invalid peer configuration") )
Functions ¶
This section is empty.
Types ¶
type AbortRequest ¶
type AbortRequest struct {
Reason string `json:"reason,omitempty"`
}
type AbortResultDTO ¶
type AbortResultDTO struct {
RunID string `json:"run_id"`
Epoch uint64 `json:"epoch"`
State string `json:"state"`
Reason string `json:"reason"`
PeerReason string `json:"peer_reason"`
Detached bool `json:"detached"`
Partial []string `json:"partial,omitempty"`
SnapshotDiscarded bool `json:"snapshot_discarded"`
AbortedAt time.Time `json:"aborted_at"`
}
type FinishAcceptedDTO ¶
type FinishAcceptedDTO struct {
RunID string `json:"run_id"`
Epoch uint64 `json:"epoch"`
State string `json:"state"`
Validity string `json:"validity"`
Collectors []runctl.CollectorBoundary `json:"collectors"`
GenerationWindow runctl.BoundaryWindow `json:"generation_window"`
BoundaryWindow runctl.BoundaryWindow `json:"boundary_window"`
FinishLeaseExpiresAt time.Time `json:"finish_lease_expires_at"`
AcceptedAt time.Time `json:"accepted_at"`
}
type FinishRunRequest ¶
type FinishRunRequest struct{}
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) Abort ¶
Abort stops lease renewal and seals every started participant with abort. It is idempotent at the peer protocol layer.
type HubPeerConfig ¶
type HubRun ¶
type HubRun struct {
RunID string
Nonce string
Validity string
Peers []PeerResult
// contains filtered or unexported fields
}
type LocalSnapshot ¶
type LocalSnapshot struct {
SchemaVersion int `json:"schema_version"`
RunID string `json:"run_id"`
LocalRunID string `json:"local_run_id"`
Epoch uint64 `json:"epoch"`
Validity string `json:"validity"`
Meta SnapshotMetaDTO `json:"meta"`
Sections map[string]json.RawMessage `json:"sections"`
Issues []SectionIssueDTO `json:"issues,omitempty"`
Budget SnapshotBudgetDTO `json:"budget"`
}
type ParticipantFailureDTO ¶
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func NewPeer ¶
func NewPeer(o PeerOptions) (*Peer, error)
func (*Peer) DebugCounts ¶
func (*Peer) Info ¶
func (p *Peer) Info() PeerInfoDTO
type PeerInfoDTO ¶
type PeerInfoDTO struct {
ProtocolVersion int `json:"protocol_version"`
SchemaVersion int `json:"schema_version"`
LibraryVersion string `json:"library_version"`
AgentID string `json:"agent_id"`
Form string `json:"form"`
Role string `json:"role"`
Sections []string `json:"sections"`
Capabilities []string `json:"capabilities"`
Identity hoststats.Identity `json:"identity"`
CgroupScope string `json:"cgroup_scope"`
Targets []TargetSummaryDTO `json:"targets,omitempty"`
ActiveRunID string `json:"active_run_id,omitempty"`
StartedAt time.Time `json:"started_at"`
}
type PeerOptions ¶
type PeerOptions struct {
Enabled bool
Token string
Role string
Form string
AgentID string
MaxBytes int64
Sections []string
Capabilities []string
Identity hoststats.Identity
CgroupScope string
Targets []TargetSummaryDTO
Controller *runctl.Controller
Snapshot func(*runctl.Snapshot) map[string]any
Now func() time.Time
StartedAt time.Time
}
type PeerResult ¶
type PeerResult struct {
Name string `json:"name"`
Info PeerInfoDTO `json:"info"`
Required bool `json:"required"`
Form string `json:"form"`
Start *StartResultDTO `json:"start,omitempty"`
Finish *FinishAcceptedDTO `json:"finish,omitempty"`
Status *RunStatusDTO `json:"status,omitempty"`
Aborted *AbortResultDTO `json:"aborted,omitempty"`
Failure *ParticipantFailureDTO `json:"failure,omitempty"`
Sealed string `json:"sealed"`
StartSendAck [2]time.Time `json:"start_send_ack"`
FinishSendAck [2]time.Time `json:"finish_send_ack"`
Issues []SectionIssueDTO `json:"issues,omitempty"`
Local *LocalSnapshot `json:"local,omitempty"`
}
type RunStatusDTO ¶
type RunStatusDTO struct {
RunID string `json:"run_id"`
LocalRunID string `json:"local_run_id"`
Epoch uint64 `json:"epoch"`
State string `json:"state"`
Validity string `json:"validity"`
Reason string `json:"reason,omitempty"`
AckedBy string `json:"acked_by,omitempty"`
Detached bool `json:"detached,omitempty"`
Since time.Time `json:"since"`
Origin string `json:"origin"`
LeaseExpiresAt time.Time `json:"lease_expires_at,omitzero"`
ExpiryReason string `json:"expiry_reason,omitempty"`
SnapshotReady bool `json:"snapshot_ready"`
SnapshotBytes int64 `json:"snapshot_bytes,omitempty"`
Issues []SectionIssueDTO `json:"issues,omitempty"`
}
type SectionIssueDTO ¶
type SnapshotBudgetDTO ¶
type SnapshotMetaDTO ¶
type SnapshotMetaDTO struct {
Capabilities []string `json:"capabilities"`
BoundaryWindow runctl.BoundaryWindow `json:"boundary_window"`
GenerationWindow runctl.BoundaryWindow `json:"generation_window"`
Identity hoststats.Identity `json:"identity"`
CgroupScope string `json:"cgroup_scope"`
}
type StartResultDTO ¶
type StartResultDTO struct {
RunID string `json:"run_id"`
LocalRunID string `json:"local_run_id"`
Nonce string `json:"nonce"`
Epoch uint64 `json:"epoch"`
State string `json:"state"`
Validity string `json:"validity"`
Collectors []runctl.CollectorBoundary `json:"collectors"`
GenerationWindow runctl.BoundaryWindow `json:"generation_window"`
BoundaryWindow runctl.BoundaryWindow `json:"boundary_window"`
PreemptedRunID string `json:"preempted_run_id,omitempty"`
LeaseExpiresAt time.Time `json:"lease_expires_at"`
LeaseMS int64 `json:"lease_ms"`
StartedAt time.Time `json:"started_at"`
}
type StartRunRequest ¶
Click to show internal directories.
Click to hide internal directories.