agentstate

package
v0.0.0-test.2 Latest Latest
Warning

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

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

Documentation

Overview

Package agentstate centralizes access to local persisted agent state.

Index

Constants

View Source
const (
	MetadataKeyBackendBaseURL = "backend_base_url"
	MetadataKeySAKToken       = "sak_token"
	MetadataKeyEnrolledAt     = "enrolled_at"
	MetadataKeyNodeGroup      = "node_group"
	MetadataKeyComputeZone    = "compute_zone"
)

Variables

This section is empty.

Functions

func GetOrCreateNodeUUIDMetadata added in v1.3.1

func GetOrCreateNodeUUIDMetadata(ctx context.Context, db *sql.DB, create func() (string, error)) (string, bool, error)

GetOrCreateNodeUUIDMetadata atomically returns the committed node UUID metadata value, creating it when missing or repairing an empty value.

Types

type State

type State interface {
	GetBackendBaseURL(ctx context.Context) (value string, ok bool, err error)
	SetBackendBaseURL(ctx context.Context, value string) error

	GetJWT(ctx context.Context) (value string, ok bool, err error)
	SetJWT(ctx context.Context, value string) error

	GetSAK(ctx context.Context) (value string, ok bool, err error)
	SetSAK(ctx context.Context, value string) error

	// GetNodeUUID reads the committed node UUID without creating one.
	GetNodeUUID(ctx context.Context) (value string, ok bool, err error)
	SetNodeUUID(ctx context.Context, value string) error
	// GetOrCreateNodeUUID creates and commits the node UUID when no value exists.
	GetOrCreateNodeUUID(ctx context.Context, create func() (string, error)) (value string, created bool, err error)

	GetEnrollmentTime(ctx context.Context) (value time.Time, ok bool, err error)
	SetEnrollmentTime(ctx context.Context, value time.Time) error

	GetNodeGroup(ctx context.Context) (value string, ok bool, err error)
	SetNodeGroup(ctx context.Context, value string) error

	GetComputeZone(ctx context.Context) (value string, ok bool, err error)
	SetComputeZone(ctx context.Context, value string) error
}

State provides local persisted metadata/state access for backend workflows.

func NewSQLite

func NewSQLite() State

NewSQLite returns a State backed by the agent sqlite metadata database.

Jump to

Keyboard shortcuts

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