handlers

package
v0.0.0-...-b8c116a Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorMiddleware

func ErrorMiddleware(handler ErrorHandlerFunc) http.HandlerFunc

func InitRequestID

func InitRequestID(next http.Handler) http.Handler

Types

type CoreHandler

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

func NewCoreHandler

func NewCoreHandler(modelSaver ModelSaver, producer Producer, resultQueue string, logger *zap.Logger) *CoreHandler

func (*CoreHandler) Router

func (c *CoreHandler) Router() chi.Router

func (*CoreHandler) SaveModel

func (c *CoreHandler) SaveModel(w http.ResponseWriter, r *http.Request) error

SaveModel godoc

@Summary	Принимает ml модель
@ID			save model
@Tags		Save model
@Param		file	formData	file	true	"Загружаемая ml-модель"
@Success	204
@Failure	400	{object}	app_errors.AppError
@Router		/save_model [post]

type ErrorHandlerFunc

type ErrorHandlerFunc func(http.ResponseWriter, *http.Request) error

type Message

type Message struct {
	ModelType     string `json:"model_type"`
	UserID        string `json:"user_id"`
	ModelURL      string `json:"model_url"`
	FeaturesCount int    `json:"features_count"`
}

type ModelSaver

type ModelSaver interface {
	SaveFile(ctx context.Context, fileName string, file io.Reader) error
	GenerateS3DownloadLink(key string) (string, error)
}

type Producer

type Producer interface {
	Publish(queue string, message []byte) error
}

Jump to

Keyboard shortcuts

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