version

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const SemVerRegex string = `v?([0-9]+)\.([0-9]+)\.([0-9]+)`

SemVerRegex is the regular expression used to parse a semantic version. https://github.com/Masterminds/semver/blob/master/LICENSE.txt

Variables

This section is empty.

Functions

func CheckProcessVersion added in v0.8.1

func CheckProcessVersion(ctx context.Context, log *zap.Logger, config Config, info 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 AllowedVersions

type AllowedVersions struct {
	Bootstrap   SemVer
	Satellite   SemVer
	Storagenode SemVer
	Uplink      SemVer
	Gateway     SemVer
	Identity    SemVer
}

AllowedVersions provides the Minimum SemVer per Service

type Config

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

Config contains the necessary Information to check the Software Version

type DebugHandler added in v0.8.8

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

DebugHandler implements version info endpoint.

func NewDebugHandler added in v0.17.0

func NewDebugHandler(log *zap.Logger) *DebugHandler

NewDebugHandler returns new debug handler.

func (*DebugHandler) ServeHTTP added in v0.17.0

func (server *DebugHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP returns a json representation of the current version information for the binary.

type Info

type Info struct {
	Timestamp  time.Time `json:"timestamp,omitempty"`
	CommitHash string    `json:"commitHash,omitempty"`
	Version    SemVer    `json:"version"`
	Release    bool      `json:"release,omitempty"`
	// contains filtered or unexported fields
}

Info is the versioning information for a binary

var (

	// Build is a struct containing all relevant build information associated with the binary
	Build Info
)

func New

func New(data []byte) (v Info, err error)

New creates Version_Info from a json byte array

func (Info) Marshal

func (v Info) Marshal() (data []byte, err error)

Marshal converts the existing Version Info to any json byte array

func (Info) Proto added in v0.8.1

func (v Info) Proto() (*pb.NodeVersion, error)

Proto converts an Info struct to a pb.NodeVersion TODO: shouldn't we just use pb.NodeVersion everywhere? gogoproto will let us make it match Info.

func (*Info) Stats added in v0.9.0

func (v *Info) Stats(reportValue func(name string, val float64))

Stats implements the monkit.StatSource interface

type SemVer

type SemVer struct {
	Major int64 `json:"major"`
	Minor int64 `json:"minor"`
	Patch int64 `json:"patch"`
}

SemVer represents a semantic version

func NewSemVer

func NewSemVer(v string) (sv SemVer, err error)

NewSemVer parses a given version and returns an instance of SemVer or an error if unable to parse the version.

func (*SemVer) String

func (sem *SemVer) String() (version string)

String converts the SemVer struct to a more easy to handle string

type Service

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

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

func NewService

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

NewService creates a Version Check Client with default configuration

func (*Service) CheckVersion added in v0.8.1

func (srv *Service) CheckVersion(ctx context.Context) (err error)

CheckVersion checks to make sure the version is still okay, returning an error if not

func (*Service) IsAllowed added in v0.8.1

func (srv *Service) IsAllowed() bool

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

func (*Service) Run

func (srv *Service) Run(ctx context.Context) (err error)

Run logs the current version information

Jump to

Keyboard shortcuts

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