Documentation ¶
Overview ¶
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.
Index ¶
- Constants
- Variables
- func PackageManagers() map[pack.ContextKey]PackageManager
- func RegisterPackageManager(ctxk pack.ContextKey, manager PackageManager) error
- func WithPackageManager(ctx context.Context, pm PackageManager) context.Context
- type CatalogQuery
- type PackageManager
- type PackageManagerOption
- type PackageManagerOptions
- type UmbrellaManager
- func (um UmbrellaManager) AddSource(ctx context.Context, source string) error
- func (um UmbrellaManager) ApplyOptions(pmopts ...PackageManagerOption) error
- func (mm UmbrellaManager) Catalog(ctx context.Context, query CatalogQuery, popts ...pack.PackageOption) ([]pack.Package, error)
- func (um UmbrellaManager) Format() string
- func (um UmbrellaManager) From(sub string) (PackageManager, error)
- func (mm UmbrellaManager) IsCompatible(ctx context.Context, source string) (PackageManager, error)
- func (um UmbrellaManager) NewPackageFromOptions(ctx context.Context, opts *pack.PackageOptions) ([]pack.Package, error)
- func (um UmbrellaManager) Options() *PackageManagerOptions
- func (um UmbrellaManager) Pull(ctx context.Context, path string, opts *pack.PullPackageOptions) ([]pack.Package, error)
- func (um UmbrellaManager) Push(ctx context.Context, path string) error
- func (um UmbrellaManager) RemoveSource(ctx context.Context, source string) error
- func (um UmbrellaManager) Update(ctx context.Context) error
Constants ¶
const UmbrellaContext pack.ContextKey = "umbrella"
Variables ¶
var ( // G is an alias for FromContext. // // We may want to define this locally to a package to get package tagged // package manager. G = FromContext // PM is the system-access umbrella package manager. PM = UmbrellaManager{} )
Functions ¶
func PackageManagers ¶
func PackageManagers() map[pack.ContextKey]PackageManager
func RegisterPackageManager ¶
func RegisterPackageManager(ctxk pack.ContextKey, manager PackageManager) error
func WithPackageManager ¶ added in v0.2.0
func WithPackageManager(ctx context.Context, pm PackageManager) context.Context
WithPackageManager returns a new context with the provided package manager.
Types ¶
type CatalogQuery ¶
type CatalogQuery struct { // Source specifies where the origin of the package Source string // Types specifies the associated list of possible types for the package Types []unikraft.ComponentType // Name specifies the name of the package Name string // Version specifies the version of the package Version string // NoCache forces the package manager to update values in-memory without // interacting with any underlying cache NoCache bool }
CatalogQuery is the request structure with associated attributes which are used to search the package manager's catalog
func NewCatalogQuery ¶
func NewCatalogQuery(s string) CatalogQuery
func (CatalogQuery) String ¶
func (cq CatalogQuery) String() string
type PackageManager ¶
type PackageManager interface { // NewPackage initializes a new package NewPackageFromOptions(context.Context, *pack.PackageOptions) ([]pack.Package, error) // Options allows you to view the current options. Options() *PackageManagerOptions // ApplyOptions allows one to update the options of a package manager ApplyOptions(...PackageManagerOption) error // Update retrieves and stores locally a cache of the upstream registry. Update(context.Context) error // Push a package to the supported registry of the implementation. Push(context.Context, string) error // Pull package(s) from the supported registry of the implementation. Pull(context.Context, string, *pack.PullPackageOptions) ([]pack.Package, error) // Catalog returns all packages known to the manager via given query Catalog(context.Context, CatalogQuery, ...pack.PackageOption) ([]pack.Package, error) // Add a source to the package manager AddSource(context.Context, string) error // Remove a source from the package manager RemoveSource(context.Context, string) error // IsCompatible checks whether the provided source is compatible with the // package manager IsCompatible(context.Context, string) (PackageManager, error) // From is used to retrieve a sub-package manager. For now, this is a small // hack used for the umbrella. From(string) (PackageManager, error) // Format returns the name of the implementation. Format() string }
func FromContext ¶ added in v0.2.0
func FromContext(ctx context.Context) PackageManager
FromContext returns the package manager in the context, or access to the umbrella package manager which iterates over all registered package managers.
func NewUmbrellaManagerFromOptions ¶
func NewUmbrellaManagerFromOptions(opts *PackageManagerOptions) (PackageManager, error)
type PackageManagerOption ¶
type PackageManagerOption func(opts *PackageManagerOptions) error
type PackageManagerOptions ¶
type PackageManagerOptions struct {
// contains filtered or unexported fields
}
PackageManagerOptions contains configuration for the Package
func NewPackageManagerOptions ¶
func NewPackageManagerOptions(opts ...PackageManagerOption) (*PackageManagerOptions, error)
NewPackageManagerOptions creates PackageManagerOptions
type UmbrellaManager ¶
type UmbrellaManager struct {
// contains filtered or unexported fields
}
UmbrellaManager is an ad-hoc package manager capable of cross managing any registered package manager.
func (UmbrellaManager) AddSource ¶
func (um UmbrellaManager) AddSource(ctx context.Context, source string) error
func (UmbrellaManager) ApplyOptions ¶
func (um UmbrellaManager) ApplyOptions(pmopts ...PackageManagerOption) error
func (UmbrellaManager) Catalog ¶
func (mm UmbrellaManager) Catalog(ctx context.Context, query CatalogQuery, popts ...pack.PackageOption) ([]pack.Package, error)
func (UmbrellaManager) Format ¶
func (um UmbrellaManager) Format() string
func (UmbrellaManager) From ¶
func (um UmbrellaManager) From(sub string) (PackageManager, error)
func (UmbrellaManager) IsCompatible ¶
func (mm UmbrellaManager) IsCompatible(ctx context.Context, source string) (PackageManager, error)
IsCompatible iterates through all package managers and returns the first package manager which is compatible with the provided source
func (UmbrellaManager) NewPackageFromOptions ¶
func (um UmbrellaManager) NewPackageFromOptions(ctx context.Context, opts *pack.PackageOptions) ([]pack.Package, error)
func (UmbrellaManager) Options ¶
func (um UmbrellaManager) Options() *PackageManagerOptions
Options allows you to view the current options.
func (UmbrellaManager) Pull ¶
func (um UmbrellaManager) Pull(ctx context.Context, path string, opts *pack.PullPackageOptions) ([]pack.Package, error)
Pull a package from the support registry of the implementation.
func (UmbrellaManager) Push ¶
func (um UmbrellaManager) Push(ctx context.Context, path string) error
Push the resulting package to the supported registry of the implementation.
func (UmbrellaManager) RemoveSource ¶
func (um UmbrellaManager) RemoveSource(ctx context.Context, source string) error