Read the backup holders of every machine, and the notes fixture's data at a resource (issues 1065, 1066)
mesh/merge-gate waits for its group's composed check
mesh/repo-check head 08e000bb56aa merged into trunk 7c9c187ca6e2 beside mesh-catalog#353@c898a937 — fail: its merge-check.sh failed: --- FAIL: TestADeliver…
mesh/delivery-group group feat/backup-before-send rejected: a member's own check failed
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate waits for its group's composed check
mesh/repo-check head 08e000bb56aa merged into trunk 7c9c187ca6e2 beside mesh-catalog#353@c898a937 — fail: its merge-check.sh failed: --- FAIL: TestADeliver…
mesh/delivery-group group feat/backup-before-send rejected: a member's own check failed
mesh/delivery superseded: a newer head of the same pull request
This commit is contained in:
@@ -115,17 +115,38 @@ func backupFactsFrom(entries []inventory.Entry, held []catalogue.Held) backupFac
|
||||
return f
|
||||
}
|
||||
|
||||
// loadBackupFacts reads the facts from the inventory.
|
||||
// loadBackupFacts reads the facts from the inventory. The holders are read as `seats` reads them, from the world
|
||||
// every machine's composition makes (theRestOfTheMesh): the seat_holding table keeps one holder of a node seat, and
|
||||
// node-backup is held on every machine.
|
||||
func loadBackupFacts(ctx context.Context, inv *inventory.Inventory) (backupFacts, error) {
|
||||
entries, err := inv.Catalogued(ctx)
|
||||
return loadBackupFactsFrom(inv.Catalogued, func() ([]catalogue.Held, error) {
|
||||
shelf, err := inv.Catalogue(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
world, err := theRestOfTheMesh(ctx, inv, shelf, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return world.Held, nil
|
||||
}, ctx)
|
||||
}
|
||||
|
||||
// loadBackupFactsFrom is loadBackupFacts given where the entries and the holdings come from. A source that fails
|
||||
// fails the step, to be tried again: a failure never reads as a machine with no holder, which would send without a
|
||||
// backup.
|
||||
func loadBackupFactsFrom(entries func(context.Context) ([]inventory.Entry, error),
|
||||
held func() ([]catalogue.Held, error), ctx context.Context) (backupFacts, error) {
|
||||
es, err := entries(ctx)
|
||||
if err != nil {
|
||||
return backupFacts{}, err
|
||||
return backupFacts{}, fmt.Errorf("the backups of the plan could not be worked out: %w", err)
|
||||
}
|
||||
held, err := inv.Holdings(ctx)
|
||||
h, err := held()
|
||||
if err != nil {
|
||||
return backupFacts{}, err
|
||||
return backupFacts{}, fmt.Errorf("the backups of the plan could not be worked out: who holds %s: %w",
|
||||
catalogue.BackupSeat, err)
|
||||
}
|
||||
return backupFactsFrom(entries, held), nil
|
||||
return backupFactsFrom(es, h), nil
|
||||
}
|
||||
|
||||
// stepBackups takes one step of a plan's backups and says whether the plan may go on to ask its first tier. It
|
||||
|
||||
Reference in New Issue
Block a user