version

package
v0.0.0-...-20ab57b Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 5

Documentation

Overview

Package version provides functionality for FrostFS versioning.

FrostFS uses FrostFS API versioning scheme. It uses major and minor version of the API.

In most of the cases it will be enough to use the latest supported FrostFS API version in SDK:

ver := version.Current()

It is possible to specify arbitrary version by setting major and minor numbers:

var ver version.Version
ver.SetMajor(2)
ver.SetMinor(5)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeToString

func EncodeToString(v Version) string

EncodeToString encodes version according to format from specification: semver formatted value without patch and with v prefix, e.g. 'v2.1'.

Types

type Version

type Version refs.Version

Version represents revision number in SemVer scheme.

Version is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs.Version message. See ReadFromV2 / WriteToV2 methods.

Instances can be created using built-in var declaration.

Note that direct typecast is not safe and may result in loss of compatibility:

_ = Version(refs.Version{}) // not recommended

func Current

func Current() (v Version)

Current returns Version instance that initialized to the latest supported FrostFS API revision number in SDK.

func (Version) Equal

func (v Version) Equal(v2 Version) bool

Equal returns true if versions are identical.

func (*Version) Major

func (v *Version) Major() uint32

Major returns major number of the revision.

func (*Version) Minor

func (v *Version) Minor() uint32

Minor returns minor number of the revision.

func (*Version) ReadFromV2

func (v *Version) ReadFromV2(m refs.Version) error

ReadFromV2 reads Version from the refs.Version message. Checks if the message conforms to FrostFS API V2 protocol.

See also WriteToV2.

func (*Version) SetMajor

func (v *Version) SetMajor(val uint32)

SetMajor sets major number of the revision.

func (*Version) SetMinor

func (v *Version) SetMinor(val uint32)

SetMinor sets minor number of the revision.

func (Version) String

func (v Version) String() string

String implements fmt.Stringer.

String is designed to be human-readable, and its format MAY differ between SDK versions.

func (Version) WriteToV2

func (v Version) WriteToV2(m *refs.Version)

WriteToV2 writes Version to the refs.Version message. The message must not be nil.

See also ReadFromV2.

Directories

Path Synopsis
Package versiontest provides functions for testing version package.
Package versiontest provides functions for testing version package.

Jump to

Keyboard shortcuts

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