batcher

package
v0.0.0-...-c7991bf Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchHandler

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

func New

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

func (*BatchHandler) Consume

func (handler *BatchHandler) Consume()

func (*BatchHandler) ServeHTTP

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

type BatcherInfo

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

func (*BatcherInfo) Init

func (info *BatcherInfo) Init()

type Input

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

type InputInfo

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

type PredictionResponse

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

type Request

type Request struct {
	Queries []interface{} `json:"queries"`
}

type Response

type Response struct {
	Message    string      `json:"message"`
	Prediction interface{} `json:"prediction"`
}

Jump to

Keyboard shortcuts

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