Documentation
¶
Overview ¶
Package remask re-masks the home path in records abcd's own local stores hold that were written before the current masking, the way the redacting writers mask it today (scanner.RemaskCallerHome).
It reports by default. Run with Apply false reads every store and names each file it would rewrite, with how many spans it would mask, and changes nothing; Apply true rewrites those files.
Every store is opened as one directory and every read and write goes through that directory's os.Root, so nothing outside the store is reached. Each level down to the store is judged before it is opened, and a symlink at any of them refuses the store. Inside the store a symlink, whether a file or a directory, is reported and never followed. A file that is not valid UTF-8, or holds a NUL byte, is not text the sweep can vouch for, and is reported and left alone. A rewrite is atomic and keeps the file's permission bits. It holds the lock the store's own writer holds (see stores) across a re-read of the file, the comparison with the bytes the sweep read, and the rename, and skips a file whose bytes changed since the sweep read them, so a writer that takes that lock and a rewrite never interleave.
Nothing this package returns names the home: a store is named in tilde or checkout-relative form and a file by its path inside the store.
A checkout's local tier is read only when the checkout passes the declaration the transcript store's own writer reads (history.LocalStoreDeclared), and a file git tracks is never rewritten in any store, so a file a repository committed at a store's path is left as it is.
The stores are the ones whose writers redact the home path at write time and that hold no digest of their own bytes. Raw staging, archives that carry a digest of each file they hold, a store whose writer keeps a path whole by design, and every committed record are not among them. A file that is gone by the time the sweep reaches it (a record a writer replaced) is not reported: there is nothing left of it to mask.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// Path is the file's path inside its store, slash-separated.
Path string `json:"path"`
// Spans is how many spans are masked in it.
Spans int `json:"spans"`
// Wrote is whether this run rewrote it.
Wrote bool `json:"wrote"`
}
File is one record that holds the home path.
type Options ¶
type Options struct {
// Home is the person's home: abcd's home stores are under it.
Home string
// Homes are the home spellings to mask, each in every spelling
// scanner.RemaskCallerHome reads. Empty means Home alone.
Homes []string
// Checkout is the checkout whose local tier is swept; empty sweeps none.
Checkout string
// Apply rewrites; without it nothing is changed.
Apply bool
}
Options is one run.
type Result ¶
type Result struct {
// Applied is whether the run rewrote files; false is a practice run.
Applied bool `json:"applied"`
Stores []StoreReport `json:"stores"`
// Files and Spans total the files that hold the home path, and the spans
// in them.
Files int `json:"files"`
Spans int `json:"spans"`
// Wrote is how many files were rewritten.
Wrote int `json:"wrote"`
}
Result is a whole run.
type Store ¶
type Store struct {
// Name is what a report calls the store.
Name string
// Base and Dir locate the store: Dir is slash-separated and relative to
// the home or the checkout.
Base Base
Dir string
// Patterns are the records, slash-separated and relative to Dir, one
// path.Match pattern per segment.
Patterns []string
// contains filtered or unexported fields
}
Store is one store the sweep reads: where it is and which of its files are records.
type StoreReport ¶
type StoreReport struct {
Store string `json:"store"`
// Where names the store's directory in tilde or checkout-relative form.
Where string `json:"where"`
// Absent is set when the store's directory does not exist.
Absent bool `json:"absent,omitempty"`
// Refused says why the store could not be opened, when it could not.
Refused string `json:"refused,omitempty"`
// Read is how many of its records were read.
Read int `json:"read"`
Files []File `json:"files"`
Skipped []Skipped `json:"skipped"`
}
StoreReport is what the sweep found in one store.