rest

package
v1.0.1-0...-7ff242b Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidData              resp.CogmanError = errors.New("cogman rest: Invalid data")
	ErrInvalidMethod            resp.CogmanError = errors.New("cogman rest: Invalid method")
	ErrTaskIDRequired           resp.CogmanError = errors.New("cogman rest: task_id required")
	ErrTaskNotFound             resp.CogmanError = errors.New("cogman rest: task not found")
	ErrBothStartEndTimeRequired resp.CogmanError = errors.New("cogman rest: both start & end time required")
	ErrInvalidTimeRange         resp.CogmanError = errors.New("cogman rest: invalid time ranges")
)

list cogman rest api related errors

Functions

func StartRestServer

func StartRestServer(ctx context.Context, cfg *Config)

StartRestServer initiates a rest server

Types

type CogmanHandler

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

CogmanHandler holds necessary fields for handling

func NewCogmanHandler

func NewCogmanHandler(cfg *Config) *CogmanHandler

NewCogmanHandler return a cogmanHandler instance

func (*CogmanHandler) ServeHTTP

func (s *CogmanHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Config

type Config struct {
	Port string

	AmqpCon *amqp.Connection
	Client  *client.Session

	TaskRep   *repo.TaskRepository
	QueueName []string

	Lgr util.Logger
}

Config hold the required fields

type TaskRetry

type TaskRetry struct {
	TaskID string `json:"task_id"`
	Retry  int    `json:"retry"`
}

TaskRetry holds necessary values to retry a task

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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