apiservice

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterMetric

func RegisterMetric(router *gin.Engine)

RegisterMetric registers the metric handler.

Types

type APIInfo

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

func NewAPIInfo

func NewAPIInfo() *APIInfo

func (*APIInfo) SetServiceStatusFatalError

func (s *APIInfo) SetServiceStatusFatalError(err error)

func (*APIInfo) SetServiceStatusIdle

func (s *APIInfo) SetServiceStatusIdle()

func (*APIInfo) SetTableFatalError

func (s *APIInfo) SetTableFatalError(table string, err error)

func (*APIInfo) SetTableStage

func (s *APIInfo) SetTableStage(table string, stage TableStage)

type APIService

type APIService struct {
	APIInfo *APIInfo
	// contains filtered or unexported fields
}
var GlobalInstance *APIService = New()

func New

func New() *APIService

func (*APIService) Serve

func (service *APIService) Serve(l net.Listener)

type InfoResponse

type InfoResponse struct {
	Status       ServiceStatus         `json:"status,omitempty"`
	ErrorMessage string                `json:"error_message,omitempty"`
	TablesInfo   map[string]*TableInfo `json:"tables_info,omitempty"`
}

type ServiceStatus

type ServiceStatus string
const (
	ServiceStatusRunning ServiceStatus = "running"
	ServiceStatusIdle    ServiceStatus = "idle"

	// For example, when connect S3 failed, all table replication will be failed
	ServiceStatusFatalError ServiceStatus = "fatal_error"
)

type TableInfo

type TableInfo struct {
	Stage        TableStage  `json:"stage,omitempty"`
	Status       TableStatus `json:"status,omitempty"`
	ErrorMessage string      `json:"error_message,omitempty"`
}

type TableStage

type TableStage string
const (
	TableStageUnknown            TableStage = "unknown"
	TableStageLoadingSnapshot    TableStage = "loading_snapshot"
	TableStageLoadingIncremental TableStage = "loading_incremental"
	TableStageFinished           TableStage = "finished"
)

type TableStatus

type TableStatus string
const (
	TableStatusNormal     TableStatus = "normal"
	TableStatusFatalError TableStatus = "fatal_error"
)

Jump to

Keyboard shortcuts

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