build: document more Builder methods
Change-Id: I3d8b0c7b671fad618710fb32db87c5263b26eb56
diff --git a/build/builder.go b/build/builder.go
index 754987c..048b3b3 100644
--- a/build/builder.go
+++ b/build/builder.go
@@ -75,7 +75,9 @@
MemProfile string
}
-// Builder manages (parallel) creation of uniformly sized shards.
+// Builder manages (parallel) creation of uniformly sized shards. The
+// builder buffers up documents until it collects enough documents and
+// then builds a shard and writes.
type Builder struct {
opts Options
throttle chan int
@@ -211,6 +213,7 @@
return b, nil
}
+// AddFile is a convenience wrapper for the Add method
func (b *Builder) AddFile(name string, content []byte) error {
return b.Add(zoekt.Document{Name: name, Content: content})
}
@@ -236,6 +239,8 @@
return nil
}
+// Finish creates a last shard from the buffered documents, and clears
+// stale shards from previous runs
func (b *Builder) Finish() error {
b.flush()
b.building.Wait()
@@ -487,4 +492,5 @@
return &finishedShard{f.Name(), fn}, nil
}
+// umask holds the Umask of the current process
var umask os.FileMode