grants: a module's own account sends the chunks of a verb of a seat it holds (A-115)
The validation of mesh-delivery #219 failed twice: the indexer answered seat:mesh-catalog.input, and the bus refused its chunks, since only an account whose process repeats the verb in serves was granted to send them. The indexer's and the assigner's programs answer their seat's input verb on the module's own account; their claims say they serve it.
This commit is contained in:
@@ -50,7 +50,10 @@ func chunkGrants(p Principal) (pub, sub []string) {
|
||||
return nil, nil
|
||||
}
|
||||
for _, c := range p.Chunked {
|
||||
if (p.Kind == KindProcess || p.Kind == KindModule) && slices.Contains(p.AnswersSeat, "seat:"+c.Seat+"."+c.Verb) {
|
||||
// The module's own account sends the chunks of a verb of a seat it holds too: its claim says it serves the verb, and a
|
||||
// process with no bus of its own answers it on that account, whether or not its resource repeats it in `serves` (A-115;
|
||||
// the indexer's input and the assigner's wants input were refused their chunks for that line alone).
|
||||
if (p.Kind == KindProcess || p.Kind == KindModule) && slices.Contains(p.AnswersSeat, "seat:"+c.Seat+"."+c.Verb) || p.Kind == KindModule && holdsVerb(p.Holds, c) {
|
||||
pub, sub = append(pub, chunkSubject(c)), append(sub, ackServed(c))
|
||||
}
|
||||
// Any account of a module, its processes, its node or the tool runner may receive a verb's chunks, invoked or not
|
||||
@@ -63,6 +66,11 @@ func chunkGrants(p Principal) (pub, sub []string) {
|
||||
return pub, sub
|
||||
}
|
||||
|
||||
// holdsVerb says one of the seats held serves the chunked verb.
|
||||
func holdsVerb(holds []Seat, c ChunkVerb) bool {
|
||||
return slices.ContainsFunc(holds, func(s Seat) bool { return s.Name == c.Seat && slices.Contains(s.Serves, c.Verb) })
|
||||
}
|
||||
|
||||
// restoreGrants are the keeper's standing grant of the bus's stream restore subjects and their chunk subjects, for the bus names
|
||||
// of the streams ADR 0436 §3 restricts and only those (design 47 G §681, A-60): the restore request of each and the chunks the
|
||||
// snapshot is sent to.
|
||||
|
||||
Reference in New Issue
Block a user