checker

package
v1.15.0-rc Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Error is the error class for version control client errors.
	Error = errs.Class("version control client error")
)

Functions

func CheckProcessVersion

func CheckProcessVersion(ctx context.Context, log *zap.Logger, config Config, info version.Info, service string) (err error)

CheckProcessVersion is not meant to be used for peers but is meant to be used for other utilities.

Types

type Chore added in v0.35.2

type Chore struct {
	Loop *sync2.Cycle
	// contains filtered or unexported fields
}

Chore contains the information and variables to ensure the Software is up to date.

func NewChore added in v0.35.2

func NewChore(service *Service, checkInterval time.Duration) *Chore

NewChore creates a Version Check Client with default configuration.

func (*Chore) Run added in v0.35.2

func (chore *Chore) Run(ctx context.Context) (err error)

Run logs the current version information.

type Client

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

Client defines helper methods for using version control server response data.

architecture: Client

func New

func New(config ClientConfig) *Client

New constructs a new verson control server client.

func (*Client) All

func (client *Client) All(ctx context.Context) (ver version.AllowedVersions, err error)

All handles the HTTP request to gather the latest version information.

func (*Client) OldMinimum

func (client *Client) OldMinimum(ctx context.Context, serviceName string) (ver version.OldSemVer, err error)

OldMinimum returns the version with the given name at the root-level of the version control response. NB: This will be deprecated eventually in favor of what is currently the `processes` root-level object.

func (*Client) Process

func (client *Client) Process(ctx context.Context, processName string) (process version.Process, err error)

Process returns the version info for the named process from the version control server response.

type ClientConfig

type ClientConfig struct {
	ServerAddress  string        `help:"server address to check its version against" default:"https://version.storj.io"`
	RequestTimeout time.Duration `help:"Request timeout for version checks" default:"0h1m0s"`
}

ClientConfig is the config struct for the version control client.

type Config

type Config struct {
	ClientConfig

	CheckInterval time.Duration `help:"Interval to check the version" default:"0h15m0s"`
}

Config contains the necessary Information to check the Software Version.

type Service

type Service struct {
	Info version.Info
	// contains filtered or unexported fields
}

Service contains the information and variables to ensure the Software is up to date

architecture: Service

func NewService

func NewService(log *zap.Logger, config Config, info version.Info, service string) (client *Service)

NewService creates a Version Check Client with default configuration.

func (*Service) CheckVersion

func (service *Service) CheckVersion(ctx context.Context) (latest version.SemVer, err error)

CheckVersion checks to make sure the version is still relevant and returns suggested version, returning an error if not.

func (*Service) Checked added in v0.35.2

func (service *Service) Checked() bool

Checked returns whether the version has been updated.

func (*Service) GetCursor added in v1.9.1

func (service *Service) GetCursor(ctx context.Context) (_ version.RolloutBytes, err error)

GetCursor returns storagenode rollout cursor value.

func (*Service) IsAllowed

func (service *Service) IsAllowed(ctx context.Context) (version.SemVer, bool)

IsAllowed returns whether if the Service is allowed to operate or not.

func (*Service) SetAcceptedVersion added in v1.9.1

func (service *Service) SetAcceptedVersion(version version.SemVer)

SetAcceptedVersion changes accepted version to specific for tests.

Jump to

Keyboard shortcuts

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