Replace DebugString with Describe
This change makes tree description completely open to mechanical analysis and ensures consistency between description formats for each of the iterator types. Renamed StatsContainer.(Kind -> Type) for consistency.
This commit is contained in:
parent
b5f113203d
commit
62013d3dfc
22 changed files with 186 additions and 162 deletions
|
|
@ -17,7 +17,6 @@ package bolt
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/barakmich/glog"
|
||||
"github.com/boltdb/bolt"
|
||||
|
|
@ -179,9 +178,15 @@ func (it *AllIterator) Size() (int64, bool) {
|
|||
return it.qs.size, true
|
||||
}
|
||||
|
||||
func (it *AllIterator) DebugString(indent int) string {
|
||||
func (it *AllIterator) Describe() graph.Description {
|
||||
size, _ := it.Size()
|
||||
return fmt.Sprintf("%s(%s tags: %v bolt size:%d %s %p)", strings.Repeat(" ", indent), it.Type(), it.tags.Tags(), size, it.dir, it)
|
||||
return graph.Description{
|
||||
UID: it.UID(),
|
||||
Type: it.Type().String(),
|
||||
Tags: it.tags.Tags(),
|
||||
Size: size,
|
||||
Direction: it.dir,
|
||||
}
|
||||
}
|
||||
|
||||
func (it *AllIterator) Type() graph.Type { return graph.All }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue