batcher

package
v0.6.0-rc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SleepTime    = time.Microsecond * 100
	MaxBatchSize = 32
	MaxLatency   = 5000
)

Variables

This section is empty.

Functions

func GenerateUUID added in v0.5.0

func GenerateUUID() string

func GetNowTime added in v0.5.0

func GetNowTime() time.Time

Types

type BatchHandler added in v0.5.0

type BatchHandler struct {
	MaxBatchSize int
	MaxLatency   int
	// contains filtered or unexported fields
}

func New added in v0.5.0

func New(maxBatchSize int, maxLatency int, handler http.Handler, logger *zap.SugaredLogger) *BatchHandler

func (*BatchHandler) Consume added in v0.5.0

func (handler *BatchHandler) Consume()

func (*BatchHandler) ServeHTTP added in v0.5.0

func (handler *BatchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type BatcherInfo added in v0.5.0

type BatcherInfo struct {
	Path               string
	BatchID            string
	Request            *http.Request
	Instances          []interface{}
	PredictionResponse PredictionResponse
	ContextMap         map[*context.Context]InputInfo
	Start              time.Time
	Now                time.Time
	CurrentInputLen    int
}

func (*BatcherInfo) InitializeInfo added in v0.5.0

func (batcherInfo *BatcherInfo) InitializeInfo()

type Input added in v0.5.0

type Input struct {
	ContextInput *context.Context
	Path         string
	Instances    *[]interface{}
	ChannelOut   *chan Response
}

type InputInfo added in v0.5.0

type InputInfo struct {
	ChannelOut *chan Response
	Index      []int
}

type PredictionResponse added in v0.5.0

type PredictionResponse struct {
	Predictions []interface{} `json:"predictions"`
}

type Request added in v0.5.0

type Request struct {
	Instances []interface{} `json:"instances"`
}

type Response added in v0.5.0

type Response struct {
	Message     string        `json:"message"`
	BatchID     string        `json:"batchId"`
	Predictions []interface{} `json:"predictions"`
}

type ResponseError added in v0.5.0

type ResponseError struct {
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL