manager

package
v0.12.9 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package manager provides definition of manager

Index

Constants

View Source
const (
	// SigStart is a signal sent to control channel of manager which starts sync of all container
	SigStart = iota
	// SigStop is a signal sent to control channel of manager which stops sync of all container
	SigStop
	// SigExit is a signal sent to control channel of manager which exits manager run loop
	SigExit
	// ExitFinish is a signal from finish channel of manager indicating exit finished
	ExitFinish
	// StopFinish is a signal from finish channel of manager indicating stopping job finished
	StopFinish
	// StartFinish is a signal from finish channel of manager indicating starting job finished
	StartFinish
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckPoint added in v0.12.5

type CheckPoint struct {
	WorkerInfo map[string]WorkerCheckPoint `json:"worker_info"`
}

type Manager

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

Manager holds worker instances

func NewManager

func NewManager(config *config.Config) (*Manager, error)

NewManager creates a new manager with attached workers from config

func (*Manager) Exit

func (m *Manager) Exit()

Exit polling, block until finish(may take several seconds)

func (*Manager) GetStatus

func (m *Manager) GetStatus() *Status

GetStatus gets status of Manager

func (*Manager) Run

func (m *Manager) Run()

Run will block current routine

func (*Manager) Start

func (m *Manager) Start()

Start polling, block until finish(may take several seconds)

func (*Manager) Stop

func (m *Manager) Stop()

Stop polling, block until finish(may take several seconds)

type MangerStatusSimple

type MangerStatusSimple struct {
	Running      bool
	WorkerStatus map[string]WorkerStatusSimple
}

type RestfulAPI

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

RestfulAPI is a JSON-like API of given manager

func NewRestfulAPI

func NewRestfulAPI(m *Manager) *RestfulAPI

NewRestfulAPI returns a pointer to RestfulAPI of given manager

func (*RestfulAPI) GetAPIHandler

func (r *RestfulAPI) GetAPIHandler() http.Handler

GetAPIHandler returns handler that could be used for http package

type Status

type Status struct {
	Running      bool
	WorkerStatus map[string]worker.Status
}

Status holds the status of a manager and its workers WorkerStatus: key = worker's name, value = worker's status

type WorkerCheckPoint added in v0.12.5

type WorkerCheckPoint struct {
	LastInvokeTime time.Time `json:"last_invoke_time"`
}

type WorkerStatusSimple

type WorkerStatusSimple struct {
	// Result is true if sync succeed, else false
	Result bool
	// LastFinished indicates last success time
	LastFinished time.Time
	// Idle stands for whether worker is idle, false if syncing
	Idle bool
}

Jump to

Keyboard shortcuts

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