Documentation
¶
Overview ¶
Package store is the SDK's default state file (the reference's storage.ts, storage-fs.ts; sdk-contract.md section 6): where it lives, and how it is read and written so that neither a crash nor a busy disk ever costs a customer their licence.
Index ¶
Constants ¶
const ( KeepCorrupt = 3 StaleTemp = 60 * time.Second UpdateAttempts = 5 )
What the storage keeps, and how long it tries.
const LockSuffix = ".lock"
LockSuffix names the lock file beside the state file (<file>.lock): empty, and kept, as every process that saves the state locks the same file.
Variables ¶
var ErrConflict = errors.New("keygrant: the state was saved by another process")
ErrConflict is a save that found the state changed by another process on every try.
Functions ¶
func DefaultPath ¶
DefaultPath is where the default storage keeps a product's state (defaultStoragePath): a folder of this user's on THIS machine, never the working directory and never one that roams:
- Windows: %LOCALAPPDATA%\KeyGrant, else ~\AppData\Local\KeyGrant
- macOS: ~/Library/Application Support/KeyGrant
- anything else: $XDG_CONFIG_HOME/keygrant, else ~/.config/keygrant
An empty or relative variable is taken as unset.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is the state file at a path.
func (*File) Read ¶
Read is the stored state, or nil for none. readOnly reads and writes nothing else: no set-aside.