state

package
v1.23.13 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateCacheVersion       = 1
	StateCacheFileName      = ".state.json"
	StateChangeFileName     = ".state-change"
	DefaultCacheTTLDuration = 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Remote *RemoteConfig `json:"remote" yaml:"remote"`
}

Config is the state configuration for an azd project

type RemoteConfig

type RemoteConfig struct {
	Backend string         `json:"backend" yaml:"backend"`
	Config  map[string]any `json:"config"  yaml:"config"`
}

RemoteConfig is the state configuration for a remote backend

type ServiceResourceCache

type ServiceResourceCache struct {
	// Resource IDs associated with this service
	ResourceIds []string `json:"resourceIds,omitempty"`
	// Ingress URL for the service
	IngressUrl string `json:"ingressUrl,omitempty"`
}

ServiceResourceCache represents cached resource information for a service

type StateCache

type StateCache struct {
	// Version of the cache format
	Version int `json:"version"`
	// Timestamp when the cache was last updated
	UpdatedAt time.Time `json:"updatedAt"`
	// Subscription ID
	SubscriptionId string `json:"subscriptionId,omitempty"`
	// Resource group name
	ResourceGroupName string `json:"resourceGroupName,omitempty"`
	// Service resources mapped by service name
	ServiceResources map[string]ServiceResourceCache `json:"serviceResources,omitempty"`
}

StateCache represents cached Azure resource information for an environment

type StateCacheManager

type StateCacheManager struct {
	// contains filtered or unexported fields
}

StateCacheManager manages the state cache for environments

func NewStateCacheManager

func NewStateCacheManager(rootPath string) *StateCacheManager

NewStateCacheManager creates a new state cache manager

func (*StateCacheManager) GetCachePath

func (m *StateCacheManager) GetCachePath(envName string) string

GetCachePath returns the path to the cache file for an environment

func (*StateCacheManager) GetStateChangePath

func (m *StateCacheManager) GetStateChangePath() string

GetStateChangePath returns the path to the state change notification file

func (*StateCacheManager) GetStateChangeTime

func (m *StateCacheManager) GetStateChangeTime() (time.Time, error)

GetStateChangeTime returns the last time the state changed

func (*StateCacheManager) Invalidate

func (m *StateCacheManager) Invalidate(ctx context.Context, envName string) error

Invalidate removes the cache for an environment

func (*StateCacheManager) Load

func (m *StateCacheManager) Load(ctx context.Context, envName string) (*StateCache, error)

Load loads the state cache for an environment

func (*StateCacheManager) Save

func (m *StateCacheManager) Save(ctx context.Context, envName string, cache *StateCache) error

Save saves the state cache for an environment

func (*StateCacheManager) SetTTL

func (m *StateCacheManager) SetTTL(ttl time.Duration)

SetTTL sets the time-to-live for cached data

func (*StateCacheManager) TouchStateChange

func (m *StateCacheManager) TouchStateChange() error

TouchStateChange updates the state change notification file This file is watched by IDEs/tools to know when to refresh their state

Jump to

Keyboard shortcuts

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