prometheus

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: GPL-3.0 Imports: 14 Imported by: 2

README


Prometheus is a simple and accessible library for pulling and mounting container images. It is designed to be used as a dependency in ABRoot and Albius.

Build dependencies

  • libbtrfs-dev
  • libdevmapper-dev
  • libgpgme-dev

Usage

You can see examples of how to use Prometheus in the examples directory.

A reference documentation is available on pkg.go.dev.

License

This project is based on some of the containers libraries, which are licensed under the Apache License 2.0.

Prometheus is distributed under the GPLv3 license.

Run tests

go test -v ./tests/...

Why the name Prometheus?

Prometheus was the Titan of Greek mythology who stole fire from the gods to give it to humans, symbolizing the transmission of knowledge and technology. The Prometheus package provides a simple and accessible solution for pulling and mounting container images, making it easier to interact with OCI images in other projects.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OciManifest

type OciManifest struct {
	SchemaVersion int                 `json:"schemaVersion"`
	MediaType     string              `json:"mediaType"`
	Config        OciManifestConfig   `json:"config"`
	Layers        []OciManifestConfig `json:"layers"`
}

type OciManifestConfig

type OciManifestConfig struct {
	MediaType string `json:"mediaType"`
	Size      int    `json:"size"`
	Digest    string `json:"digest"`
}

type Prometheus

type Prometheus struct {
	Store  cstorage.Store
	Config PrometheusConfig
}

func NewPrometheus

func NewPrometheus(root, graphDriverName string, maxParallelDownloads uint) (*Prometheus, error)

NewPrometheus creates a new Prometheus instance, note that currently * Prometheus only works with custom stores, so you need to pass the * root graphDriverName to create a new one.

func (*Prometheus) BuildContainerFile added in v0.1.4

func (p *Prometheus) BuildContainerFile(dockerfilePath string, imageName string) (cstorage.Image, error)

BuildContainerFile builds a dockerfile and returns the manifest of the built * image and an error if any.

func (*Prometheus) DoesImageExist

func (p *Prometheus) DoesImageExist(digest string) (bool, error)

DoesImageExist checks if an image exists in the Prometheus store by its * digest. It returns a boolean indicating if the image exists and an error * if any.

func (*Prometheus) GetImageByDigest

func (p *Prometheus) GetImageByDigest(digest string) (cstorage.Image, error)

GetImageByDigest returns an image from the Prometheus store by its digest.

func (*Prometheus) MountImage

func (p *Prometheus) MountImage(layerId string) (string, error)

MountImage mounts an image from the Prometheus store by its main layer * digest. It returns the mount path and an error if any.

func (*Prometheus) PullImage

func (p *Prometheus) PullImage(imageName, dstName string) (*OciManifest, error)

PullImage pulls an image from a remote registry and stores it in the Prometheus store. It returns the manifest of the pulled image and an error if any. Note that the 'docker://' prefix is automatically added to the imageName to make it compatible with the alltransports.ParseImageName method.

func (*Prometheus) PullImageAsync added in v0.2.0

func (p *Prometheus) PullImageAsync(imageName, dstName string, progressCh chan types.ProgressProperties, manifestCh chan OciManifest) error

PullImageAsync does the same thing as PullImage, but returns right after starting the pull process. The user can track progress in the background by reading from the `progressCh` channel, which contains information about the current blob and its progress. When the pull process is done, the image's manifest will be sent via the `manifestCh` channel, which indicates the process is done.

NOTE: The user is responsible for closing both channels once the operation completes.

func (*Prometheus) UnMountImage

func (p *Prometheus) UnMountImage(layerId string, force bool) (bool, error)

UnMountImage unmounts an image from the Prometheus store by its main layer * digest. It returns a boolean indicating if the unmount was successful and * an error if any.

type PrometheusConfig added in v0.1.5

type PrometheusConfig struct {
	Root                 string
	GraphDriverName      string
	MaxParallelDownloads uint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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