comment cleanup

This commit is contained in:
Matthew Jaffee 2022-05-27 09:32:58 -05:00 committed by Matthew Jaffee
parent 90eb860b03
commit a815bba520
5 changed files with 21 additions and 17 deletions

View file

@ -49,9 +49,10 @@ type cache interface {
// lruCache represents a least recently used Cache implementation.
type lruCache struct {
cache *lru.Cache
counts map[uint64]uint64
stats stats.StatsClient
cache *lru.Cache
counts map[uint64]uint64
stats stats.StatsClient
// maxEntries is saved to support Clear which recreates the cache.
maxEntries uint32
}

View file

@ -1246,7 +1246,7 @@ func (se *stackElem) clear() {
se.key = 0
}
// TODO wtf does this do?
// suppress unused warnings - these can be useful for debugging
var _ = (&stackElem{}).clear
var _ = (&stackElem{}).String
var _ = (&stackElem{}).equal

View file

@ -678,7 +678,7 @@ func (tx *Tx) Depth(name string) (int, error) {
}
defer c.Close()
if err := c.First(); err != nil { // TODO, EOF check?
if err := c.First(); err != nil {
return 0, err
}
return c.stack.top + 1, nil

View file

@ -29,13 +29,14 @@ const (
type FilterKey uint64
// FilterResult represents the results of a BitmapFilter considering a
// key, or data. The values are represented as exclusive upper bounds on
// a series of matches followed by a series of rejections. So for instance,
// if called on key 23, the result {YesKey: 23, NoKey: 24} indicates that
// key 23 is a "no". (TODO what about key 24, presumably that's a no as well?)
// This may seem confusing but it makes the math a lot
// easier to write. It can also report an error, which indicates that the
// entire operation should be stopped with that error.
// key, or data. The values are represented as exclusive upper bounds
// on a series of matches followed by a series of rejections. So for
// instance, if called on key 23, the result {YesKey: 23, NoKey: 24}
// indicates that key 23 is a "no" and 24 is unknown and will be the
// next to be Consider()ed. This may seem confusing but it makes the
// math a lot easier to write. It can also report an error, which
// indicates that the entire operation should be stopped with that
// error.
type FilterResult struct {
YesKey FilterKey // The lowest container key this filter is known NOT to match.
NoKey FilterKey // The highest container key after YesKey that this filter is known to not match.

View file

@ -7628,11 +7628,13 @@ func (c *Container) CountRange(start, end int32) (n int32) {
return c.countRange(start, end)
}
// UnionInPlace yields a container containing all the bits set in either
// c or other. It may, or may not, modify c. The resulting container's
// count, as returned by c.N(), may be incorrect; see (*Container).Repair().
// Do not freeze a container produced by this operation before repairing it.
// TODO(jaffee): why don't we just call Repair in here?!?!
// UnionInPlace yields a container containing all the bits set in
// either c or other. It may, or may not, modify c. The resulting
// container's count, as returned by c.N(), may be incorrect; see
// (*Container).Repair(). Do not freeze a container produced by this
// operation before repairing it. We don't want this to call repair
// immediately because it can be faster for Bitmap.UnionInPlace to do
// it all at once after potentially many Container.UnionInPlace calls.
func (c *Container) UnionInPlace(other *Container) (r *Container) {
return c.unionInPlace(other)
}