hoststatus

package
v2.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StatusSet sync.Map

	ActiveAppList syncx.Map

	ContainerList syncx.Map

	ImageList syncx.Map

	Active HostActiveConfig

	AppWorkflow stateflow.AppStateWorkflow

	// ReplicaStages holds the host-side deploy stage progress per replica,
	// keyed by ReplicaStageKey(instanceName, repId). It is hostlet-local and
	// persisted across ticks; the status loop reports dirty entries upward
	// via HostStatusUpdate.
	ReplicaStages syncx.Map
)
View Source
var (
	HostReady      atomic.Bool
	ContainerReady atomic.Bool
)

Functions

func ParseReplicaStageKey

func ParseReplicaStageKey(key string) (string, uint32, bool)

ParseReplicaStageKey splits a ReplicaStageKey back into its instance name and replica id. ok is false if the key is malformed.

func ReplicaStageDelete

func ReplicaStageDelete(instanceName string, repId uint32)

ReplicaStageDelete removes the host-side stage entry for a replica.

func ReplicaStageKey

func ReplicaStageKey(instanceName string, repId uint32) string

ReplicaStageKey returns the map key for a (instanceName, repId) pair.

Types

type HostActiveConfig

type HostActiveConfig struct {
	AppInstances []*inapi.AppInstance `json:"app_instances,omitempty"`

	// AppliedRevisions records the last-applied Deploy.Revision per
	// container name. It is persisted to hostlet_active.json so that a
	// Deploy.Revision increment issued while the hostlet was down is still
	// detected after restart and triggers a container recreate.
	AppliedRevisions map[string]uint64 `json:"applied_revisions,omitempty"`

	// SecretKeys holds the per-replica inagent status API secret keyed by
	// container name. Persisted to hostlet_active.json so it survives hostlet
	// restart and stays consistent with the secret written into app_replica.json.
	SecretKeys map[string]string `json:"secret_keys,omitempty"`
	// contains filtered or unexported fields
}

func (*HostActiveConfig) AppliedRevision

func (it *HostActiveConfig) AppliedRevision(containerName string) (uint64, bool)

AppliedRevision returns the last-applied Deploy.Revision for a container, or (0, false) if none is recorded.

func (*HostActiveConfig) DeleteSecretKey

func (it *HostActiveConfig) DeleteSecretKey(containerName string)

DeleteSecretKey removes the inagent API secret for a container.

func (*HostActiveConfig) EnsureSecretKey

func (it *HostActiveConfig) EnsureSecretKey(containerName string) (string, bool)

EnsureSecretKey returns the existing inagent API secret for a container, generating a new random one if absent. changed is true if a new secret was created (the caller should persist the active config to disk).

func (*HostActiveConfig) MarshalJSON

func (it *HostActiveConfig) MarshalJSON() ([]byte, error)

MarshalJSON serializes the persisted fields under the read lock. The alias avoids recursing back into MarshalJSON.

func (*HostActiveConfig) SecretKey

func (it *HostActiveConfig) SecretKey(containerName string) string

SecretKey returns the inagent API secret for a container, or "" if none.

func (*HostActiveConfig) SetAppliedRevision

func (it *HostActiveConfig) SetAppliedRevision(containerName string, rev uint64)

SetAppliedRevision records the last-applied Deploy.Revision for a container. Safe for concurrent use.

func (*HostActiveConfig) SetSecretKey

func (it *HostActiveConfig) SetSecretKey(containerName, secret string)

SetSecretKey sets the inagent API secret for a container.

func (*HostActiveConfig) UnmarshalJSON

func (h *HostActiveConfig) UnmarshalJSON(data []byte) error

type ReplicaStageEntry

type ReplicaStageEntry struct {
	Stage    *inapi.AppDeployStage
	Dirty    bool
	Revision uint64 // AppDeploy.Revision this entry's stages are based on
	// contains filtered or unexported fields
}

ReplicaStageEntry holds the host-side stage node for a replica and a dirty flag indicating whether it needs to be reported upward. The mutex guards Stage/Dirty against concurrent access from the hostlet main loop and the inagent status HTTP handler.

func ReplicaStage

func ReplicaStage(instanceName string, repId uint32) *ReplicaStageEntry

ReplicaStage returns the host-side stage entry for the given replica, creating it if absent. The entry's Stage is a holder node whose children are the host-side deploy stages (host_recv, image_pull, ...).

func (*ReplicaStageEntry) ClearDirty

func (e *ReplicaStageEntry) ClearDirty()

ClearDirty clears the dirty flag. Called after a successful upward push.

func (*ReplicaStageEntry) MergeInagent

func (e *ReplicaStageEntry) MergeInagent(stages []*inapi.AppDeployStage)

MergeInagent replaces the inagent-owned children of this entry's stage with the reported stages, and marks the entry dirty. Host-side children are preserved. Safe for concurrent use.

func (*ReplicaStageEntry) SetFailed

func (e *ReplicaStageEntry) SetFailed(name, msg string)

func (*ReplicaStageEntry) SetInstant

func (e *ReplicaStageEntry) SetInstant(name, msg string)

func (*ReplicaStageEntry) SetRunning

func (e *ReplicaStageEntry) SetRunning(name, msg string)

func (*ReplicaStageEntry) SetSuccess

func (e *ReplicaStageEntry) SetSuccess(name, msg string)

func (*ReplicaStageEntry) SnapshotIfDirty

func (e *ReplicaStageEntry) SnapshotIfDirty() []*inapi.AppDeployStage

SnapshotIfDirty returns a clone of the stage children if the entry is dirty, or nil if nothing changed. It does not clear the dirty flag; the caller clears it via ClearDirty after a successful upward push so a failed push is retried on the next tick.

func (*ReplicaStageEntry) SyncRevision

func (e *ReplicaStageEntry) SyncRevision(rev uint64) bool

SyncRevision aligns the entry with the current AppDeploy.Revision. When the revision changed, all stage children are cleared (the prior revision's progress is stale) and the dirty flag is set so the reset propagates upward. Returns true if a reset occurred.

Jump to

Keyboard shortcuts

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