Help us shape the future of Go! Take the 2026 Go Developer Survey

service

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMaxEvaluatorWait added in v0.12.4

func WithMaxEvaluatorWait(wait time.Duration) *maxEvaluatorWait

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler converts a model prediction HTTP request to its internal calls.

func NewHandler

func NewHandler(service *Service, pool *buffer.Pool, maxDuration time.Duration,
	m *gmetric.Service, lrOV prometheus.ObserverVec) *Handler

NewHandler creates a new HTTP service Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(writer http.ResponseWriter, httpRequest *http.Request)

type Option

type Option interface {
	Apply(c *Service)
}

func WithDataStorer

func WithDataStorer(storer datastore.Storer) Option

type Response

type Response struct {
	Status         string
	Error          string
	DictHash       int
	Data           interface{}
	ServiceTimeMcs int
	// contains filtered or unexported fields
}

Response represents service response

func (*Response) IsNil

func (r *Response) IsNil() bool

IsNil returns true if nil (gojay json API)

func (*Response) MarshalJSONObject

func (r *Response) MarshalJSONObject(enc *gojay.Encoder)

MarshalJSONObject marshal response

func (*Response) SetError

func (r *Response) SetError(err error)

SetError sets errors

type Service

type Service struct {

	// reload TODO finish refactor
	ReloadOK int32
	// contains filtered or unexported fields
}

Service serves as the entrypoint for using the ML model. It is responsible for caching, the ML model provides some metadata related to caching.

func New

func New(ctx context.Context, cfg *config.Model, tfsrv *tfmodel.Service, fs afs.Service, metrics *gmetric.Service, datastores map[string]*datastore.Service, options ...Option) (*Service, error)

New creates a service

func (*Service) Close

func (s *Service) Close() error

func (*Service) Config

func (s *Service) Config() *config.Model

func (*Service) Dictionary

func (s *Service) Dictionary() *common.Dictionary

func (*Service) Do

func (s *Service) Do(ctx context.Context, request *request.Request, response *Response) error

func (*Service) NewRequest

func (s *Service) NewRequest() *request.Request

NewRequest should be used for Do()

func (*Service) Signature added in v0.13.0

func (s *Service) Signature() *domain.Signature

func (*Service) Stats added in v0.13.0

func (s *Service) Stats() map[string]interface{}

Jump to

Keyboard shortcuts

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