state

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MPL-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsModuleNotFound added in v0.26.0

func IsModuleNotFound(err error) bool

func IsTimeType added in v0.28.0

func IsTimeType(k reflect.Kind) (okay bool)

IsTimeType returns whether the passed type is a type of time.Time.

func NewBuiltInProvider added in v0.29.0

func NewBuiltInProvider(name string) tfaddr.Provider

func NewDefaultProvider added in v0.29.0

func NewDefaultProvider(name string) tfaddr.Provider

func NewLegacyProvider added in v0.29.0

func NewLegacyProvider(name string) tfaddr.Provider

Types

type AlreadyExistsError

type AlreadyExistsError struct {
	Idx string
}

func (*AlreadyExistsError) Error

func (e *AlreadyExistsError) Error() string

type DirHandleFieldIndexer added in v0.26.0

type DirHandleFieldIndexer struct {
	Field string
}

func (*DirHandleFieldIndexer) FromArgs added in v0.26.0

func (s *DirHandleFieldIndexer) FromArgs(args ...interface{}) ([]byte, error)

func (*DirHandleFieldIndexer) FromObject added in v0.26.0

func (s *DirHandleFieldIndexer) FromObject(obj interface{}) (bool, []byte, error)

func (*DirHandleFieldIndexer) PrefixFromArgs added in v0.26.0

func (s *DirHandleFieldIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error)

type DocumentStore added in v0.26.0

type DocumentStore struct {

	// TimeProvider provides current time (for mocking time.Now in tests)
	TimeProvider func() time.Time
	// contains filtered or unexported fields
}

func (*DocumentStore) CloseDocument added in v0.26.0

func (s *DocumentStore) CloseDocument(dh document.Handle) error

func (*DocumentStore) GetDocument added in v0.26.0

func (s *DocumentStore) GetDocument(dh document.Handle) (*document.Document, error)

func (*DocumentStore) HasOpenDocuments added in v0.26.0

func (s *DocumentStore) HasOpenDocuments(dirHandle document.DirHandle) (bool, error)

func (*DocumentStore) IsDocumentOpen added in v0.26.0

func (s *DocumentStore) IsDocumentOpen(dh document.Handle) (bool, error)

func (*DocumentStore) ListDocumentsInDir added in v0.26.0

func (s *DocumentStore) ListDocumentsInDir(dirHandle document.DirHandle) ([]*document.Document, error)

func (*DocumentStore) OpenDocument added in v0.26.0

func (s *DocumentStore) OpenDocument(dh document.Handle, langId string, version int, text []byte) error

func (*DocumentStore) UpdateDocument added in v0.26.0

func (s *DocumentStore) UpdateDocument(dh document.Handle, newText []byte, newVersion int) error

type InstalledProviders added in v0.25.2

type InstalledProviders map[tfaddr.Provider]*version.Version

func (InstalledProviders) Equals added in v0.25.2

type JobIdSliceIndex added in v0.29.0

type JobIdSliceIndex struct {
	Field string
}

func (*JobIdSliceIndex) FromArgs added in v0.29.0

func (s *JobIdSliceIndex) FromArgs(args ...interface{}) ([]byte, error)

func (*JobIdSliceIndex) FromObject added in v0.29.0

func (s *JobIdSliceIndex) FromObject(obj interface{}) (bool, [][]byte, error)

func (*JobIdSliceIndex) PrefixFromArgs added in v0.29.0

func (s *JobIdSliceIndex) PrefixFromArgs(args ...interface{}) ([]byte, error)

type JobPriorityIndex added in v0.29.0

type JobPriorityIndex struct {
	PriorityIntField   string
	IsDirOpenBoolField string
}

func (*JobPriorityIndex) FromArgs added in v0.29.0

func (jpi *JobPriorityIndex) FromArgs(args ...interface{}) ([]byte, error)

func (*JobPriorityIndex) FromObject added in v0.29.0

func (jpi *JobPriorityIndex) FromObject(obj interface{}) (bool, []byte, error)

type JobStore added in v0.26.0

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

func (*JobStore) AwaitNextJob added in v0.26.0

func (js *JobStore) AwaitNextJob(ctx context.Context, priority job.JobPriority) (context.Context, job.ID, job.Job, error)

func (*JobStore) DequeueJobsForDir added in v0.26.0

func (js *JobStore) DequeueJobsForDir(dir document.DirHandle) error

func (*JobStore) EnqueueJob added in v0.26.0

func (js *JobStore) EnqueueJob(ctx context.Context, newJob job.Job) (job.ID, error)

func (*JobStore) FinishJob added in v0.26.0

func (js *JobStore) FinishJob(id job.ID, jobErr error, deferredJobIds ...job.ID) error

func (*JobStore) ListAllJobs added in v0.29.0

func (js *JobStore) ListAllJobs() (job.IDs, error)

func (*JobStore) ListQueuedJobs added in v0.26.0

func (js *JobStore) ListQueuedJobs() (job.IDs, error)

func (*JobStore) WaitForJobs added in v0.26.0

func (js *JobStore) WaitForJobs(ctx context.Context, ids ...job.ID) error

type LocalSchemaSource

type LocalSchemaSource struct {
	ModulePath string
}

func (LocalSchemaSource) String

func (lss LocalSchemaSource) String() string

type Module

type Module struct {
	Path string

	ModManifest      *datadir.ModuleManifest
	ModManifestErr   error
	ModManifestState op.OpState

	TerraformVersion      *version.Version
	TerraformVersionErr   error
	TerraformVersionState op.OpState

	InstalledProviders      InstalledProviders
	InstalledProvidersErr   error
	InstalledProvidersState op.OpState

	ProviderSchemaErr   error
	ProviderSchemaState op.OpState

	PreloadEmbeddedSchemaState op.OpState

	RefTargets      reference.Targets
	RefTargetsErr   error
	RefTargetsState op.OpState

	RefOrigins      reference.Origins
	RefOriginsErr   error
	RefOriginsState op.OpState

	VarsRefOrigins      reference.Origins
	VarsRefOriginsErr   error
	VarsRefOriginsState op.OpState

	ParsedModuleFiles ast.ModFiles
	ParsedVarsFiles   ast.VarsFiles
	ModuleParsingErr  error
	VarsParsingErr    error

	Meta      ModuleMetadata
	MetaErr   error
	MetaState op.OpState

	ModuleDiagnostics      ast.SourceModDiags
	ModuleDiagnosticsState ast.DiagnosticSourceState
	VarsDiagnostics        ast.SourceVarsDiags
	VarsDiagnosticsState   ast.DiagnosticSourceState
}

func (*Module) Copy added in v0.17.1

func (m *Module) Copy() *Module

type ModuleCallReader added in v0.20.0

type ModuleCallReader interface {
	ModuleCalls(modPath string) (tfmod.ModuleCalls, error)
	LocalModuleMeta(modPath string) (*tfmod.Meta, error)
	RegistryModuleMeta(addr tfaddr.Module, cons version.Constraints) (*registry.ModuleData, error)
}

type ModuleChangeBatch added in v0.28.0

type ModuleChangeBatch struct {
	DirHandle       document.DirHandle
	FirstChangeTime time.Time
	IsDirOpen       bool
	Changes         ModuleChanges
}

func (ModuleChangeBatch) Copy added in v0.28.0

type ModuleChangeStore added in v0.28.0

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

type ModuleChanges added in v0.28.0

type ModuleChanges struct {
	// IsRemoval indicates whether this batch represents removal of a module
	IsRemoval bool

	CoreRequirements     bool
	Backend              bool
	Cloud                bool
	ProviderRequirements bool
	TerraformVersion     bool
	InstalledProviders   bool
	Diagnostics          bool
	ReferenceOrigins     bool
	ReferenceTargets     bool
}

type ModuleIds added in v0.24.0

type ModuleIds struct {
	Path string
	ID   string
}

type ModuleLookupFunc

type ModuleLookupFunc func(string) (*Module, error)

type ModuleMetadata

type ModuleMetadata struct {
	CoreRequirements     version.Constraints
	Backend              *tfmod.Backend
	Cloud                *backend.Cloud
	ProviderReferences   map[tfmod.ProviderRef]tfaddr.Provider
	ProviderRequirements tfmod.ProviderRequirements
	Variables            map[string]tfmod.Variable
	Outputs              map[string]tfmod.Output
	Filenames            []string
	ModuleCalls          map[string]tfmod.DeclaredModuleCall
}

func (ModuleMetadata) Copy added in v0.17.1

func (mm ModuleMetadata) Copy() ModuleMetadata

type ModuleNotFoundError

type ModuleNotFoundError struct {
	Source string
}

func (*ModuleNotFoundError) Error

func (e *ModuleNotFoundError) Error() string

type ModuleReader

type ModuleReader interface {
	CallersOfModule(modPath string) ([]*Module, error)
	ModuleByPath(modPath string) (*Module, error)
	List() ([]*Module, error)
}

type ModuleStore

type ModuleStore struct {
	Changes *ModuleChangeStore

	// TimeProvider provides current time (for mocking time.Now in tests)
	TimeProvider func() time.Time

	// MaxModuleNesting represents how many nesting levels we'd attempt
	// to parse provider requirements before returning error.
	MaxModuleNesting int
	// contains filtered or unexported fields
}

func (*ModuleStore) Add

func (s *ModuleStore) Add(modPath string) error

func (*ModuleStore) AddIfNotExists added in v0.29.0

func (s *ModuleStore) AddIfNotExists(path string) error

func (*ModuleStore) AwaitNextChangeBatch added in v0.28.0

func (ms *ModuleStore) AwaitNextChangeBatch(ctx context.Context) (ModuleChangeBatch, error)

func (*ModuleStore) CallersOfModule

func (s *ModuleStore) CallersOfModule(modPath string) ([]*Module, error)

func (*ModuleStore) FinishProviderSchemaLoading

func (s *ModuleStore) FinishProviderSchemaLoading(path string, psErr error) error

func (*ModuleStore) List

func (s *ModuleStore) List() ([]*Module, error)

func (*ModuleStore) LocalModuleMeta added in v0.29.0

func (s *ModuleStore) LocalModuleMeta(modPath string) (*tfmod.Meta, error)

func (*ModuleStore) ModuleByPath

func (s *ModuleStore) ModuleByPath(path string) (*Module, error)

func (*ModuleStore) ModuleCalls added in v0.20.0

func (s *ModuleStore) ModuleCalls(modPath string) (tfmod.ModuleCalls, error)

func (*ModuleStore) ProviderRequirementsForModule added in v0.29.0

func (s *ModuleStore) ProviderRequirementsForModule(modPath string) (tfmod.ProviderRequirements, error)

func (*ModuleStore) RegistryModuleMeta added in v0.29.0

func (s *ModuleStore) RegistryModuleMeta(addr tfaddr.Module, cons version.Constraints) (*registry.ModuleData, error)

func (*ModuleStore) Remove added in v0.19.0

func (s *ModuleStore) Remove(modPath string) error

func (*ModuleStore) SetInstalledProvidersState added in v0.29.0

func (s *ModuleStore) SetInstalledProvidersState(path string, state op.OpState) error

func (*ModuleStore) SetMetaState

func (s *ModuleStore) SetMetaState(path string, state op.OpState) error

func (*ModuleStore) SetModManifestState

func (s *ModuleStore) SetModManifestState(path string, state op.OpState) error

func (*ModuleStore) SetModuleDiagnosticsState added in v0.32.0

func (s *ModuleStore) SetModuleDiagnosticsState(path string, source ast.DiagnosticSource, state op.OpState) error

func (*ModuleStore) SetPreloadEmbeddedSchemaState added in v0.29.3

func (s *ModuleStore) SetPreloadEmbeddedSchemaState(path string, state op.OpState) error

func (*ModuleStore) SetProviderSchemaState

func (s *ModuleStore) SetProviderSchemaState(path string, state op.OpState) error

func (*ModuleStore) SetReferenceOriginsState added in v0.19.0

func (s *ModuleStore) SetReferenceOriginsState(path string, state op.OpState) error

func (*ModuleStore) SetReferenceTargetsState added in v0.18.2

func (s *ModuleStore) SetReferenceTargetsState(path string, state op.OpState) error

func (*ModuleStore) SetTerraformVersionState

func (s *ModuleStore) SetTerraformVersionState(path string, state op.OpState) error

func (*ModuleStore) SetVarsDiagnosticsState added in v0.32.0

func (s *ModuleStore) SetVarsDiagnosticsState(path string, source ast.DiagnosticSource, state op.OpState) error

func (*ModuleStore) SetVarsReferenceOriginsState added in v0.26.0

func (s *ModuleStore) SetVarsReferenceOriginsState(path string, state op.OpState) error

func (*ModuleStore) UpdateInstalledProviders added in v0.24.0

func (s *ModuleStore) UpdateInstalledProviders(path string, pvs map[tfaddr.Provider]*version.Version, pvErr error) error

func (*ModuleStore) UpdateMetadata

func (s *ModuleStore) UpdateMetadata(path string, meta *tfmod.Meta, mErr error) error

func (*ModuleStore) UpdateModManifest

func (s *ModuleStore) UpdateModManifest(path string, manifest *datadir.ModuleManifest, mErr error) error

func (*ModuleStore) UpdateModuleDiagnostics added in v0.18.0

func (s *ModuleStore) UpdateModuleDiagnostics(path string, source ast.DiagnosticSource, diags ast.ModDiags) error

func (*ModuleStore) UpdateParsedModuleFiles added in v0.18.0

func (s *ModuleStore) UpdateParsedModuleFiles(path string, pFiles ast.ModFiles, pErr error) error

func (*ModuleStore) UpdateParsedVarsFiles added in v0.18.0

func (s *ModuleStore) UpdateParsedVarsFiles(path string, vFiles ast.VarsFiles, vErr error) error

func (*ModuleStore) UpdateReferenceOrigins added in v0.19.0

func (s *ModuleStore) UpdateReferenceOrigins(path string, origins reference.Origins, roErr error) error

func (*ModuleStore) UpdateReferenceTargets added in v0.18.2

func (s *ModuleStore) UpdateReferenceTargets(path string, refs reference.Targets, rErr error) error

func (*ModuleStore) UpdateTerraformAndProviderVersions added in v0.29.2

func (s *ModuleStore) UpdateTerraformAndProviderVersions(modPath string, tfVer *version.Version, pv map[tfaddr.Provider]*version.Version, vErr error) error

func (*ModuleStore) UpdateVarsDiagnostics added in v0.18.0

func (s *ModuleStore) UpdateVarsDiagnostics(path string, source ast.DiagnosticSource, diags ast.VarsDiags) error

func (*ModuleStore) UpdateVarsReferenceOrigins added in v0.26.0

func (s *ModuleStore) UpdateVarsReferenceOrigins(path string, origins reference.Origins, roErr error) error

type NoSchemaError

type NoSchemaError struct{}

func (*NoSchemaError) Error

func (e *NoSchemaError) Error() string

type PathAwaiter added in v0.27.0

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

func NewPathAwaiter added in v0.27.0

func NewPathAwaiter(wps *WalkerPathStore, openDir bool) *PathAwaiter

func (*PathAwaiter) AwaitNextDir added in v0.27.0

func (pa *PathAwaiter) AwaitNextDir(ctx context.Context) (context.Context, document.DirHandle, error)

func (*PathAwaiter) RemoveDir added in v0.27.0

func (pa *PathAwaiter) RemoveDir(dir document.DirHandle) error

type PathContext added in v0.31.4

type PathContext struct {
}

type PathState added in v0.27.0

type PathState uint
const (
	PathStateQueued PathState = iota
	PathStateWalking
)

func (PathState) String added in v0.27.0

func (i PathState) String() string

type PreloadedSchemaSource

type PreloadedSchemaSource struct {
}

func (PreloadedSchemaSource) String

func (PreloadedSchemaSource) String() string

type ProviderIds added in v0.24.0

type ProviderIds struct {
	Address tfaddr.Provider
	ID      string
}

type ProviderSchema

type ProviderSchema struct {
	Address tfaddr.Provider
	Version *version.Version
	Source  SchemaSource

	Schema *tfschema.ProviderSchema
}

func (*ProviderSchema) Copy added in v0.17.1

func (ps *ProviderSchema) Copy() *ProviderSchema

type ProviderSchemaIterator

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

func (*ProviderSchemaIterator) Next

type ProviderSchemaStore

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

func (*ProviderSchemaStore) AddLocalSchema

func (s *ProviderSchemaStore) AddLocalSchema(modPath string, addr tfaddr.Provider, schema *tfschema.ProviderSchema) error

func (*ProviderSchemaStore) AddPreloadedSchema

func (s *ProviderSchemaStore) AddPreloadedSchema(addr tfaddr.Provider, pv *version.Version, schema *tfschema.ProviderSchema) error

func (*ProviderSchemaStore) AllSchemasExist added in v0.29.0

func (s *ProviderSchemaStore) AllSchemasExist(pvm map[tfaddr.Provider]version.Constraints) (bool, error)

func (*ProviderSchemaStore) ListSchemas

func (s *ProviderSchemaStore) ListSchemas() (*ProviderSchemaIterator, error)

func (*ProviderSchemaStore) MissingSchemas added in v0.29.3

func (s *ProviderSchemaStore) MissingSchemas(pvm map[tfaddr.Provider]version.Constraints) ([]tfaddr.Provider, error)

MissingSchemas checks which schemas are missing in order to preload them from the bundled schemas. Since we don't know the version of a schema on disk before loading it, we assume it's good to just load it by address and ignore the version constraints.

func (*ProviderSchemaStore) ProviderSchema

func (s *ProviderSchemaStore) ProviderSchema(modPath string, addr tfaddr.Provider, vc version.Constraints) (*tfschema.ProviderSchema, error)

type RegistryModuleData added in v0.29.0

type RegistryModuleData struct {
	Source  tfaddr.Module
	Version *version.Version
	Error   bool
	Inputs  []registry.Input
	Outputs []registry.Output
}

type RegistryModuleStore added in v0.29.0

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

func (*RegistryModuleStore) Cache added in v0.29.0

func (s *RegistryModuleStore) Cache(sourceAddr tfaddr.Module, modVer *version.Version,
	inputs []registry.Input, outputs []registry.Output) error

func (*RegistryModuleStore) CacheError added in v0.31.1

func (s *RegistryModuleStore) CacheError(sourceAddr tfaddr.Module) error

func (*RegistryModuleStore) Exists added in v0.29.0

func (s *RegistryModuleStore) Exists(sourceAddr tfaddr.Module, constraint version.Constraints) (bool, error)

type ScheduledJob added in v0.26.0

type ScheduledJob struct {
	job.ID
	job.Job
	IsDirOpen bool
	State     State

	// JobErr contains error when job finishes (State = StateDone)
	JobErr error
	// DeferredJobIDs contains IDs of any deferred jobs
	// set when job finishes (State = StateDone)
	DeferredJobIDs job.IDs

	// EnqueueTime tracks time when the job was originally put into the queue
	EnqueueTime time.Time
	// TraceSpan represents a tracing span for the entire job lifecycle
	// (from queuing to finishing execution).
	TraceSpan trace.Span
	// DocumentContext contains information from when & where the job was scheduled from
	DocumentContext lsctx.Document
}

func (*ScheduledJob) Copy added in v0.26.0

func (sj *ScheduledJob) Copy() *ScheduledJob

type SchemaReader

type SchemaReader interface {
	ProviderSchema(modPath string, addr tfaddr.Provider, vc version.Constraints) (*tfschema.ProviderSchema, error)
}

type SchemaSource

type SchemaSource interface {
	String() string
	// contains filtered or unexported methods
}

type SliceLengthIndex added in v0.29.0

type SliceLengthIndex struct {
	Field string
}

func (*SliceLengthIndex) FromArgs added in v0.29.0

func (s *SliceLengthIndex) FromArgs(args ...interface{}) ([]byte, error)

func (*SliceLengthIndex) FromObject added in v0.29.0

func (s *SliceLengthIndex) FromObject(obj interface{}) (bool, []byte, error)

type State added in v0.26.0

type State uint
const (
	StateQueued State = iota
	StateRunning
	StateDone
)

func (State) String added in v0.26.0

func (i State) String() string

type StateStore

type StateStore struct {
	DocumentStore   *DocumentStore
	JobStore        *JobStore
	Modules         *ModuleStore
	ProviderSchemas *ProviderSchemaStore
	WalkerPaths     *WalkerPathStore
	RegistryModules *RegistryModuleStore
	// contains filtered or unexported fields
}

func NewStateStore

func NewStateStore() (*StateStore, error)

func (*StateStore) GetModuleID added in v0.24.0

func (s *StateStore) GetModuleID(path string) (string, error)

func (*StateStore) GetProviderID added in v0.24.0

func (s *StateStore) GetProviderID(addr tfaddr.Provider) (string, error)

func (*StateStore) SetLogger added in v0.16.1

func (s *StateStore) SetLogger(logger *log.Logger)

type StringerFieldIndexer

type StringerFieldIndexer struct {
	Field string
}

func (*StringerFieldIndexer) FromArgs

func (s *StringerFieldIndexer) FromArgs(args ...interface{}) ([]byte, error)

func (*StringerFieldIndexer) FromObject

func (s *StringerFieldIndexer) FromObject(obj interface{}) (bool, []byte, error)

func (*StringerFieldIndexer) PrefixFromArgs

func (s *StringerFieldIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error)

type TimeFieldIndex added in v0.28.0

type TimeFieldIndex struct {
	Field string
}

TimeFieldIndex is used to extract a time.Time field from an object using reflection and builds an index on that field.

func (*TimeFieldIndex) FromArgs added in v0.28.0

func (u *TimeFieldIndex) FromArgs(args ...interface{}) ([]byte, error)

func (*TimeFieldIndex) FromObject added in v0.28.0

func (u *TimeFieldIndex) FromObject(obj interface{}) (bool, []byte, error)

type VersionFieldIndexer

type VersionFieldIndexer struct {
	Field string
}

func (*VersionFieldIndexer) FromArgs

func (s *VersionFieldIndexer) FromArgs(args ...interface{}) ([]byte, error)

func (*VersionFieldIndexer) FromObject

func (s *VersionFieldIndexer) FromObject(obj interface{}) (bool, []byte, error)

func (*VersionFieldIndexer) PrefixFromArgs

func (s *VersionFieldIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error)

type WalkerPath added in v0.27.0

type WalkerPath struct {
	Dir            document.DirHandle
	IsDirOpen      bool
	State          PathState
	EnqueueContext trace.SpanContext
}

func (*WalkerPath) Copy added in v0.27.0

func (wp *WalkerPath) Copy() *WalkerPath

type WalkerPathStore added in v0.27.0

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

func (*WalkerPathStore) AwaitNextDir added in v0.27.0

func (wps *WalkerPathStore) AwaitNextDir(ctx context.Context, openDir bool) (*WalkerPath, error)

func (*WalkerPathStore) DequeueDir added in v0.27.0

func (wps *WalkerPathStore) DequeueDir(dir document.DirHandle) error

func (*WalkerPathStore) EnqueueDir added in v0.27.0

func (wps *WalkerPathStore) EnqueueDir(ctx context.Context, dir document.DirHandle) error

func (*WalkerPathStore) RemoveDir added in v0.27.0

func (wps *WalkerPathStore) RemoveDir(dir document.DirHandle) error

func (*WalkerPathStore) WaitForDirs added in v0.27.0

func (wps *WalkerPathStore) WaitForDirs(ctx context.Context, dirs []document.DirHandle) error

Jump to

Keyboard shortcuts

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