class

Fluxion::State::Store

Inherits Reference < Object

Reads and writes state under the user's data directory.

Two properties matter more than speed here: a partially written state file must never exist, and a state file must never be readable or writable by another account — it records what is installed on the machine, and a writable one could make Fluxion skip work that was never done.

Constants

DIRECTORY_MODE = 448
FILE_MODE = 384
SAFE_PROFILE = /\A[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?\z/

Profile names become filenames, so they are constrained rather than escaped: a name that needs escaping is a name that will surprise someone.

Constructors

new(root : String = Store.default_root)
Source

Class methods

default_root
Source

Instance methods

exists?(profile : String) : Bool
Source
find(profile : String, item : ModuleItem) : InstallationStatus::InstalledFromState | Nil

What a prior run recorded about this item, if anything.

Source
load(profile : String) : Document
Source
parse(body : String, profile : String, file : String = "<memory>") : Document

Reads either the current shape or the one the Java implementation wrote.

Source
path(profile : String) : String
Source
reset(profile : String) : Bool
Source
root
Source
save(document : Document) : Nil

Writes through a private temporary file and an atomic rename, so a crash mid-write leaves the previous state intact rather than a truncated file that would be read as "nothing is installed".

Source
update(profile : String, & : Document -> _) : Document
Source