Skip to content

Commit 568d40a

Browse files
committed
cleanup
1 parent a793801 commit 568d40a

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

cmd/dupi/dupi.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
"github.com/google/gops/agent"
2727
)
2828

29+
// TBD: write and use newIndex(), newExtract()
30+
// instead of init() ugliness
2931
var scMap = map[string]SubCmd{
3032
"index": index,
3133
"extract": extract,
@@ -70,7 +72,7 @@ func usage(w io.Writer) {
7072
fmt.Fprintf(w, "usage: dupi [global opts] <cmd> <args>\n")
7173
fmt.Fprintf(w, "commands are:\n")
7274
for k, v := range scMap {
73-
fmt.Fprintf(w, "\t%s %-16s\n", k, v.Usage())
75+
fmt.Fprintf(w, "\t%s %30s\n", k, v.Usage())
7476
}
7577
fmt.Fprintf(w, "\nglobal options:\n")
7678
gFlags.VisitAll(func(f *flag.Flag) {

cmd/dupi/unblot.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func (ub *unblotCmd) Run(args []string) error {
5757
m[string(dat)] = append(m[string(dat)], doc)
5858
}
5959
for k, ds := range m {
60+
fmt.Printf("text:\n'''\n%s'''\n", k)
6061
for _, d := range ds {
6162
fmt.Printf("\t%s %d:%d\n", d.Path, d.Start, d.End)
6263
}

internal/shard/index.go

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,24 @@ func (x *Index) Close() error {
5151

5252
func (x *Index) ReadStateFor(blot uint16) *ReadState {
5353
/*
54-
refCount := x.counts[blot]
55-
i := sort.Search(1<<16, func(i int) bool {
56-
return x.counts[x.perm[i]] > refCount
57-
})
58-
if i == len(x.perm) {
59-
panic("internal error in perm/count")
60-
}
61-
if x.perm[i] != blot {
62-
fmt.Printf("blot %x i %d perm[%d] %x count %d ref %d %#v\n", blot, i, i, x.perm[i], x.counts[x.perm[i]], refCount, x.perm[i-1:i+2])
63-
panic("internal error2 in perm/count")
64-
}
54+
broken still
55+
refCount := x.counts[blot]
56+
i := sort.Search(1<<16, func(i int) bool {
57+
return x.counts[x.perm[i]] > refCount
58+
})
59+
if i == len(x.perm) {
60+
panic("internal error in perm/count")
61+
}
62+
if x.perm[i] != blot {
63+
fmt.Printf("blot %x i %d perm[%d] %x count %d ref %d %#v\n", blot, i, i, x.perm[i], x.counts[x.perm[i]], refCount, x.perm[i-1:i+2])
64+
panic("internal error2 in perm/count")
65+
}
6566
*/
6667
return x.ReadStateForBlotAt(blot, 0) //uint16(i))
6768
}
6869

6970
func (x *Index) ReadStateForBlotAt(blot, at uint16) *ReadState {
7071
res := &ReadState{}
71-
fmt.Printf("head of shard blot %x is %d\n", blot, x.heads[blot])
7272
res.Posts = newPosts(x.heads[blot])
7373
res.Shard = x.id
7474
res.Blot = blot
@@ -111,9 +111,6 @@ func (x *Index) readIix() error {
111111
if err != nil {
112112
return err
113113
}
114-
if i == 0xf974 {
115-
fmt.Printf("0xf974: head %d count %d\n", hd, ct)
116-
}
117114
x.counts[i] = uint32(ct)
118115
x.perm[i] = uint16(i)
119116
}

0 commit comments

Comments
 (0)