version

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: AGPL-3.0 Imports: 18 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, 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

func DebugHandler added in v0.8.8

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

DebugHandler returns a json representation of the current version information for the binary

Types

type AllowedVersions

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

AllowedVersions provides a list of 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 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) (*SemVer, error)

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

func StrToSemVerList

func StrToSemVerList(serviceVersions []string) (versions []SemVer, err error)

StrToSemVerList converts a list of versions to a list of SemVer

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(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