Version: v1.8.6 Latest Latest

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

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 10 Imported by: 0




View Source
const MinInterval = time.Minute * 5

MinInterval defines the minimum interval to check registries' health status.


This section is empty.


func CheckHealthStatus

func CheckHealthStatus(r *model.Registry) (model.HealthStatus, error)

CheckHealthStatus checks status of a given registry


type DefaultManager

type DefaultManager struct{}

DefaultManager implement the Manager interface

func NewDefaultManager

func NewDefaultManager() *DefaultManager

NewDefaultManager returns an instance of DefaultManger

func (*DefaultManager) Add

func (m *DefaultManager) Add(registry *model.Registry) (int64, error)

Add adds a new registry

func (*DefaultManager) Get

func (m *DefaultManager) Get(id int64) (*model.Registry, error)

Get gets a registry by id

func (*DefaultManager) GetByName

func (m *DefaultManager) GetByName(name string) (*model.Registry, error)

GetByName gets a registry by its name

func (*DefaultManager) HealthCheck

func (m *DefaultManager) HealthCheck() error

HealthCheck checks health status of every registries and update their status. It will check whether a registry is reachable and the credential is valid

func (*DefaultManager) List

func (m *DefaultManager) List(query ...*model.RegistryQuery) (int64, []*model.Registry, error)

List lists registries according to query provided.

func (*DefaultManager) Remove

func (m *DefaultManager) Remove(id int64) error

Remove deletes a registry

func (*DefaultManager) Update

func (m *DefaultManager) Update(registry *model.Registry, props ...string) error

Update updates a registry

type HealthChecker

type HealthChecker struct {
	// contains filtered or unexported fields

HealthChecker is used to regularly check all registries' health status and update check result to database

func NewHealthChecker

func NewHealthChecker(interval time.Duration, closing chan struct{}) *HealthChecker

NewHealthChecker creates a new health checker - interval specifies the time interval to perform health check for registries - closing is a channel to stop the health checker

func (*HealthChecker) Run

func (c *HealthChecker) Run()

Run performs health check for all registries regularly

type Manager

type Manager interface {
	// Add new registry
	Add(*model.Registry) (int64, error)
	// List registries, returns total count, registry list and error
	List(...*model.RegistryQuery) (int64, []*model.Registry, error)
	// Get the specified registry
	Get(int64) (*model.Registry, error)
	// GetByName gets registry by name
	GetByName(name string) (*model.Registry, error)
	// Update the registry, the "props" are the properties of registry
	// that need to be updated
	Update(registry *model.Registry, props ...string) error
	// Remove the registry with the specified ID
	Remove(int64) error
	// HealthCheck checks health status of all registries and update result in database
	HealthCheck() error

Manager defines the methods that a target manager should implement

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL