packages

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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobStore

type BlobStore interface {
	Dir() string
	OpenBlob(ctx context.Context, merkle string) (*os.File, error)
}

func NewDirBlobStore

func NewDirBlobStore(dir string) BlobStore

type DirBlobStore

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

func (*DirBlobStore) Dir

func (fs *DirBlobStore) Dir() string

func (*DirBlobStore) OpenBlob

func (fs *DirBlobStore) OpenBlob(ctx context.Context, merkle string) (*os.File, error)

type FileData

type FileData []byte

type Package

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

func (*Package) Expand

func (p *Package) Expand(ctx context.Context, dir string) error

func (*Package) Merkle

func (p *Package) Merkle() string

Merkle returns the meta.far merkle.

func (*Package) Open

func (p *Package) Open(ctx context.Context, path string) (*os.File, error)

Open opens a file in the package.

func (*Package) ReadFile

func (p *Package) ReadFile(ctx context.Context, path string) ([]byte, error)

ReadFile reads a file from a package.

type PackageBuilder

type PackageBuilder struct {
	Name     string
	Version  string
	Cache    string
	Contents map[string]string
}

func NewPackageBuilder

func NewPackageBuilder(name string, version string) (*PackageBuilder, error)

NewPackageBuilder returns a PackageBuilder Must call `Close()` to clean up PackageBuilder

func NewPackageBuilderFromDir

func NewPackageBuilderFromDir(dir string, name string, version string) (*PackageBuilder, error)

NewPackageBuilderFromDir returns a PackageBuilder that initializes from the `dir` package directory. Must call `Close()` to clean up PackageBuilder

func (*PackageBuilder) AddResource

func (p *PackageBuilder) AddResource(path string, contents io.Reader) error

AddResource adds a resource to the package at the given path.

func (*PackageBuilder) Close

func (p *PackageBuilder) Close()

Close removes temporary directories created by PackageBuilder.

func (*PackageBuilder) Publish

func (p *PackageBuilder) Publish(ctx context.Context, pkgRepo *Repository) (string, string, error)

Publish the package to the repository. Returns the TUF package path and merkle on success, or a error on failure.

type Repository

type Repository struct {
	Dir string
	// BlobsDir should be a directory called `blobs` where all the blobs are.
	BlobStore BlobStore
}

func NewRepository

func NewRepository(ctx context.Context, dir string, blobStore BlobStore) (*Repository, error)

NewRepository parses the repository from the specified directory. It returns an error if the repository does not exist, or it contains malformed metadata.

func NewRepositoryFromTar

func NewRepositoryFromTar(ctx context.Context, dst string, src string) (*Repository, error)

NewRepositoryFromTar extracts a repository from a tar.gz, and returns a Repository parsed from it. It returns an error if the repository does not exist, or contains malformed metadata.

func (*Repository) LookupUpdatePrimeSystemImageMerkle

func (r *Repository) LookupUpdatePrimeSystemImageMerkle(ctx context.Context) (string, error)

func (*Repository) LookupUpdateSystemImageMerkle

func (r *Repository) LookupUpdateSystemImageMerkle(ctx context.Context) (string, error)

func (*Repository) OpenBlob

func (r *Repository) OpenBlob(ctx context.Context, merkle string) (*os.File, error)

func (*Repository) OpenPackage

func (r *Repository) OpenPackage(ctx context.Context, path string) (Package, error)

OpenPackage opens a package from the repository.

func (*Repository) Serve

func (r *Repository) Serve(ctx context.Context, localHostname string, repoName string) (*Server, error)

func (*Repository) VerifyMatchesAnyUpdateSystemImageMerkle

func (r *Repository) VerifyMatchesAnyUpdateSystemImageMerkle(ctx context.Context, merkle string) error

type Server

type Server struct {
	Dir       string
	BlobStore BlobStore
	URL       string
	Hash      string
	// contains filtered or unexported fields
}

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context)

Jump to

Keyboard shortcuts

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