Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version string
Version shows the current SONM platform version.
Components like Node, Worker, CLI, etc. share the same version number.
Functions ¶
func ValidateVersion ¶
ValidateVersion performs the current component's version validation. The idea is to notify whether the current version is either outdated or unstable.
Types ¶
type CodecError ¶
type CodecError struct {
// contains filtered or unexported fields
}
CodecError represents an en/decoding error while deserializing a version file content into structured representation.
type FS ¶
type FS interface { // Open opens the version file for reading. Open() (File, error) // Create creates the version file with mode 0666. Create() (File, error) }
FS encapsulates platform dependent filesystem functions.
type LogObserver ¶
type LogObserver struct {
// contains filtered or unexported fields
}
func NewLogObserver ¶
func NewLogObserver(log *zap.SugaredLogger) *LogObserver
func (*LogObserver) OnBleedingEdgeVersion ¶
func (m *LogObserver) OnBleedingEdgeVersion(version, latestVersion semver.Version)
func (*LogObserver) OnDeprecatedVersion ¶
func (m *LogObserver) OnDeprecatedVersion(version, latestVersion semver.Version)
func (*LogObserver) OnError ¶
func (m *LogObserver) OnError(err error)
type OSError ¶
type OSError struct {
// contains filtered or unexported fields
}
OSError represents an OS error that is occurred during version checking.
type Option ¶
type Option func(o *options)
Option is a type alias for configuring version manager.
func WithClock ¶
WithClock allows to assign a specific clock to the version manager.
By default the "time.Now" is used.
func WithVersion ¶
WithVersion allows to specify an application version.
By default the version obtained through link parameters is used.
func WithVersionFetcher ¶
func WithVersionFetcher(versionFetcher VersionFetcher) Option
WithVersionFetcher allows to specify version fetcher.
By default the GitHub tag fetcher is used.
type UpdateError ¶
type UpdateError struct {
// contains filtered or unexported fields
}
UpdateError is an error that can occur while updating the latest known version.
type VersionFetcher ¶
VersionFetcher is a thing that can update the current latest version number from external sources.
type VersionManager ¶
type VersionManager struct {
// contains filtered or unexported fields
}
func NewVersionManager ¶
func NewVersionManager(fs FS, options ...Option) *VersionManager
func (*VersionManager) ValidateCurrentVersion ¶
func (m *VersionManager) ValidateCurrentVersion(ctx context.Context) error
ValidateCurrentVersion validates that the current application version is the latest, reporting errors otherwise.
Is is possible that this method fails to open the version file for some reasons, for example because of permissions. It's the user's responsibility either to handle or to ignore the error returned. It's a good idea is to log such errors as warnings, but do not terminate the program.
type VersionMismatchError ¶
VersionMismatchError indicates about version mismatch with the latest one.
func (*VersionMismatchError) Error ¶
func (m *VersionMismatchError) Error() string
func (*VersionMismatchError) IsBleedingEdge ¶
func (m *VersionMismatchError) IsBleedingEdge() bool
func (*VersionMismatchError) IsDeprecated ¶
func (m *VersionMismatchError) IsDeprecated() bool