registry

package
v1.8.0-rc2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MinInterval = time.Minute * 5

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

Variables

This section is empty.

Functions

func CheckHealthStatus added in v1.8.0

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

CheckHealthStatus checks status of a given registry

Types

type DefaultManager added in v1.8.0

type DefaultManager struct{}

DefaultManager implement the Manager interface

func NewDefaultManager added in v1.8.0

func NewDefaultManager() *DefaultManager

NewDefaultManager returns an instance of DefaultManger

func (*DefaultManager) Add added in v1.8.0

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

Add adds a new registry

func (*DefaultManager) Get added in v1.8.0

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

Get gets a registry by id

func (*DefaultManager) GetByName added in v1.8.0

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

GetByName gets a registry by its name

func (*DefaultManager) HealthCheck added in v1.8.0

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 added in v1.8.0

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

List lists registries according to query provided.

func (*DefaultManager) Remove added in v1.8.0

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

Remove deletes a registry

func (*DefaultManager) Update added in v1.8.0

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

Update updates a registry

type HealthChecker added in v1.8.0

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 added in v1.8.0

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 added in v1.8.0

func (c *HealthChecker) Run()

Run performs health check for all registries regularly

type Manager added in v1.8.0

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
y or Y : Canonical URL