Join item 8: versions.WaitsOn dropped (A3i ruling: dead code)
One modules value per module means a trunk claim has no earlier merge of the same name to wait on, so nothing called it; its subtest "merge order" goes with it. Design 51's merge-order line holds by that (a review check). Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
@@ -337,29 +337,6 @@ func Tagged(entries []Entry, series, tag string, floor Floor) string {
|
||||
return fmt.Sprintf("%s%d", prefix, n+1)
|
||||
}
|
||||
|
||||
// Order is merge order (design 51): a claim of a later merge of the same name waits until every earlier merge of it
|
||||
// whose fingerprint the indexer still holds is numbered; a fingerprint replaced by a later merge before its claim is
|
||||
// skipped. held is the fingerprints the indexer still holds for the name with their merge sequences. WaitsOn answers
|
||||
// the earliest merge sequence the claim at merge waits on, 0 when it waits on none.
|
||||
func WaitsOn(entries []Entry, merge uint64, held map[string]uint64) uint64 {
|
||||
numbered := map[string]bool{}
|
||||
for _, e := range entries {
|
||||
if e.Tag == "" {
|
||||
numbered[e.Fingerprint] = true
|
||||
}
|
||||
}
|
||||
var wait uint64
|
||||
for fp, seq := range held {
|
||||
if seq >= merge || numbered[fp] {
|
||||
continue
|
||||
}
|
||||
if wait == 0 || seq < wait {
|
||||
wait = seq
|
||||
}
|
||||
}
|
||||
return wait
|
||||
}
|
||||
|
||||
// Fill is whether a bucket holding bytes of cap is past its finding's mark.
|
||||
func Fill(bytes, capacity uint64) (share float64, full bool) {
|
||||
if capacity == 0 {
|
||||
|
||||
@@ -248,24 +248,6 @@ func TestTheBuildersVersions(t *testing.T) {
|
||||
t.Errorf("CleanTag = %s", got)
|
||||
}
|
||||
})
|
||||
t.Run("merge order", func(t *testing.T) {
|
||||
es := []Entry{{Fingerprint: "f1", Version: "0.1.0", Series: "0.1"}}
|
||||
for _, c := range []struct {
|
||||
name string
|
||||
merge uint64
|
||||
held map[string]uint64
|
||||
want uint64
|
||||
}{
|
||||
{"an earlier merge numbered waits on nothing", 5, map[string]uint64{"f1": 3}, 0},
|
||||
{"an earlier merge not numbered is waited on", 5, map[string]uint64{"f1": 3, "f2": 4}, 4},
|
||||
{"a replaced fingerprint the indexer no longer holds is skipped", 5, map[string]uint64{}, 0},
|
||||
{"a later merge is not waited on", 5, map[string]uint64{"f3": 7}, 0},
|
||||
} {
|
||||
if got := WaitsOn(es, c.merge, c.held); got != c.want {
|
||||
t.Errorf("%s: WaitsOn = %d, want %d", c.name, got, c.want)
|
||||
}
|
||||
}
|
||||
})
|
||||
t.Run("the floor wakes on its silent source, never a timer", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
src := FloorSources{
|
||||
|
||||
Reference in New Issue
Block a user