version

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: BSD-3-Clause Imports: 6 Imported by: 160

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compatibility added in v1.3.2

type Compatibility interface {
	// Returns the local version
	Version() Version

	// Returns nil if the provided version is able to connect with the local
	// version. This means that the node will keep connections open with the
	// peer.
	Connectable(Version) error

	// Returns nil if the provided version is compatible with the local version.
	// This means that the version is connectable and that consensus messages
	// can be made to them.
	Compatible(Version) error

	// Returns nil if the provided version shouldn't be masked. This means that
	// the version is connectable but not compatible. The version is so old that
	// it should just be masked.
	Unmaskable(Version) error

	// Returns nil if the provided version will not be masked by this version.
	WontMask(Version) error

	// Returns when additional masking will occur.
	MaskTime() time.Time
}

Compatibility a utility for checking the compatibility of peer versions

func NewCompatibility added in v1.3.2

func NewCompatibility(
	version Version,
	minCompatable Version,
	minCompatableTime time.Time,
	prevMinCompatable Version,
	minUnmaskable Version,
	minUnmaskableTime time.Time,
	prevMinUnmaskable Version,
) Compatibility

NewCompatibility returns a compatibility checker with the provided options

type Parser

type Parser interface {
	Parse(string) (Version, error)
}

Parser defines the interface of a version parser

func NewDefaultParser

func NewDefaultParser() Parser

NewDefaultParser returns a new parser with the default separators

func NewParser

func NewParser(appSeparator string, versionSeparator string) Parser

NewParser returns a new parser

type Version

type Version interface {
	fmt.Stringer

	App() string
	Major() int
	Minor() int
	Patch() int

	Compatible(Version) error
	Before(Version) bool
}

Version defines what is needed to describe a version

func NewDefaultVersion

func NewDefaultVersion(
	app string,
	major int,
	minor int,
	patch int,
) Version

NewDefaultVersion returns a new version with default separators

func NewVersion

func NewVersion(
	app string,
	appSeparator string,
	versionSeparator string,
	major int,
	minor int,
	patch int,
) Version

NewVersion returns a new version

Jump to

Keyboard shortcuts

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