service

package
v1.0.2-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCheckTokenUnknownError         = errors.New("an unknown error occurred while verifying token")
	ErrUnknownRequestType             = errors.New("an unknown request type")
	ErrConnToAuthSvr                  = errors.New("failed to connect to authentication server")
	ErrWebServerConfigServiceNotExist = errors.New("web server config service is not exist")
	// Monitor Error
	ErrStopMonitoringTimeout       = errors.New("stop monitoring timeout")
	ErrMonitoringServiceSuspension = errors.New("monitoring service suspension")
	ErrMonitoringStarted           = errors.New("monitoring started")
	// offstage Error
	ErrDataSendingTimeout     = errors.New("data sending timeout")
	ErrWatchLogTimeout        = errors.New("the WatchLog operation timed out")
	ErrLogWatcherCloseTimeout = errors.New("the LogWatcher Close timed out")
	// request input Error
	ErrNilRequestInfo = errors.New("requestInfo parameter is nil")
	// responseInfo Error
	ErrInvalidResponseInfo = errors.New("invalid response info object")
)

Functions

This section is empty.

Types

type LogWatcher

type LogWatcher interface {
	GetDataChan() <-chan []byte
	GetTransferErrorChan() <-chan error
	Close() error
}

func NewLogWatcher

func NewLogWatcher(dataChan chan []byte, errChan chan error, closeFunc func() error) LogWatcher

type Metrics

type Metrics interface {
	Start() error
	Stop() error
	Report() ([]byte, error)
}

func NewMetrics

func NewMetrics(webServerInfoFunc func() []WebServerInfo, errChan chan error) Metrics

type Offstage

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

func NewOffstage

func NewOffstage(services map[string]WebServerConfigService, configManagers map[string]configuration.ConfigManager, metrics Metrics) *Offstage

func (Offstage) DisplayConfig

func (o Offstage) DisplayConfig(serverName string) ([]byte, error)

func (Offstage) DisplayServersStatus

func (o Offstage) DisplayServersStatus() ([]byte, error)

func (Offstage) GetConfig

func (o Offstage) GetConfig(serverName string) ([]byte, error)

func (Offstage) Range

func (o Offstage) Range(rangeFunc func(serverName string, configService WebServerConfigService) bool)

func (Offstage) ShowStatistics

func (o Offstage) ShowStatistics(serverName string) ([]byte, error)

func (*Offstage) Start

func (o *Offstage) Start() error

func (*Offstage) Stop

func (o *Offstage) Stop() error

func (*Offstage) UpdateConfig

func (o *Offstage) UpdateConfig(serverName string, data []byte) error

func (Offstage) WatchLog

func (o Offstage) WatchLog(serverName, logName string) (LogWatcher, error)

type OffstageManager

type OffstageManager interface {
	Start() error
	Stop() error
}

type RequestType

type RequestType int
const (
	UnknownReqType RequestType = iota
	DisplayConfig
	GetConfig
	ShowStatistics
	DisplayServersStatus

	UpdateConfig

	WatchLog
)

type Service

type Service interface {
	Viewer() Viewer
	Updater() Updater
	Watcher() Watcher
}

func NewService

func NewService(viewer Viewer, updater Updater, watcher Watcher) Service

type ServiceMiddleware

type ServiceMiddleware func(Service) Service

ServiceMiddleware define service middleware

type State

type State int
const (
	UnknownState State = iota
	Disabled
	Initializing
	Abnormal
	Normal
)

type UpdateRequestInfo

type UpdateRequestInfo interface {
	// contains filtered or unexported methods
}

func NewUpdateRequestInfo

func NewUpdateRequestInfo(ctx context.Context, reqTypeStr, serverName, token string, data []byte) UpdateRequestInfo

type UpdateResponseInfo

type UpdateResponseInfo interface {
	// contains filtered or unexported methods
}

func NewUpdateResponseInfo

func NewUpdateResponseInfo(serverName string, respErr error) UpdateResponseInfo

type Updater

type Updater interface {
	Update(UpdateRequestInfo) UpdateResponseInfo
}

func NewUpdater

func NewUpdater(offstage offstageUpdater) Updater

type UpdaterMiddleware

type UpdaterMiddleware func(Updater) Updater

type ViewRequestInfo

type ViewRequestInfo interface {
	// contains filtered or unexported methods
}

func NewViewRequestInfo

func NewViewRequestInfo(ctx context.Context, reqTypeStr, serverName, token string) ViewRequestInfo

type ViewResponseInfo

type ViewResponseInfo interface {
	// contains filtered or unexported methods
}

func NewViewResponseInfo

func NewViewResponseInfo(serverName string, data []byte, respErr error) ViewResponseInfo

type Viewer

type Viewer interface {
	View(ViewRequestInfo) ViewResponseInfo
}

func NewViewer

func NewViewer(offstage offstageViewer) Viewer

type ViewerMiddleware

type ViewerMiddleware func(Viewer) Viewer

type WatchRequestInfo

type WatchRequestInfo interface {
	// contains filtered or unexported methods
}

func NewWatchRequestInfo

func NewWatchRequestInfo(ctx context.Context, reqTypeStr, serverName, token, watchedObjectName string) WatchRequestInfo

type WatchResponseInfo

type WatchResponseInfo interface {
	BytesChan() <-chan []byte
	TransferErrorChan() <-chan error

	Close() error
	// contains filtered or unexported methods
}

func NewWatchResponseInfo

func NewWatchResponseInfo(serverName string, closeFunc func() error, dataChan <-chan []byte, transferErrChan <-chan error, respErr error) WatchResponseInfo

type Watcher

type Watcher interface {
	Watch(WatchRequestInfo) WatchResponseInfo
}

func NewWatcher

func NewWatcher(offstage offstageWatcher) Watcher

type WatcherMiddleware

type WatcherMiddleware func(Watcher) Watcher

type WebServerConfigService

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

func NewWebServerConfigService

func NewWebServerConfigService(configuration configuration.Configuration, serverBinPath, logsDir string, log *ngLog.Log) WebServerConfigService

func (WebServerConfigService) ServerStatus

func (w WebServerConfigService) ServerStatus() State

func (WebServerConfigService) ServerVersion

func (w WebServerConfigService) ServerVersion() string

type WebServerInfo

type WebServerInfo struct {
	Name    string `json:"name"`
	Status  State  `json:"status"`
	Version string `json:"version"`
}

func NewWebServerInfo

func NewWebServerInfo(name string) WebServerInfo

Jump to

Keyboard shortcuts

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