node-engine: a run's compose-candidate key reads candidates.run-<id> by its group, with no heads compared (A-226c)
Builds: design 47 G (G-22 lead answers 2) A-226c; A-226b
This commit is contained in:
@@ -149,10 +149,6 @@ func (s *Shadow) composeCandidate(ctx context.Context, c *Composer, ask nodeengi
|
||||
if err != nil {
|
||||
return refuse(err.Error())
|
||||
}
|
||||
if key.Kind == nec.CandidateRun {
|
||||
// A run on request's candidate is named by `run-<id>` (A-226b); the node-engine reads none yet.
|
||||
return refuse("the node-engine reads no run on request's candidate yet: " + ask.Candidate)
|
||||
}
|
||||
if !s.ready.Load() {
|
||||
return unready(errNotReady.Error())
|
||||
}
|
||||
@@ -172,6 +168,11 @@ func (s *Shadow) composeCandidate(ctx context.Context, c *Composer, ask nodeengi
|
||||
}
|
||||
} else {
|
||||
group, heads = key.Group, key.HeadsHash
|
||||
if key.Kind == nec.CandidateRun {
|
||||
// A run on request's candidate is the indexer's `candidates.run-<id>`, read by its group as a check's is, with no
|
||||
// heads to compare: the run is asked for by its id alone (A-226c).
|
||||
group, heads = "run-"+key.Run, ""
|
||||
}
|
||||
// The ask names the check (the composition key, `<group>.<heads hash>`); the indexer keys the group's candidate by
|
||||
// the group alone (buckets.CandidateKey) and holds its heads hash in the value.
|
||||
ckey, err := buckets.CandidateKey(group)
|
||||
@@ -189,7 +190,7 @@ func (s *Shadow) composeCandidate(ctx context.Context, c *Composer, ask nodeengi
|
||||
if err != nil {
|
||||
return refuse(fmt.Sprintf("the indexer's candidate %s cannot be read: %v", ask.Candidate, err))
|
||||
}
|
||||
if cand.Heads != heads {
|
||||
if key.Kind == nec.CandidateCheck && cand.Heads != heads {
|
||||
// The group moved to other heads: the check asked is replaced, and this node composes not a candidate it was
|
||||
// not asked about. No answer (ADR 0593 §9), never a verdict on the wrong heads.
|
||||
return unready(fmt.Sprintf("the indexer's candidate of the group %s is at heads %s, not %s: the check asked is replaced", group, cand.Heads, heads))
|
||||
|
||||
Reference in New Issue
Block a user