Documentation
¶
Overview ¶
Package storagecensus builds the census of every write of stored entity state in the module: each Badger write, classified by the key it writes, and each change of a field that holds entity state, counts or quota; and it checks that each effect runs under the acquisition its class requires, on every path from an entry point. The census is generated from the fully type-checked module as SSA, with a VTA call graph (docs/generated/stored-entity-census.json and .md); its tests fail when the artifact is stale, when the module does not type-check, or when an effect escapes its acquisition.
Index ¶
Constants ¶
const Module = "github.com/orneryd/nornicdb/"
Module is the import path prefix of the analysed module.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision struct {
Func string `json:"func"`
Pos string `json:"pos"`
// Gates is the write the branch decides: the instruction in Func and
// the path from it to the Badger write.
Gates string `json:"gates"`
Owners []string `json:"owners,omitempty"`
// contains filtered or unexported fields
}
Decision is a branch on hidden state (or on a read that sees hidden entities) that decides whether ordered state is written: a hidden-ID disposition, a suppression change, an accounting choice.
type FieldWriteRow ¶
type FieldWriteRow struct {
Field string `json:"field"`
Class string `json:"class"`
Func string `json:"func"`
Pos string `json:"pos"`
}
FieldWriteRow is a classified field change.
type NamedReason ¶
type Report ¶
type Report struct {
Rules []string `json:"rules"`
// Spaces are the key spaces, with their class and how many writes the
// census found to each.
Spaces []SpaceRow `json:"spaces"`
// Acquisitions are the owners of ordered writes; Exempt the functions
// whose own writes need none, with the reason.
Acquisitions []NamedReason `json:"acquisitions"`
Exempt []NamedReason `json:"exempt"`
// Writes are every Badger write found, per calling context that names
// its key.
Writes []write `json:"writes"`
// FieldWrites are the changes of classified state fields.
FieldWrites []FieldWriteRow `json:"fieldWrites"`
// Decisions are the branches on hidden state that decide a write;
// Disposition the functions where such a decision belongs.
Decisions []Decision `json:"decisions"`
Disposition []NamedReason `json:"disposition"`
// Pending are second interpretations of the write transition that a
// stacked change removes; each must still exist.
Pending []NamedReason `json:"pending"`
// Violations are entry points that reach a write of ordered state no
// acquisition covers, writes whose key the census cannot classify, and
// table rows that no longer match the code.
Violations []string `json:"violations"`
// Unordered details the unordered-write violations.
Unordered []UnorderedRow `json:"unordered"`
}
Report is the census.
type UnorderedRow ¶
type UnorderedRow struct {
Space string `json:"space"`
Class string `json:"class"`
Origin string `json:"origin"`
Entries []string `json:"entries"`
Chain []string `json:"chain"`
// Chains is each entry point's shortest path, for diagnosis only
// (NORNICDB_CENSUS_CHAINS); the artifact keeps the shortest overall.
Chains map[string][]string `json:"-"`
}
UnorderedRow is a write of ordered state that entry points reach with no acquisition: every such entry point, and the shortest path.