|
| 1 | +package prometheus // import "github.com/vanilla-os/prometheus" |
| 2 | + |
| 3 | + |
| 4 | +VARIABLES |
| 5 | + |
| 6 | +var version = "0.1.4" |
| 7 | + |
| 8 | +FUNCTIONS |
| 9 | + |
| 10 | +func main() |
| 11 | + |
| 12 | +TYPES |
| 13 | + |
| 14 | +type OciManifest struct { |
| 15 | + SchemaVersion int `json:"schemaVersion"` |
| 16 | + MediaType string `json:"mediaType"` |
| 17 | + Config OciManifestConfig `json:"config"` |
| 18 | + Layers []OciManifestConfig `json:"layers"` |
| 19 | +} |
| 20 | + |
| 21 | +type OciManifestConfig struct { |
| 22 | + MediaType string `json:"mediaType"` |
| 23 | + Size int `json:"size"` |
| 24 | + Digest string `json:"digest"` |
| 25 | +} |
| 26 | + |
| 27 | +type Prometheus struct { |
| 28 | + Store cstorage.Store |
| 29 | +} |
| 30 | + |
| 31 | +func NewPrometheus(root, graphDriverName string) (*Prometheus, error) |
| 32 | + NewPrometheus creates a new Prometheus instance, note that currently * |
| 33 | + Prometheus only works with custom stores, so you need to pass the * root |
| 34 | + graphDriverName to create a new one. |
| 35 | + |
| 36 | +func (p *Prometheus) BuildContainerFile(dockerfilePath string, imageName string) (cstorage.Image, error) |
| 37 | + BuildContainerFile builds a dockerfile and returns the manifest of the built |
| 38 | + * image and an error if any. |
| 39 | + |
| 40 | +func (p *Prometheus) DoesImageExist(digest string) (bool, error) |
| 41 | + DoesImageExist checks if an image exists in the Prometheus store by its * |
| 42 | + digest. It returns a boolean indicating if the image exists and an error * |
| 43 | + if any. |
| 44 | + |
| 45 | +func (p *Prometheus) GetImageByDigest(digest string) (cstorage.Image, error) |
| 46 | + GetImageByDigest returns an image from the Prometheus store by its digest. |
| 47 | + |
| 48 | +func (p *Prometheus) MountImage(layerId string) (string, error) |
| 49 | + MountImage mounts an image from the Prometheus store by its main layer * |
| 50 | + digest. It returns the mount path and an error if any. |
| 51 | + |
| 52 | +func (p *Prometheus) PullImage(imageName string, dstName string) (*OciManifest, error) |
| 53 | + PullImage pulls an image from a remote registry and stores it in the * |
| 54 | + Prometheus store. It returns the manifest of the pulled image and an * |
| 55 | + error if any. Note that the 'docker://' prefix is automatically added * to |
| 56 | + the imageName to make it compatible with the alltransports.ParseImageName * |
| 57 | + method. |
| 58 | + |
| 59 | +func (p *Prometheus) UnMountImage(layerId string, force bool) (bool, error) |
| 60 | + UnMountImage unmounts an image from the Prometheus store by its main layer * |
| 61 | + digest. It returns a boolean indicating if the unmount was successful and * |
| 62 | + an error if any. |
| 63 | + |
0 commit comments