Documentation ¶
Index ¶
- Variables
- func CreateMetadata(tcs *metrics.Toolchains) metadata.MD
- func FromIncomingContext(ctx context.Context) (*metrics.Toolchains, error)
- type ExecQuerier
- func (q ExecQuerier) IsPicDefault(compiler string) (bool, error)
- func (q ExecQuerier) IsPieDefault(compiler string) (bool, error)
- func (q ExecQuerier) Kind(compiler string) (types.ToolchainKind, error)
- func (q ExecQuerier) Lang(compiler string) (types.ToolchainLang, error)
- func (q ExecQuerier) ModTime(compiler string) (time.Time, error)
- func (q ExecQuerier) TargetArch(compiler string) (string, error)
- func (q ExecQuerier) Version(compiler string) (string, error)
- type FindOption
- type FindOptions
- type Finder
- type FinderWithOptions
- type Querier
- type Store
- func (s *Store) Add(executable string, q Querier) (*types.Toolchain, error)
- func (s *Store) Contains(executable string) bool
- func (s Store) Find(executable string) (*types.Toolchain, error)
- func (s *Store) Intersection(other *Store) []*types.Toolchain
- func (s *Store) Items() chan *types.Toolchain
- func (s *Store) ItemsList() []*types.Toolchain
- func (s *Store) Len() int
- func (s *Store) Merge(other *Store)
- func (s *Store) Remove(tc *types.Toolchain)
- func (s *Store) TryMatch(other *types.Toolchain) (*types.Toolchain, error)
- func (s *Store) UpdateIfNeeded(tc *types.Toolchain) (error, bool)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CreateMetadata ¶
func CreateMetadata(tcs *metrics.Toolchains) metadata.MD
func FromIncomingContext ¶
func FromIncomingContext(ctx context.Context) (*metrics.Toolchains, error)
Types ¶
type ExecQuerier ¶
type ExecQuerier struct{}
func (ExecQuerier) IsPicDefault ¶
func (q ExecQuerier) IsPicDefault(compiler string) (bool, error)
func (ExecQuerier) IsPieDefault ¶
func (q ExecQuerier) IsPieDefault(compiler string) (bool, error)
func (ExecQuerier) Kind ¶
func (q ExecQuerier) Kind(compiler string) (types.ToolchainKind, error)
func (ExecQuerier) Lang ¶
func (q ExecQuerier) Lang(compiler string) (types.ToolchainLang, error)
func (ExecQuerier) TargetArch ¶
func (q ExecQuerier) TargetArch(compiler string) (string, error)
type FindOption ¶
type FindOption func(*FindOptions)
func SearchPathEnv ¶
func SearchPathEnv(search bool) FindOption
func WithFS ¶
func WithFS(fs util.ReadDirStatFS) FindOption
func WithQuerier ¶
func WithQuerier(q Querier) FindOption
func WithSearchPaths ¶
func WithSearchPaths(paths []string) FindOption
type FindOptions ¶
type FindOptions struct { FS util.ReadDirStatFS Querier Querier Path bool SearchPaths []string }
func (*FindOptions) Apply ¶
func (o *FindOptions) Apply(opts ...FindOption)
type Finder ¶
type Finder interface {
FindToolchains(ctx context.Context, opts ...FindOption) *Store
}
A Finder can locate toolchains in a filesystem.
type FinderWithOptions ¶
type FinderWithOptions struct { Finder Opts []FindOption }
type Querier ¶
type Querier interface { Version(compiler string) (string, error) TargetArch(compiler string) (string, error) IsPicDefault(compiler string) (bool, error) IsPieDefault(compiler string) (bool, error) Kind(compiler string) (types.ToolchainKind, error) Lang(compiler string) (types.ToolchainLang, error) ModTime(compiler string) (time.Time, error) }
A Querier can query a compiler to determine its characteristics.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store stores toolchains and provides ways to access them.
func Aggregate ¶
func Aggregate( ctx context.Context, finders ...FinderWithOptions, ) *Store
Aggregate will run all provided finders and merge their results into a single toolchain store.
func (*Store) Add ¶
Add adds a toolchain to the store. The executable given will be queried for details using the given Querier.
func (*Store) Contains ¶
Contains checks whether the given executable is contained in the store. It checks the full path given, and does not modify it.
func (Store) Find ¶
Find returns a toolchain matching the given executable if it is contained in the store. If the path is a symlink, it will be dereferenced.
func (*Store) Intersection ¶
Intersection returns the toolchains that both this store and the other store have in common.
func (*Store) Items ¶
Items returns an iteratable channel which will contain all toolchains in the store. This function is thread safe and the toolchains returned will be copies.
func (*Store) ItemsList ¶
Items returns a slice containing all toolchains in the store. This function is thread safe and the toolchains returned will be copies.
func (*Store) TryMatch ¶
TryMatch will attempt to find a toolchain in this store that matches the provided toolchain, assuming the other toolchain may have come from a different store where the executable name might not match exactly.
func (*Store) UpdateIfNeeded ¶
UpdateIfNeeded will reload a toolchain's details be querying the executable using the original Querier. If the toolchain or store was updated as a result of this operation, the second return value will be true, otherwise it will be false. If the toolchain is no longer valid, the first return value will contain an error describing why.