Documentation ¶
Overview ¶
Package packages contains utilities and manager to sync Viam packages defined in the RDK config from the Viam app to the local robot.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidPackageRef = errors.New("invalid package reference")
ErrInvalidPackageRef is an error when a invalid package reference syntax.
var ErrPackageMissing = errors.New("package missing")
ErrPackageMissing is an error when a package cannot be found.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { // PackagePath returns the package if it exists and is already downloaded. If it does not exist it returns a ErrPackageMissing error. PackagePath(name PackageName) (string, error) // RefPath returns the absolute path of the package reference for a given path with a package reference. // - If not the original path is not a package reference the original path is returned without an error. // - If the path contains a package reference and the package does not exist a ErrPackageMissing will be returned. // - Any syntax errors in the package reference will produce an ErrInvalidPackageRef. RefPath(name string) (string, error) }
Manager provides a managed interface for looking up package paths. This is separated from ManagerSyncer to avoid passing the full sync interface to all components.
type ManagerSyncer ¶
type ManagerSyncer interface { Manager // Close the manager Close() error // Sync will download and create the symbolic logic links to all the given PackageConfig. Sync will not remove any unused // data packages. You must call Cleanup() to remove leftovers. Sync will block until all packages are loaded to the file system. // Sync should only be used by one goroutine at once. // If errors occur during sync the manager should continue trying to download all packages and then return any errors that occurred. // If the context is canceled the manager will stop syncing and return an interrupted error. Sync(ctx context.Context, packages []config.PackageConfig) error // Cleanup removes any unused packages known to the Manager that are no longer used. It removes the packages from the file system. // Returns any errors during the cleanup process. Cleanup(ctx context.Context) error }
ManagerSyncer provides a managed interface for both reading package paths and syncing packages from the RDK config.
func NewCloudManager ¶
func NewCloudManager(client pb.PackageServiceClient, packagesDir string, logger golog.Logger) (ManagerSyncer, error)
NewCloudManager creates a new manager with the given package service client and directory to sync to.
func NewNoopManager ¶
func NewNoopManager() ManagerSyncer
NewNoopManager returns a noop package manager that does nothing. On path requests it returns the name of the package.
type PackageName ¶
type PackageName string
PackageName is the logical name of the package on the local rdk. Can point to ID/Version of an actual package.
type PackagePathVisitor ¶ added in v0.2.28
type PackagePathVisitor struct {
// contains filtered or unexported fields
}
PackagePathVisitor is a visitor that replaces strings containing references to package names with the path containing the package files on the robot.
func NewPackagePathVisitor ¶ added in v0.2.28
func NewPackagePathVisitor(packageManager Manager) *PackagePathVisitor
NewPackagePathVisitor creates a new PackagePathVisitor.
func (*PackagePathVisitor) Visit ¶ added in v0.2.28
func (v *PackagePathVisitor) Visit(data interface{}) (interface{}, error)
Visit implements config.Visitor.
type PackageVersion ¶
type PackageVersion string
PackageVersion is an immutable package version for a given package id.