Documentation
¶
Index ¶
Constants ¶
const ( BatchNotFull = batchFull(0) BatchIsFull = batchFull(1) )
const ( Closing = "closing" FullBatch = "full" InstantQ = "instant" )
Variables ¶
This section is empty.
Functions ¶
func NewDispatcherP ¶
Types ¶
type Service ¶
type Service struct { *adjust.Adjust config.BatcherConfig ServiceMeta // contains filtered or unexported fields }
Service sits on top of an Evaluator and collects predictions calls and attempts to merge multiple calls into a single call, if they occur rapidly enough. This *can* be refactored into smaller types; but it's really more annoying than convenient.
func NewBatcher ¶
func NewBatcher(evaluator evaluator.Evaluator, inputLen int, batchConfig config.BatcherConfig, serviceMeta ServiceMeta) *Service
func (*Service) Evaluate ¶
Evaluate will queue a batch and wait for results. This is safe to run in any number of goroutines.
Evaluate will send the input to be (further) batched to a dispatcher, via the inputQ. See dispatcher.dispatch(), which will then call Service.queueBatch(), which pushes to batchQ. dispatcher also determines if waiting to send to batchQ is appropriate. See queueService.dispatch(), which reads from batchQ which will then finally run evaluator.Evaluator.Evaluate() when appropriate and return the response via a dedicated channel for the goroutine that called Service.Evaluate.
type ServiceMeta ¶
type ServiceMeta struct {
// contains filtered or unexported fields
}
ServiceMeta contains things that should live longer than the life of a Service.
func NewServiceMeta ¶
func NewServiceMeta(m *stat.GMeter, id string) ServiceMeta