state

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package state manages local SQLite state for instance caching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open() (*sql.DB, error)

Open returns an open SQLite database at ~/.ssmx/state.db, creating it and running migrations if it doesn't exist.

func UpsertInstances

func UpsertInstances(ctx context.Context, db *sql.DB, profile, region string, instances []CachedInstance) error

UpsertInstances replaces the cached instance list for the given profile+region. All existing rows for that profile+region are removed before inserting the new batch, so instances that have disappeared from AWS are not left in the cache.

Types

type CachedInstance

type CachedInstance struct {
	InstanceID       string
	Name             string
	State            string
	SSMStatus        string
	PrivateIP        string
	AgentVersion     string
	Region           string
	Profile          string
	PlatformName     string
	AvailabilityZone string
	CachedAt         time.Time
}

CachedInstance is a row from the instance_cache table.

func GetCachedInstances

func GetCachedInstances(ctx context.Context, db *sql.DB, profile, region string) ([]CachedInstance, error)

GetCachedInstances returns all cached instances for the given profile+region that were cached within the TTL window.

Jump to

Keyboard shortcuts

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