Documentation
¶
Overview ¶
Package state persists the snapshot that makes a fire reversible.
The ordering rule is absolute: the snapshot is written, and read back, before a single API call changes anything. If the write fails the fire is abandoned. An account that is still expensive is a problem; an account that is stopped with no record of how to start it is an outage of unknown length.
S3 is the intended home — it is in the never-touch set, so the kill switch cannot destroy its own restore — with a local copy alongside for the case where the reason you are firing is that something is wrong with the account.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("no snapshot with that plan id")
Functions ¶
Types ¶
type Multi ¶
type Multi struct{ Stores []Store }
Multi writes to every store and requires all of them to succeed, so the local copy and the durable copy cannot disagree about what was stopped.
type S3 ¶
S3 is the durable home for snapshots.
S3 is in the never-touch set, which is not a coincidence: the kill switch must not be able to destroy its own restore record. Versioning on the bucket is worth turning on for the same reason.
type Store ¶
type Store interface {
Put(ctx context.Context, s model.Snapshot) error
Get(ctx context.Context, planID string) (model.Snapshot, error)
List(ctx context.Context) ([]model.Snapshot, error)
Describe() string
}
func Build ¶ added in v1.10.0
Build assembles the store a run should use: the durable one first, so a rebuilt laptop still finds the record, with the local directory behind it.
localDir may be empty, which is the Lambda's case — there is no durable filesystem there, and a local copy that dies with the execution environment would be a restore record that does not exist.