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:
kortschak 2014-09-05 09:05:02 +09:30
parent b5f113203d
commit 62013d3dfc
22 changed files with 186 additions and 162 deletions

View file

@ -17,8 +17,6 @@ package leveldb
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"github.com/barakmich/glog"
ldbit "github.com/syndtr/goleveldb/leveldb/iterator"
@ -250,17 +248,16 @@ func (it *Iterator) Size() (int64, bool) {
return it.qs.SizeOf(Token(it.checkID)), true
}
func (it *Iterator) DebugString(indent int) string {
func (it *Iterator) Describe() graph.Description {
size, _ := it.Size()
return fmt.Sprintf("%s(%s %d tags: %v dir: %s size:%d %s)",
strings.Repeat(" ", indent),
it.Type(),
it.UID(),
it.tags.Tags(),
it.dir,
size,
it.qs.NameOf(Token(it.checkID)),
)
return graph.Description{
UID: it.UID(),
Name: it.qs.NameOf(Token(it.checkID)),
Type: it.Type().String(),
Tags: it.tags.Tags(),
Size: size,
Direction: it.dir,
}
}
var levelDBType graph.Type