Remove vestigial 'verbose' argument to NewGraphBuilder (#3482)

This commit is contained in:
Dan Willhite
2017-05-17 15:57:49 -07:00
committed by GitHub
parent 0aac4be0bd
commit f196e50e03
4 changed files with 8 additions and 19 deletions

View File

@@ -44,8 +44,6 @@ import (
"sync"
"github.com/attic-labs/noms/go/d"
"github.com/attic-labs/noms/go/util/status"
"github.com/dustin/go-humanize"
)
type GraphBuilder struct {
@@ -53,17 +51,16 @@ type GraphBuilder struct {
oc opCache
vrw ValueReadWriter
stack graphStack
verbose bool
mutex sync.Mutex
}
// NewGraphBuilder() returns an new GraphBuilder object.
func NewGraphBuilder(vrw ValueReadWriter, rootKind NomsKind, verbose bool) *GraphBuilder {
return newGraphBuilder(vrw, newLdbOpCacheStore(vrw), rootKind, verbose)
func NewGraphBuilder(vrw ValueReadWriter, rootKind NomsKind) *GraphBuilder {
return newGraphBuilder(vrw, newLdbOpCacheStore(vrw), rootKind)
}
func newGraphBuilder(vrw ValueReadWriter, opcStore opCacheStore, rootKind NomsKind, verbose bool) *GraphBuilder {
b := &GraphBuilder{oc: opcStore.opCache(), opcStore: opcStore, vrw: vrw, verbose: verbose}
func newGraphBuilder(vrw ValueReadWriter, opcStore opCacheStore, rootKind NomsKind) *GraphBuilder {
b := &GraphBuilder{oc: opcStore.opCache(), opcStore: opcStore, vrw: vrw}
b.pushNewKeyOnStack(String("ROOT"), rootKind)
return b
}
@@ -133,7 +130,6 @@ func (b *GraphBuilder) Build() Value {
iter := opc.NewIterator()
defer iter.Release()
keyCnt := int64(0)
// start up a go routine that will do the reading from graphBuilder's private
// ldb opCache.
@@ -183,10 +179,6 @@ func (b *GraphBuilder) Build() Value {
b.pushNewKeyOnStack(keys[b.stack.lastIdx()], kind)
b.appendItemToCurrentTopOfStack(kind, item)
}
if b.verbose {
keyCnt++
status.Printf("Added %s keys to graph", humanize.Comma(keyCnt))
}
}
}
@@ -196,9 +188,6 @@ func (b *GraphBuilder) Build() Value {
b.popKeyFromStack()
}
res := b.stack.pop().done()
if b.verbose {
status.Done()
}
return res
}

View File

@@ -248,7 +248,7 @@ func TestGraphBuilderNestedMapSet(t *testing.T) {
defer vs.Close()
expected := createTestMap(3, 4, valGen)
b := NewGraphBuilder(vs, MapKind, false)
b := NewGraphBuilder(vs, MapKind)
ops := []testGraphOp{}
@@ -306,7 +306,7 @@ func ExampleGraphBuilder_Build() {
vs := newTestValueStore()
defer vs.Close()
gb := NewGraphBuilder(vs, MapKind, false)
gb := NewGraphBuilder(vs, MapKind)
gb.SetInsert([]Value{String("parent"), String("children")}, String("John"))
gb.SetInsert([]Value{String("parent"), String("children")}, String("Mary"))
gb.SetInsert([]Value{String("parent"), String("children")}, String("Frieda"))

View File

@@ -190,7 +190,7 @@ func ReadToMap(r *csv.Reader, structName string, headersRaw []string, primaryKey
temp, fieldOrder, kindMap := MakeStructTemplateFromHeaders(headersRaw, structName, kinds)
pkIndices := getPkIndices(primaryKeys, headersRaw)
d.Chk.True(len(pkIndices) >= 1, "No primary key defined when reading into map")
gb := types.NewGraphBuilder(vrw, types.MapKind, false)
gb := types.NewGraphBuilder(vrw, types.MapKind)
for {
row, err := r.Read()

View File

@@ -141,7 +141,7 @@ func runUpdate(args []string) int {
return 1
}
gb := types.NewGraphBuilder(db, types.MapKind, true)
gb := types.NewGraphBuilder(db, types.MapKind)
addElementsToGraphBuilder(gb, db, rootObject, relPath)
indexMap := gb.Build().(types.Map)