Documentation ¶
Index ¶
- Variables
- type Filter
- type HasVersion
- type List
- func (src List) AllReleases() []string
- func (src List) Exclude(excluded List) List
- func (l List) Len() int
- func (l List) Less(i, j int) bool
- func (src List) Match(f Filter) (List, error)
- func (src List) Newest() (version.Number, List)
- func (src List) OneArch() (string, error)
- func (src List) OneRelease() string
- func (src List) String() string
- func (l List) Swap(i, j int)
- func (src List) URLs() map[version.Binary][]string
- type Tools
- type Versions
Constants ¶
This section is empty.
Variables ¶
var ErrNoMatches = errors.New("no matching agent binaries available")
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct { // Number, if non-zero, causes the filter to match only tools with // that exact version number. Number version.Number // OSType, if not empty, causes the filter to match only tools with // that os type. OSType string // Arch, if not empty, causes the filter to match only tools with // that architecture. Arch string }
Filter holds criteria for choosing tools.
type HasVersion ¶
type HasVersion interface {
// AgentVersion returns the agent version.
AgentVersion() version.Number
}
HasVersion instance store an agent version.
type List ¶
type List []*Tools
List holds tools available in an environment. The order of tools within a List is not significant.
func (List) AllReleases ¶
AllReleases returns all os types for which some tools in src were built.
func (List) Match ¶
Match returns a List, derived from src, containing only those tools that match the supplied Filter. If no tools match, it returns ErrNoMatches.
func (List) OneArch ¶
OneArch returns a single architecture for all tools in src, or an error if there's more than one arch (or none) present.
func (List) OneRelease ¶
OneRelease returns the single os type for which all tools in src were built.
type Tools ¶
type Tools struct { Version version.Binary `json:"version"` URL string `json:"url"` SHA256 string `json:"sha256,omitempty"` Size int64 `json:"size"` }
Tools represents the location and version of a tools tarball.
func (*Tools) AgentVersion ¶
func (t *Tools) AgentVersion() version.Number
AgentVersion is the version of Juju being represented.
type Versions ¶
type Versions []HasVersion
Versions holds instances of HasVersion.
func (Versions) Match ¶
Match returns a List, derived from src, containing only those instances that match the supplied Filter. If no tools match, it returns ErrNoMatches.
func (Versions) Newest ¶
Newest returns the greatest version in src, and the instances with that version.
func (Versions) NewestCompatible ¶
func (src Versions) NewestCompatible(base version.Number, allowDevBuilds bool) (newest version.Number, found bool)
NewestCompatible returns the most recent version compatible with base, i.e. with the same major number and greater or equal minor, patch and build numbers.