version

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: AGPL-3.0 Imports: 15 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

This section is empty.

Types

type AllowedVersions

type AllowedVersions struct {
	Bootstrap   []SemVer
	Satellite   []SemVer
	Storagenode []SemVer
	Uplink      []SemVer
	Gateway     []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"`
}

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

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) DebugHandler

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

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

func (*Service) IsUpToDate

func (srv *Service) IsUpToDate() bool

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

func (*Service) Run

func (srv *Service) Run(ctx context.Context) 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