Define Artifact diffs layers

It also add in simpledocker a naive implementation using the container-diff binary, which is supposed to go away with a proper API implementation.
This commit is contained in:
Ettore Di Giacinto
2019-11-09 13:58:15 +01:00
parent 1131a52f97
commit 45651a3bcc
5 changed files with 117 additions and 14 deletions

View File

@@ -15,7 +15,9 @@
package compiler
import pkg "github.com/mudler/luet/pkg/package"
import (
pkg "github.com/mudler/luet/pkg/package"
)
type Compiler interface {
Compile(CompilationSpec) (Artifact, error)
@@ -36,9 +38,30 @@ type CompilerBackend interface {
BuildImage(CompilerBackendOptions) error
ExportImage(CompilerBackendOptions) error
RemoveImage(CompilerBackendOptions) error
Changes(fromImage, toImage string) ([]ArtifactLayer, error)
ImageDefinitionToTar(CompilerBackendOptions) error
}
type Artifact interface {
GetPath() string
SetPath(string)
}
type ArtifactNode struct {
Name string `json:"Name"`
Size int `json:"Size"`
}
type ArtifactDiffs struct {
Additions []ArtifactNode `json:"Adds"`
Deletions []ArtifactNode `json:"Dels"`
Changes []ArtifactNode `json:"Mods"`
}
type ArtifactLayer struct {
FromImage string `json:"Image1"`
ToImage string `json:"Image2"`
Diffs ArtifactDiffs `json:"Diff"`
}
// CompilationSpec represent a compilation specification derived from a package
type CompilationSpec interface {
RenderBuildImage() (string, error)