From 2e1b50769ffc5d0cb40fa41a72dde90fdbbc8a1b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 20 Apr 2013 18:05:27 -0600 Subject: [PATCH] Just some types and their documentation --- packer/build.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packer/build.go b/packer/build.go index c707be974..2e3ddf2e5 100644 --- a/packer/build.go +++ b/packer/build.go @@ -9,6 +9,25 @@ type Build struct { builder Builder } +// Implementers of Builder are responsible for actually building images +// on some platform given some configuration. +// +// Prepare is responsible for reading in some configuration, in the raw form +// of map[string]interface{}, and storing that state for use later. Any setup +// should be done in this method. Note that NO side effects should really take +// place in prepare. It is meant as a state setup step only. +// +// Run is where the actual build should take place. It takes a Build and a Ui. type Builder interface { - Prepare() + Prepare(config interface{}) + Run(build Build, ui Ui) +} + +// This factory is responsible for returning Builders for the given name. +// +// CreateBuilder is called with the string name of a builder and should +// return a Builder implementation by that name or nil if no builder can be +// found. +type BuilderFactory interface { + CreateBuilder(name string) Builder }