Documentation
¶
Overview ¶
Package proxy admits candidate work and budgets shared memory for every protocol.
Index ¶
- type Budget
- type CandidateRun
- type Candidates
- func (c *Candidates) Close()
- func (c *Candidates) Finish(run *CandidateRun)
- func (c *Candidates) Quarantine(ctx context.Context, reason model.QuarantineReason)
- func (c *Candidates) QuarantineStatus() Option[model.Quarantine]
- func (c *Candidates) Quarantined() <-chan model.Quarantine
- func (c *Candidates) Shutdown(ctx context.Context) error
- func (c *Candidates) Start(ctx context.Context, cancel context.CancelFunc) Option[*CandidateRun]
- type CandidatesConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Budget ¶
type Budget struct {
// contains filtered or unexported fields
}
Budget caps buffered memory shared across every in-flight request. Reservations never block, so a full budget fails immediately.
type CandidateRun ¶
type CandidateRun struct {
// contains filtered or unexported fields
}
CandidateRun is one admitted unit of candidate work. Its pointer gives the non-comparable cancellation function a stable map identity.
type Candidates ¶
type Candidates struct {
// contains filtered or unexported fields
}
Candidates admits candidate work and tracks it so quarantine and shutdown can cancel everything in flight. Quarantine lasts for the process lifetime.
func NewCandidates ¶
func NewCandidates(config CandidatesConfig) *Candidates
NewCandidates tracks candidate work, quarantining beyond the configured concurrent runs.
func (*Candidates) Close ¶ added in v0.15.0
func (c *Candidates) Close()
Close refuses further candidate work and cancels active runs without waiting.
func (*Candidates) Finish ¶
func (c *Candidates) Finish(run *CandidateRun)
Finish releases an admitted run once all of its work has stopped.
func (*Candidates) Quarantine ¶
func (c *Candidates) Quarantine(ctx context.Context, reason model.QuarantineReason)
Quarantine refuses all further candidate work and cancels active runs. Only the first reason is kept.
func (*Candidates) QuarantineStatus ¶ added in v0.30.0
func (c *Candidates) QuarantineStatus() Option[model.Quarantine]
QuarantineStatus reports the quarantine in effect, if any.
func (*Candidates) Quarantined ¶ added in v0.39.0
func (c *Candidates) Quarantined() <-chan model.Quarantine
Quarantined returns a channel that receives the quarantine once, when it begins. Only one receiver gets it, so it has a single consumer.
func (*Candidates) Shutdown ¶
func (c *Candidates) Shutdown(ctx context.Context) error
Shutdown refuses further candidate work and waits for active runs to finish.
func (*Candidates) Start ¶
func (c *Candidates) Start(ctx context.Context, cancel context.CancelFunc) Option[*CandidateRun]
Start admits candidate work that cancel stops, returning None when it is refused. Exceeding the concurrency limit quarantines the candidate.
type CandidatesConfig ¶ added in v0.25.0
type CandidatesConfig struct {
// CandidateMaxInFlight limits concurrent candidate requests.
CandidateMaxInFlight int `default:"64" help:"Maximum concurrent candidate requests before quarantine."`
}
CandidatesConfig contains the command-line configuration for candidate admission.
func (CandidatesConfig) Validate ¶ added in v0.25.0
func (c CandidatesConfig) Validate() error
Validate checks that candidates can be admitted.