Documentation ¶
Overview ¶
Package build provides an importable repository of variables set at build time.
Index ¶
- Constants
- Variables
- func CheckCompatibility(self, other *VersionedComponent, customRules ...*InteropRule) error
- func IsIncompatComponents(err error) bool
- func MarshalJSON(name string) ([]byte, error)
- func String(name string) string
- func ToContext(parent context.Context, comp Component, verStr string) (context.Context, error)
- func VersionString(name, version string) string
- type Component
- type ErrIncompatComponents
- type Info
- type InteropRule
- type Version
- func (v Version) Equals(other Version) bool
- func (v Version) GreaterThan(other Version) bool
- func (v Version) GreaterThanOrEquals(other Version) bool
- func (v Version) IsZero() bool
- func (v Version) LessThan(other Version) bool
- func (v Version) LessThanOrEquals(other Version) bool
- func (v Version) MajorDelta(other Version) int
- func (v Version) MinorDelta(other Version) int
- func (v Version) PatchCompatible(other Version) bool
- func (v Version) PatchDelta(other Version) int
- func (v Version) String() string
- type VersionedComponent
Constants ¶
const ( // DaosComponentHeader defines the header name used to convey the component name. DaosComponentHeader = "x-daos-component" // DaosVersionHeader defines the header name used to convey the component version. DaosVersionHeader = "x-daos-version" )
const ( // MaxMinorDelta is the default maximum minor version delta // allowed between two components. MaxMinorDelta = 2 )
Variables ¶
var ( // ErrNoCtxMetadata is returned when no component/version metadata is found in the context. ErrNoCtxMetadata = errors.New("no component/version metadata found in context") // ErrCtxMetadataExists is returned when component/version metadata has already been set in the context. ErrCtxMetadataExists = errors.New("component/version metadata already exists in context") )
var ( // ComponentAny is a wildcard component. ComponentAny = Component("") // ComponentServer represents the control plane server. ComponentServer = Component("server") // ComponentAdmin represents the Control API client. ComponentAdmin = Component("admin") // ComponentAgent represents the compute node agent. ComponentAgent = Component("agent") // ComponentClient represents the libdaos client. ComponentClient = Component("client") )
var ( // ConfigDir should be set via linker flag using the value of CONF_DIR. ConfigDir = "./" // DaosVersion should be set via linker flag using the value of DAOS_VERSION. DaosVersion = "unset" // BuildTime should be set via linker flag using the value of BUILD_TIME. BuildTime = "" // BuildHost should be set via linker flag using the value of BUILD_HOST. BuildHost = "" // BuildInfo should be set via linker flag using the value of BUILD_INFO. BuildInfo = "" // ControlPlaneName defines a consistent name for the control plane server. ControlPlaneName = "DAOS Control Server" // DataPlaneName defines a consistent name for the engine. DataPlaneName = "DAOS I/O Engine" // ManagementServiceName defines a consistent name for the Management Service. ManagementServiceName = "DAOS Management Service" // AgentName defines a consistent name for the compute node agent. AgentName = "DAOS Agent" // CLIUtilName defines a consistent name for the daos CLI utility. CLIUtilName = "DAOS CLI" // AdminUtilName defines a consistent name for the dmg utility. AdminUtilName = "DAOS Admin Tool" // DefaultControlPort defines the default control plane listener port. DefaultControlPort = 10001 // DefaultSystemName defines the default DAOS system name. DefaultSystemName = "daos_server" // VCS is the version control system used to build the binary. VCS = "" // Revision is the VCS revision of the binary. Revision = "" // LastCommit is the time of the last commit. LastCommit time.Time // ReleaseBuild is true if the binary was built with the release tag. ReleaseBuild bool // DirtyBuild is true if the binary was built with uncommitted changes. DirtyBuild bool )
Functions ¶
func CheckCompatibility ¶
func CheckCompatibility(self, other *VersionedComponent, customRules ...*InteropRule) error
CheckCompatibility checks a pair of versioned components for compatibility based on specific interoperability constraints or general rules.
The design is aimed at allowing a component to verify compatibility with another component, and the logic can be customized by callers for specific requirements at the call site.
e.g. "I am server v2.0.0. Am I compatible with agent v1.2.0?"
func IsIncompatComponents ¶
IsIncompatComponents returns true if the error is an instance of ErrIncompatComponents.
func MarshalJSON ¶
MarshalJSON returns a JSON string containing a structured representation of the binary build info.
func String ¶
String returns a string containing the name, version, and for non-release builds, the revision of the binary.
func VersionString ¶
VersionString returns a string concatenation of the supplied name and version.
Types ¶
type Component ¶
type Component string
Component is a component of the system.
type ErrIncompatComponents ¶
type ErrIncompatComponents struct {
Components []*VersionedComponent
}
ErrIncompatComponents is returned when two components are incompatible.
func (ErrIncompatComponents) Error ¶
func (e ErrIncompatComponents) Error() string
type Info ¶
type Info struct { Name string `json:"name"` Version string `json:"version"` Revision string `json:"revision,omitempty"` Dirty bool `json:"dirty,omitempty"` Release bool `json:"release,omitempty"` BuildHost string `json:"build_host,omitempty"` BuildTime *time.Time `json:"build_time,omitempty"` BuildInfo string `json:"build_info,omitempty"` }
Info contains a structured representation of the binary build info.
type InteropRule ¶
type InteropRule struct { Self Component Other Component Description string StopOnSuccess bool // If set, and the rule is satisfied, stop checking rules. Check func(self, other *VersionedComponent) bool Match func(self, other *VersionedComponent) bool }
InteropRule is a rule for checking compatibility between two versioned components.
func (*InteropRule) Matches ¶
func (rule *InteropRule) Matches(self, other *VersionedComponent) bool
Matches returns true if the rule matches the components.
type Version ¶
Version represents a semantic version.
func GetLibraryInfo ¶
GetLibraryInfo attempts to resolve the given library name into a version and path. NB: The library must provide an ABI method to obtain its version, and that method needs to be added to this package in order to support it.
func MustNewVersion ¶
MustNewVersion creates a new version from a string, panics if the version cannot be created.
func NewVersion ¶
NewVersion creates a new version from a string.
func (Version) GreaterThan ¶
GreaterThan tests if the version is greater than the other.
func (Version) GreaterThanOrEquals ¶
GreaterThanOrEquals tests if the version is greater than or equal to the other.
func (Version) LessThanOrEquals ¶
LessThanOrEquals tests if the version is less than or equal to the other.
func (Version) MajorDelta ¶
MajorDelta returns the difference between the major versions.
func (Version) MinorDelta ¶
MinorDelta returns the difference between the minor versions.
func (Version) PatchCompatible ¶
PatchCompatible tests if the major and minor versions are the same.
func (Version) PatchDelta ¶
PatchDelta returns the difference between the patch versions.
type VersionedComponent ¶
VersionedComponent is a component with a version.
func FromContext ¶
func FromContext(ctx context.Context) (*VersionedComponent, error)
FromContext returns a versioned component obtained from the context.
func NewVersionedComponent ¶
func NewVersionedComponent(comp Component, version string) (*VersionedComponent, error)
NewVersionedComponent creates a new VersionedComponent.
func (*VersionedComponent) String ¶
func (vc *VersionedComponent) String() string