Documentation
¶
Index ¶
- func Key(absPath string) string
- func ReadFile(path string) (*format.Output, error)
- type Config
- func (c *Config) ForPath(absPath string) (*format.Output, error)
- func (c *Config) Latest(allowStale bool) (*format.Output, error)
- func (c *Config) LoadManifest() (*Manifest, error)
- func (c *Config) Process()
- func (c *Config) SaveManifest(m *Manifest) error
- func (c *Config) Write(absPath string, data *format.Output) error
- type Manifest
- type ManifestEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Cache is where the cache files should go.
Cache string `env:"INFRACOST_CLI_CACHE_DIRECTORY"`
// TTL is how long cached results remain valid.
TTL time.Duration `env:"INFRACOST_CLI_CACHE_TTL" default:"1h"`
// contains filtered or unexported fields
}
func (*Config) ForPath ¶ added in v0.0.7
ForPath returns cached results for the given absolute path.
The entry must be within TTL and the source files must not have been modified since the entry was created.
func (*Config) Latest ¶ added in v0.0.7
Latest returns the most recent cached result within TTL.
When allowStale is false, the entry is also rejected if any source file has been modified since the entry was created. Set allowStale to true when reading for comparison (e.g. diffing against a prior run).
func (*Config) LoadManifest ¶ added in v0.0.7
func (*Config) SaveManifest ¶ added in v0.0.7
type Manifest ¶ added in v0.0.7
type Manifest struct {
// Entries is keyed by the cache key (hash of the absolute source path).
Entries map[string]ManifestEntry `json:"entries"`
}
Manifest holds the index of all cache entries.
type ManifestEntry ¶ added in v0.0.7
type ManifestEntry struct {
// Version is the schema version of the cache entry.
Version int
// CreatedAt is when this entry was written.
CreatedAt time.Time
// SourcePath is the absolute path of the directory that was scanned.
SourcePath string
}
ManifestEntry holds metadata for a single cached result.
Click to show internal directories.
Click to hide internal directories.