Skip to content

Commit

Permalink
Support additional layer store
Browse files Browse the repository at this point in the history
Signed-off-by: Kohei Tokunaga <[email protected]>
  • Loading branch information
ktock committed Mar 24, 2021
1 parent 9d6cee0 commit d02abea
Show file tree
Hide file tree
Showing 6 changed files with 461 additions and 10 deletions.
30 changes: 29 additions & 1 deletion drivers/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/directory"
"github.com/containers/storage/pkg/idtools"
digest "github.com/opencontainers/go-digest"
)

// FsMagic unsigned id of the filesystem in use.
Expand All @@ -33,7 +34,9 @@ var (
// ErrPrerequisites returned when driver does not meet prerequisites.
ErrPrerequisites = errors.New("prerequisites for driver not satisfied (wrong filesystem?)")
// ErrIncompatibleFS returned when file system is not supported.
ErrIncompatibleFS = fmt.Errorf("backing file system is unsupported for this graph driver")
ErrIncompatibleFS = errors.New("backing file system is unsupported for this graph driver")
// ErrLayerUnknown returned when the specified layer is unknown by the driver.
ErrLayerUnknown = errors.New("unknown layer")
)

//CreateOpts contains optional arguments for Create() and CreateReadWrite()
Expand Down Expand Up @@ -117,6 +120,7 @@ type ProtoDriver interface {
// known to this driver.
Cleanup() error
// AdditionalImageStores returns additional image stores supported by the driver
// This API is experimental and can be changed without bumping the major version number.
AdditionalImageStores() []string
}

Expand Down Expand Up @@ -180,6 +184,30 @@ type CapabilityDriver interface {
Capabilities() Capabilities
}

// AdditionalLayer reprents a layer that is stored in the additional layer store
// This API is experimental and can be changed without bumping the major version number.
type AdditionalLayer interface {
// CreateAs creates a new layer from this additional layer
CreateAs(id, parent string) error

// Info returns arbitrary information stored along with this layer (i.e. `info` file)
Info() (io.ReadCloser, error)

// Release tells the additional layer store that we don't use this handler.
Release()
}

// AdditionalLayerStoreDriver is the interface for driver that supports
// additional layer store functionality.
// This API is experimental and can be changed without bumping the major version number.
type AdditionalLayerStoreDriver interface {
Driver

// LookupAdditionalLayer looks up additional layer store by the specified
// digest and ref and returns an object representing that layer.
LookupAdditionalLayer(d digest.Digest, ref string) (AdditionalLayer, error)
}

// DiffGetterDriver is the interface for layered file system drivers that
// provide a specialized function for getting file contents for tar-split.
type DiffGetterDriver interface {
Expand Down
Loading

0 comments on commit d02abea

Please sign in to comment.