From a815bba520bf2190d8bcad2a8dda85eee4e2d146 Mon Sep 17 00:00:00 2001 From: Matthew Jaffee Date: Fri, 27 May 2022 09:32:58 -0500 Subject: [PATCH] comment cleanup --- cache.go | 7 ++++--- rbf/cursor.go | 2 +- rbf/tx.go | 2 +- roaring/filter.go | 15 ++++++++------- roaring/roaring.go | 12 +++++++----- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/cache.go b/cache.go index d40fe4b6a..c88b841eb 100644 --- a/cache.go +++ b/cache.go @@ -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 } diff --git a/rbf/cursor.go b/rbf/cursor.go index b145560eb..0d04cf32e 100644 --- a/rbf/cursor.go +++ b/rbf/cursor.go @@ -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 diff --git a/rbf/tx.go b/rbf/tx.go index ec96c707a..1ba0f1741 100644 --- a/rbf/tx.go +++ b/rbf/tx.go @@ -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 diff --git a/roaring/filter.go b/roaring/filter.go index 3e26a148b..d7b91c892 100644 --- a/roaring/filter.go +++ b/roaring/filter.go @@ -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. diff --git a/roaring/roaring.go b/roaring/roaring.go index ca3f227be..0e7a77d8e 100644 --- a/roaring/roaring.go +++ b/roaring/roaring.go @@ -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) }