index

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package index implements a basic index of packages and their relative installation states, as well as thier various top level metadata properties.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIndexFile

func ParseIndexFile(f io.Reader) (result []indexFileEntry, _ error)

ParseIndexFile parses the key=value format in static_packages.

Types

type DynamicIndex

type DynamicIndex struct {
	// contains filtered or unexported fields
}

DynamicIndex provides concurrency safe access to a dynamic index of packages and package metadata

func NewDynamic

func NewDynamic(static *StaticIndex) *DynamicIndex

NewDynamic initializes a DynamicIndex

func (*DynamicIndex) Add

func (idx *DynamicIndex) Add(p pkg.Package, root string) error

Add adds a package to the index

func (*DynamicIndex) AddNeeds

func (idx *DynamicIndex) AddNeeds(root string, needs map[string]struct{}) error

AddNeeds updates the index about the blobs required in order to activate an installing package. It is possible for the addition of needs to race fulfillment that is happening in other concurrent processes. When that occurs, this method will return os.ErrExist.

func (*DynamicIndex) AllPackageBlobs

func (idx *DynamicIndex) AllPackageBlobs() []string

AllPackageBlobs aggregates all installing, dynamic and static index package meta.far blobs into a single list. Any errors encountered along the way are logged, but otherwise the best available list is generated under a single lock, to provide a relatively consistent view of objects that must be maintained. This function is intended for use by the GC and the versions directory. The list will not contain duplicates.

func (*DynamicIndex) Fulfill

func (idx *DynamicIndex) Fulfill(need string)

Fulfill processes the signal that a blob need has been fulfilled. meta.far's are also published through this path, but a meta.far fulfillment does not mean that the package is activated, only that its blob has been written. When a packages 'waiting' set has been emptied, fulfill will call Add, which is the point of activation.

func (*DynamicIndex) Get

func (idx *DynamicIndex) Get(p pkg.Package) (result string, found bool)

Get looks up a package in the dynamic index, returning it if found.

func (*DynamicIndex) GetRoot

func (idx *DynamicIndex) GetRoot(root string) (pkg.Package, bool)

GetRoot looks for a package by merkleroot, returning the matching package and true, if found, an empty package and false otherwise.

func (*DynamicIndex) Installing

func (idx *DynamicIndex) Installing(root string)

Installing marks the given package as being in the process of installing. The package identity is not yet known, and can be updated later using UpdateInstalling.

func (*DynamicIndex) InstallingFailedForPackage

func (idx *DynamicIndex) InstallingFailedForPackage(pkgRoot string)

InstallingFailedForPackage removes an entry from the package installation index, this is called when the package meta.far blob is not readable, or the package is not valid.

func (*DynamicIndex) InstallingList

func (idx *DynamicIndex) InstallingList() []string

func (*DynamicIndex) IsInstalling

func (idx *DynamicIndex) IsInstalling(merkle string) bool

func (*DynamicIndex) List

func (idx *DynamicIndex) List() []pkg.Package

List lists every package in the dynamic index in insertion order.

func (*DynamicIndex) PackageBlobs

func (idx *DynamicIndex) PackageBlobs() []string

PackageBlobs returns the list of blobs which are meta FARs backing packages in the dynamic and static indices.

func (*DynamicIndex) PkgHasNeed

func (idx *DynamicIndex) PkgHasNeed(pkg, root string) bool

func (*DynamicIndex) PkgNeedsList

func (idx *DynamicIndex) PkgNeedsList(pkgRoot string) []string

func (*DynamicIndex) UpdateInstalling

func (idx *DynamicIndex) UpdateInstalling(root string, p pkg.Package)

UpdateInstalling updates the installing index for the given package with an identity once known (that is, once the package meta.far has been able to be opened, so the packages identity is known).

type StaticIndex

type StaticIndex struct {
	// contains filtered or unexported fields
}

StaticIndex is an index of packages that can not change. It is intended for use during early / verified boot stages to present a unified set of packages from a pre-computed and verifiable index file.

func NewStatic

func NewStatic() *StaticIndex

NewStatic initializes an empty StaticIndex

func (*StaticIndex) Get

func (idx *StaticIndex) Get(p pkg.Package) (string, bool)

Get looks up the given package, returning (merkleroot, true) if found, or ("", false) otherwise.

func (*StaticIndex) GetRoot

func (idx *StaticIndex) GetRoot(root string) (pkg.Package, bool)

GetRoot looks for a package by merkleroot, returning the matching package and true, if found, an empty package and false otherwise.

func (*StaticIndex) HasName

func (idx *StaticIndex) HasName(name string) bool

HasName looks for a package with the given `name`

func (*StaticIndex) HasStaticName

func (idx *StaticIndex) HasStaticName(name string) bool

HasStaticName looks for a package with the given `name` in the static static index, ignoring any runtime updates made to the static index.

func (*StaticIndex) HasStaticRoot

func (idx *StaticIndex) HasStaticRoot(root string) bool

HasStaticRoot looks for a package by merkleroot in the static static index, ignoring any runtime updates made to the static index.

func (*StaticIndex) List

func (idx *StaticIndex) List() ([]pkg.Package, error)

List returns the list of packages in byte-lexical order

func (*StaticIndex) ListVersions

func (idx *StaticIndex) ListVersions(name string) []string

ListVersions returns the list of version strings given a package name

func (*StaticIndex) LoadFrom

func (idx *StaticIndex) LoadFrom(f io.Reader, systemImage pkg.Package, systemImageMerkleRoot string) error

LoadFrom reads a static index from `path` and replaces the index in the receiver with the contents.

func (*StaticIndex) PackageBlobs

func (idx *StaticIndex) PackageBlobs() []string

PackageBlobs returns the list of blobs which are meta FARs backing packages in the index.

func (*StaticIndex) Set

func (idx *StaticIndex) Set(p pkg.Package, root string) error

Set sets the given package to the given root. TODO(fxbug.dev/21988) This method should be removed in future, the static index should only be updated as a whole unit via Load.

func (*StaticIndex) StaticPackageBlobs

func (idx *StaticIndex) StaticPackageBlobs() []string

StaticPacakgeBlobs returns the blobs that are the meta FARs for the packages in the static index and never changes, unlike PackageBlobs() which will also include updated versions of packages in the index.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL