Documentation
¶
Overview ¶
Package savedsel keeps export selections by name, in two stores: this account's own (a file each under the state home, private to it) and the manifest's (defaults.export.selections, so they travel with it). Both are read; on a name in both, the account's own wins and the manifest's is listed as shadowed. The export.save_to setting says where a save goes.
Index ¶
- Constants
- Variables
- func AddSchedule(p paths.Paths, s Schedule) error
- func CheckName(name string) error
- func CheckSchedule(s Schedule) error
- func CheckStore(store string) error
- func DefaultStore(get envnames.Getenv) string
- func Delete(p paths.Paths, store, name string) error
- func Encode(sel selection.Selection) ([]byte, error)
- func RemoveSchedules(p paths.Paths, selection, format string) (int, error)
- func Save(p paths.Paths, store, name string, sel selection.Selection) error
- func SchedulesFile(p paths.Paths) string
- type Saved
- type Schedule
Constants ¶
const ( StoreUser = "user" StoreManifest = "manifest" )
The stores.
Variables ¶
var ErrNotFound = errors.New("no saved selection")
ErrNotFound is a name no store has.
var Reserved = []string{"selections", "schedule"}
Reserved are names a saved selection cannot take: the built-in lists, and the words `authama export` gives its own meaning.
var Stores = []string{StoreUser, StoreManifest}
Stores lists them, the default first.
Functions ¶
func AddSchedule ¶
AddSchedule keeps s, replacing a schedule of the same selection and format (so the folder can be changed by adding it again).
func CheckSchedule ¶
CheckSchedule says why s cannot be scheduled, or nil: a selection name, a table format (the SSH client formats write a host list another way), and an absolute folder.
func CheckStore ¶
CheckStore says why store is not a store, or nil.
func DefaultStore ¶
DefaultStore is where a save goes when none is named: export.save_to, or the user's own store.
func RemoveSchedules ¶
RemoveSchedules removes the schedules of selection: in format, or in every format when format is "". It answers how many went.
func Save ¶
Save keeps sel as name in store. A manifest save goes through the editor, so it is validated and audited like any manifest change; the caller takes the lock and the snapshot a mutation takes.
func SchedulesFile ¶
SchedulesFile is where this account's export schedules are kept.
Types ¶
type Saved ¶
type Saved struct {
Name string `json:"name"`
Store string `json:"store"`
Selection selection.Selection `json:"selection"`
// Shadowed marks a manifest selection hidden by one of this account's
// own with the same name.
Shadowed bool `json:"shadowed,omitempty"`
// Err says why the stored selection cannot be read (another version,
// say). It is listed, so it can be seen and deleted, never used.
Err string `json:"error,omitempty"`
}
Saved is one saved selection.
type Schedule ¶
type Schedule struct {
Selection string `json:"selection"`
Format string `json:"format"`
Folder string `json:"folder"`
}
Schedule writes a saved selection to a folder each day, in one format, as <selection>.<extension>. Schedules are this account's alone: a folder is a path on this machine, so they never go in the manifest.