Write into a marked block of a text file instead of over it, so a shared hosts file keeps every line that is not the mesh's (hq issue 128)
This commit is contained in:
+14
-1
@@ -84,7 +84,7 @@ type Applied struct {
|
||||
Reads map[string]string `json:"reads,omitempty"`
|
||||
}
|
||||
|
||||
// Into is what a file written into held before the mesh's keys.
|
||||
// Into is what a file written into held before the mesh's keys, or before the mesh's block.
|
||||
type Into struct {
|
||||
Format string `json:"format"`
|
||||
Before map[string]json.RawMessage `json:"before,omitempty"`
|
||||
@@ -94,6 +94,19 @@ type Into struct {
|
||||
// to the machine's list — never a member that was already there. Undeclared, only these go,
|
||||
// and drift is judged on these alone (novox/hq ADR 0102).
|
||||
Added map[string][]json.RawMessage `json:"added,omitempty"`
|
||||
|
||||
// Region is, for a file written into a block (novox/hq issue 128), what the lines between the
|
||||
// mesh's markers held before the mesh wrote them — nil when there was no region, which is
|
||||
// different from a region that was there and empty. Undeclared, a recorded region is put back
|
||||
// and an unrecorded one is taken out, markers and all. It is the block's "what each key held
|
||||
// before": the one thing the host needs to give the file back.
|
||||
Region *string `json:"region,omitempty"`
|
||||
// Separated says the host put a blank line between the region and the machine's lines when it
|
||||
// added the region — before it at the end, after it at the start, as At says — so taking the
|
||||
// region out takes that line with it and nothing of the operator's.
|
||||
Separated bool `json:"separated,omitempty"`
|
||||
// At is where the host added the region: "start", or empty for the end.
|
||||
At string `json:"at,omitempty"`
|
||||
}
|
||||
|
||||
// State is the whole of what a node knows about what it has done.
|
||||
|
||||
Reference in New Issue
Block a user