solver: add release

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2017-06-06 16:47:47 -07:00
parent 25bc7e02fc
commit 8719505435
1 changed files with 15 additions and 2 deletions

View File

@ -91,11 +91,24 @@ func NewSolver(opt SolverOpt) *Solver {
func (s *Solver) Solve(ctx context.Context, g *opVertex) error { func (s *Solver) Solve(ctx context.Context, g *opVertex) error {
err := g.solve(ctx, s.opt) // TODO: separate exporting err := g.solve(ctx, s.opt) // TODO: separate exporting
g.release()
return err return err
} }
func (g *opVertex) release(ctx context.Context) error { func (g *opVertex) release() (retErr error) {
return errors.Errorf("release not implemented") for _, i := range g.inputs {
if err := i.release(); err != nil {
retErr = err
}
}
for _, ref := range g.refs {
if ref != nil {
if err := ref.Release(); err != nil {
retErr = err
}
}
}
return retErr
} }
func (g *opVertex) solve(ctx context.Context, opt SolverOpt) (retErr error) { func (g *opVertex) solve(ctx context.Context, opt SolverOpt) (retErr error) {