Merge pull request #143 from AkihiroSuda/refactor-ref

cache, solver: refactor Reference interface
docker-18.09
Tõnis Tiigi 2017-11-06 14:39:15 -08:00 committed by GitHub
commit dfb786a292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

15
cache/refs.go vendored
View File

@ -12,24 +12,25 @@ import (
"golang.org/x/net/context"
)
type ImmutableRef interface {
// Ref is a reference to cacheable objects.
type Ref interface {
Mountable
ID() string
Release(context.Context) error
Size(ctx context.Context) (int64, error)
Metadata() *metadata.StorageItem
}
type ImmutableRef interface {
Ref
Parent() ImmutableRef
Finalize(ctx context.Context) error // Make sure reference is flushed to driver
Metadata() *metadata.StorageItem
// Prepare() / ChainID() / Meta()
}
type MutableRef interface {
Mountable
ID() string
Ref
Commit(context.Context) (ImmutableRef, error)
Release(context.Context) error
Size(ctx context.Context) (int64, error)
Metadata() *metadata.StorageItem
}
type Mountable interface {

View File

@ -57,6 +57,8 @@ func NewLLBSolver(opt LLBOpt) *Solver {
type ResolveOpFunc func(Vertex) (Op, error)
// Reference is a reference to the object passed through the build steps.
// This interface is a subset of the cache.Ref interface.
// For ease of unit testing, this interface only has Release().
type Reference interface {
Release(context.Context) error
}