Documentation
¶
Overview ¶
Package configsync lets the OFREP bulk evaluation answer a client that was notified of a newer configuration than the one the relay has loaded: the relay checks its control plane first, within a bound, and answers with what it then has. It never fails a request and never waits without a bound.
Index ¶
Constants ¶
const ( // Wait is the longest a request waits for the control plane check that its flagConfigEtag or // flagConfigLastModified asks for. The request context ends the wait earlier. Wait = 2 * time.Second // MinInterval is the shortest time between two control plane checks that requests start: a client that names a // configuration that never comes (a made-up value) costs the control plane one check per interval, for the // whole relay, however many requests it sends. A request that arrives while a check runs waits for that check. MinInterval = time.Second // QueryETag is the query parameter of the OFREP bulk evaluation that carries the etag of the change notification. QueryETag = "flagConfigEtag" // QueryLastModified is the query parameter that carries the lastModified of the change notification. QueryLastModified = "flagConfigLastModified" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gate ¶
type Gate struct {
// contains filtered or unexported fields
}
Gate starts the control plane checks that requests ask for. A request that is behind is answered only after a check that started after it arrived (or when its wait ends), so it never takes the state it found as the answer to a notification. The checks are at least MinInterval apart: a request that finds no slot free waits for the next one, and the requests that arrive before that check starts share it.
func NewGate ¶
func NewGate() *Gate
NewGate returns a gate on the clock of the process and on real timers.
func NewGateWith ¶
NewGateWith returns a gate that reads the time from now and waits for a slot with after (a timer that fires once after the duration): tests give it a clock and timers they drive.
func (*Gate) CheckNow ¶
CheckNow asks the control plane for the latest configuration for a request that is behind, and waits for the answer: for the slot of its check (at most one check starts per MinInterval) and for the check itself, in all at most Wait and never longer than ctx. It reports whether a check that started after the request arrived finished; false means the wait ended first, and the caller answers with what the relay has.
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
Target is the configuration a request names. The zero value names none.
func FromRequest ¶
FromRequest reads the parameters of the request. It allocates nothing when the request carries neither of them (the common case): the raw query is searched before it is parsed. A value that cannot be read is as if it was not sent, a request is never refused for it.