Files
mesh-delivery/modules/mesh-grants/internal/grants/full.go
T

34 lines
1.5 KiB
Go

package grants
import (
occ "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient"
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
)
// **The fill of a module's kept data is the bus module's** (novox/hq ADR 0595 §6, design 25 § 12.3): its one periodic
// read raises `full` at its raise mark and clears it below its clear mark, for every entry that refuses when full. The
// grants part no longer reads any stream's size and raises nothing of fill: `mesh-grants.history-full` moved to the bus
// module, its new condition raised first, then this old key cleared. So the part clears the old key once, at its first
// pass after a start (DLV-G3), whether or not one is held: a clear of a condition not raised is a no-op at the keeper.
// FullCondition is the key of the warning this part raised before ADR 0595 §6 moved fill to the bus module: only ever
// cleared now.
const FullCondition = "mesh-grants.history-full"
// clearFull clears FullCondition once after a start; a clear refused is tried again at the next pass.
func (p *Part) clearFull() {
if p.Say == nil {
return
}
p.holdMu.Lock()
defer p.holdMu.Unlock()
if p.fullCleared {
return
}
c := oc.Condition{Key: FullCondition, Subject: oc.ConditionSubject{Scope: "module", ID: Module}, State: occ.StateCleared,
Resolved: "the fill of a module's kept data is the bus module's own condition now (novox/hq ADR 0595 §6)"}
if p.Say(c) == nil {
p.fullCleared = true
}
}