take-in.taken names the catalog graph revision the take-in made (A-448)
Builds: design 47 G (G-22 lead answers 2) A-448; §476, §493
This commit is contained in:
@@ -1154,6 +1154,8 @@ type TakeInTaken struct {
|
||||
OwnBuildUnknown string `json:"own-build-unknown,omitempty"`
|
||||
// why the manifest of the indexer the revision names was refused
|
||||
Refused string `json:"refused,omitempty"`
|
||||
// the catalog graph revision of the branch the take-in made, which the pipelines of its entries start at (design 47 G section 476, A-448)
|
||||
Revision int64 `json:"revision,omitempty"`
|
||||
// when the wait began
|
||||
Since time.Time `json:"since"`
|
||||
// the source revision taken in (design 47 G section 476)
|
||||
|
||||
@@ -2959,6 +2959,10 @@
|
||||
},
|
||||
"description": "the merges it holds, oldest first"
|
||||
},
|
||||
"revision": {
|
||||
"type": "integer",
|
||||
"description": "the catalog graph revision of the branch the take-in made, which the pipelines of its entries start at (design 47 G section 476, A-448)"
|
||||
},
|
||||
"group": {
|
||||
"type": "string",
|
||||
"description": "the delivery group, for a group being gathered"
|
||||
|
||||
@@ -608,6 +608,8 @@ export interface TakeInTaken {
|
||||
"own-build-unknown"?: string;
|
||||
/** why the manifest of the indexer the revision names was refused */
|
||||
"refused"?: string;
|
||||
/** the catalog graph revision of the branch the take-in made, which the pipelines of its entries start at (design 47 G section 476, A-448) */
|
||||
"revision"?: number;
|
||||
/** when the wait began */
|
||||
"since": string;
|
||||
/** the source revision taken in (design 47 G section 476) */
|
||||
|
||||
@@ -657,3 +657,16 @@ func (ix *Indexer) manifestBytes(ctx context.Context, digest string) string {
|
||||
}
|
||||
return raw
|
||||
}
|
||||
|
||||
// NewestRevision is the number of the newest catalog graph revision kept for the watched branch, 0 when none is kept: the
|
||||
// revision a take-in has just made, said with its take-in.taken (design 47 G §476, A-448).
|
||||
func (ix *Indexer) NewestRevision(ctx context.Context, branch string) int64 {
|
||||
if ix.Revisions == nil {
|
||||
return 0
|
||||
}
|
||||
newest, any, err := newestOf(ctx, ix.Revisions, branch)
|
||||
if err != nil || !any {
|
||||
return 0
|
||||
}
|
||||
return newest.Revision
|
||||
}
|
||||
|
||||
@@ -1170,9 +1170,10 @@ func (ix *Indexer) takeInWholeBy(ctx context.Context, entries []PendingEntry, ow
|
||||
ix.forget(claimed...)
|
||||
branch, src, took := ix.takenWhat(ctx, claimed, applied)
|
||||
ix.logf("take-in: %d merges taken in as one revision by %s%s, oldest %s: source revision %d of %s, %d entries", len(claimed), own, byWords(by), claimed[0].Key, src, branch, len(took))
|
||||
revision := ix.NewestRevision(ctx, branch) // the revision this take-in just kept (A-448)
|
||||
for _, t := range takenWaits(claimed) {
|
||||
t.By, t.Why = who, why
|
||||
t.Branch, t.Source, t.Entries = branch, src, took
|
||||
t.Branch, t.Source, t.Entries, t.Revision = branch, src, took, revision
|
||||
ix.sayTakeIn(ctx, t)
|
||||
}
|
||||
return applied, nil
|
||||
|
||||
@@ -1000,6 +1000,7 @@ func TestTakeIn(t *testing.T) { // 1585/T3-T13 (ADR 0633)
|
||||
!strings.Contains(r.Answer, TakeInPendingTool) || len(b.keys()) != 1 {
|
||||
t.Fatalf("a drop nothing covers: %+v, pending %v", r, b.keys())
|
||||
}
|
||||
b.ix.Revisions = newMemObjects(0) // A-448: the taken event names the catalog graph revision the take-in made
|
||||
b.said = nil
|
||||
if r := b.ix.TakeInPendingByHand(ctx, takein.PendingKey(3), "lead@shanks", "the named indexer can never run"); !r.Stored {
|
||||
t.Fatalf("hand take-in: %+v", r)
|
||||
@@ -1013,6 +1014,8 @@ func TestTakeIn(t *testing.T) { // 1585/T3-T13 (ADR 0633)
|
||||
if got.Branch != TrunkBranch || got.Source <= 0 || len(got.Entries) != 1 || got.Entries[0].Module != "avahi" ||
|
||||
got.Entries[0].Commit != sha('d') || got.Entries[0].Fingerprint == "" {
|
||||
t.Errorf("hand take-in said branch %q source %d entries %+v: want main, a source revision and avahi at its commit", got.Branch, got.Source, got.Entries)
|
||||
} else if newest, any, _ := newestTrunk(ctx, b.ix.Revisions); !any || got.Revision != newest.Revision {
|
||||
t.Errorf("hand take-in said revision %d, want the revision it made, %d (A-448)", got.Revision, newest.Revision)
|
||||
} else if _, err := takein.EncodeTakeIn(got); err != nil {
|
||||
t.Errorf("the taken event is refused by its own contract: %v", err)
|
||||
}
|
||||
|
||||
@@ -151,9 +151,11 @@ type TakeIn struct {
|
||||
// Branch, Source and Entries are what a take-in took in (design 47 G §476, §493, §648): the watched branch, the source
|
||||
// revision it makes of that branch, and one entry per module it wrote. Every taken event of one take-in carries the same;
|
||||
// a taken event that ends a wait without a take-in (a group's end, a drop) carries none and starts no pipeline.
|
||||
Branch string `json:"branch,omitempty"`
|
||||
Source int64 `json:"source,omitempty"`
|
||||
Entries []meshcatalog.TakeInEntry `json:"entries,omitempty"`
|
||||
Branch string `json:"branch,omitempty"`
|
||||
Source int64 `json:"source,omitempty"`
|
||||
// Revision is the catalog graph revision of the branch the take-in made (A-448): the pipelines of its entries start at it.
|
||||
Revision int64 `json:"revision,omitempty"`
|
||||
Entries []meshcatalog.TakeInEntry `json:"entries,omitempty"`
|
||||
}
|
||||
|
||||
func (t TakeIn) check() error {
|
||||
|
||||
Reference in New Issue
Block a user