diff --git a/internal/inventory/order.go b/internal/inventory/order.go index b7178943..9e15fa27 100644 --- a/internal/inventory/order.go +++ b/internal/inventory/order.go @@ -142,22 +142,6 @@ func scanEpochs(rows pgx.Rows) ([]Epoch, error) { return out, rows.Err() } -// ReadsEpoch says a machine's node-engine said it reads an epoch in a declaration, by its id. -func (i *Inventory) ReadsEpoch(ctx context.Context, id string) (bool, error) { - var reads bool - if err := i.store.Pool().QueryRow(ctx, `select reads_epoch from node where id = $1`, id).Scan(&reads); err != nil { - return false, fmt.Errorf("reading whether %s reads an epoch: %w", id, err) - } - return reads, nil -} - -// RecordReadsEpoch keeps what a machine's latest report said of reading an epoch. Every report of a -// node-engine that orders its reports says it, so a node-engine rolled back says it no longer does. -func (i *Inventory) RecordReadsEpoch(ctx context.Context, id string, reads bool) error { - _, err := i.store.Pool().Exec(ctx, `update node set reads_epoch = $2 where id = $1`, id, reads) - return err -} - // ReportOrder is the order of an account: the declaration's epoch and sequence it is about, and the // node-engine's own report sequence. Zero in any claims none. type ReportOrder struct { diff --git a/internal/link/heard_order_integration_test.go b/internal/link/heard_order_integration_test.go index b57ed561..35ba28e5 100644 --- a/internal/link/heard_order_integration_test.go +++ b/internal/link/heard_order_integration_test.go @@ -70,7 +70,7 @@ func TestAnOlderReportOfTheSameDeclarationIsRefused(t *testing.T) { } func TestAnOrderedAccountIsNotJudgedByTheDigestSent(t *testing.T) { - inv, heard, id := anOrderedMachine(t) + inv, heard, _ := anOrderedMachine(t) ctx := context.Background() if _, err := heard.Heard(ctx, ordered("d12", 57, 12, 41, "a")); err != nil { t.Fatal(err) @@ -78,13 +78,9 @@ func TestAnOrderedAccountIsNotJudgedByTheDigestSent(t *testing.T) { if doing, said, _ := inv.DoingOf(ctx, "home-server"); !said || doing.Declared != "d12" { t.Fatalf("the newest account the machine gave was set aside by the digest: %+v", doing) } - // And the machine reads an epoch: it orders its reports. - if reads, err := inv.ReadsEpoch(ctx, id); err != nil || !reads { - t.Fatalf("a machine whose reports carry a report sequence is not recorded as reading an epoch: %v", err) - } } -func TestAnUnorderedAccountClearsTheOrderAndTheEpoch(t *testing.T) { +func TestAnUnorderedAccountClearsTheOrder(t *testing.T) { inv, heard, id := anOrderedMachine(t) ctx := context.Background() if _, err := heard.Heard(ctx, ordered("d12", 57, 12, 41, "a")); err != nil { @@ -99,9 +95,6 @@ func TestAnUnorderedAccountClearsTheOrderAndTheEpoch(t *testing.T) { if kept, _ := inv.KeptOrder(ctx, id); kept != (inventory.ReportOrder{}) { t.Fatalf("an unordered account left the order kept: %+v", kept) } - if reads, _ := inv.ReadsEpoch(ctx, id); reads { - t.Fatal("a node-engine that orders nothing is still sent an epoch") - } // The next ordered account, whatever its numbers, has nothing to be older than. if _, err := heard.Heard(ctx, ordered("d14", 58, 14, 1, "a")); err != nil { t.Fatal(err)