Documentation
¶
Index ¶
- Constants
- func WithClock(clock commoncore.Clock) func(*StateContainer)
- func WithMaxEventPartitionSize(maxEventPartitionSize int64) func(*StateContainer)
- func WithMaxGuideFileSize(maxGuideFileSize int64) func(*StateContainer)
- func WithRecentlyQueuedEventsThreshold(thresholdSeconds int64) func(*StateContainer)
- type Error
- type ErrorReasonCode
- type Option
- type StateContainer
- func (c *StateContainer) Changesets() manage.Changesets
- func (c *StateContainer) Children() state.ChildrenContainer
- func (c *StateContainer) Events() manage.Events
- func (c *StateContainer) Exports() state.ExportsContainer
- func (c *StateContainer) Instances() state.InstancesContainer
- func (c *StateContainer) Links() state.LinksContainer
- func (c *StateContainer) Metadata() state.MetadataContainer
- func (c *StateContainer) Resources() state.ResourcesContainer
- func (c *StateContainer) Validation() manage.Validation
Constants ¶
const ( // DefaultMaxGuideFileSize is the default maximum size of a state chunk file in bytes. DefaultMaxGuideFileSize = 1048576 // DefaultMaxEventParititionSize is the default maximum size of an event partition in bytes. // When trying to save a new event that would exceed this size, the `memfile` state container // implementation will fail. DefaultMaxEventParititionSize = 10485760 )
Variables ¶
This section is empty.
Functions ¶
func WithClock ¶
func WithClock(clock commoncore.Clock) func(*StateContainer)
WithClock sets the clock to use for the state container. This is used in tasks like determining the current time when checking for recently queued events.
When not set, the default value is the system clock.
func WithMaxEventPartitionSize ¶
func WithMaxEventPartitionSize(maxEventPartitionSize int64) func(*StateContainer)
WithMaxEventPartitionSize sets a maximum size of an event partition file in bytes. If the addition of a new event causes the partition to exceeds this size, an error will be returned for the save event operation. This determines the maximum size of the data in the partition file, depending on the operating system and file system, the actual size of the file will in most cases be larger.
When not set, the default value is 10MB (10,485,760 bytes).
func WithMaxGuideFileSize ¶
func WithMaxGuideFileSize(maxGuideFileSize int64) func(*StateContainer)
WithMaxGuideFileSize sets a guide for the maximum size of a state chunk file in bytes. If a single record (instance or resource drift entry) exceeds this size, it will not be split into multiple files. This is only a guide, the actual size of the files are often likely to be larger.
When not set, the default value is 1MB (1,048,576 bytes).
func WithRecentlyQueuedEventsThreshold ¶
func WithRecentlyQueuedEventsThreshold(thresholdSeconds int64) func(*StateContainer)
WithRecentlyQueuedEventsThreshold sets the threshold in seconds for retrieving recently queued events for a stream when a starting event ID is not provided.
When not set, the default value is 5 minutes (300 seconds).
Types ¶
type Error ¶
type Error struct {
ReasonCode ErrorReasonCode
Err error
}
Error is a custom error type that provides errors specific to the memfile (in-memory, persisted to file) implementation of the state.Container interface.
type ErrorReasonCode ¶
type ErrorReasonCode string
ErrorReasonCode is an enum of possible error reasons that can be returned by the memfile implementation.
const ( // ErrorReasonCodeMalformedStateFile is the error code that is used when // a state file is malformed, // this could be due to a file being corrupted or a mismatch between // the index and the actual state file. ErrorReasonCodeMalformedStateFile ErrorReasonCode = "malformed_state_file" // ErrorReasonCodeMalformedState is the error code that is used when // the in-memory state is malformed, usually when the instance associated // with a resource or link no longer exists but the resource or link // still exists. ErrorReasonCodeMalformedState ErrorReasonCode = "malformed_state" // ErrorReasonCodeMaxEventPartitionSizeExceeded is the error code that is used when // the maximum event partition size is exceeded when trying to save an event. ErrorReasonCodeMaxEventPartitionSizeExceeded ErrorReasonCode = "max_event_partition_size_exceeded" )
type Option ¶
type Option func(*StateContainer)
Option is a type for options that can be passed to LoadStateContainer when creating an in-memory state container with file persistence.
type StateContainer ¶
type StateContainer struct {
// contains filtered or unexported fields
}
StateContainer provides the in-memory with file persistence (memfile) implementation of the blueprint `state.Container` interface along with methods to manage persistence for blueprint validation requests, events and change sets.
func LoadStateContainer ¶
func LoadStateContainer( stateDir string, fs afero.Fs, logger core.Logger, opts ...Option, ) (*StateContainer, error)
LoadStateContainer loads a new state container that uses in-process memory to store state with local files used for persistence.
This will load the state into memory from the given directory as the initial state and will write state files to the same directory as they are updated. stateDir can be relative to the current working directory or an absolute path.
func (*StateContainer) Changesets ¶
func (c *StateContainer) Changesets() manage.Changesets
func (*StateContainer) Children ¶
func (c *StateContainer) Children() state.ChildrenContainer
func (*StateContainer) Events ¶
func (c *StateContainer) Events() manage.Events
func (*StateContainer) Exports ¶
func (c *StateContainer) Exports() state.ExportsContainer
func (*StateContainer) Instances ¶
func (c *StateContainer) Instances() state.InstancesContainer
func (*StateContainer) Links ¶
func (c *StateContainer) Links() state.LinksContainer
func (*StateContainer) Metadata ¶
func (c *StateContainer) Metadata() state.MetadataContainer
func (*StateContainer) Resources ¶
func (c *StateContainer) Resources() state.ResourcesContainer
func (*StateContainer) Validation ¶
func (c *StateContainer) Validation() manage.Validation
Source Files
¶
- consts.go
- container.go
- container_changesets.go
- container_children.go
- container_events.go
- container_exports.go
- container_instances.go
- container_links.go
- container_metadata.go
- container_resources.go
- container_validation.go
- errors.go
- load.go
- persist.go
- persist_blueprint_validations.go
- persist_changesets.go
- persist_events.go
- persist_instances.go
- persist_resource_drift.go
- utils.go