mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Re-add return variable names removed in 2aa4d6b1.
This commit is contained in:
parent
3ca51989c2
commit
0a9e6bca7a
8 changed files with 18 additions and 41 deletions
|
|
@ -120,20 +120,17 @@ func (s *attrStore) Close() error {
|
|||
}
|
||||
|
||||
// Attrs returns a set of attributes by ID.
|
||||
func (s *attrStore) Attrs(id uint64) (map[string]interface{}, error) {
|
||||
func (s *attrStore) Attrs(id uint64) (m map[string]interface{}, err error) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
var m map[string]interface{}
|
||||
|
||||
// Check cache for map.
|
||||
if m = s.attrCache.Get(id); m != nil {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Find attributes from storage.
|
||||
if err := s.db.View(func(tx *bolt.Tx) error {
|
||||
var err error
|
||||
if err = s.db.View(func(tx *bolt.Tx) error {
|
||||
m, err = txAttrs(tx, id)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -184,8 +184,7 @@ func (q *x) insert(i int, k uint64, ch interface{}) *x {
|
|||
return q
|
||||
}
|
||||
|
||||
func (q *x) siblings(i int) (*d, *d) {
|
||||
var l, r *d
|
||||
func (q *x) siblings(i int) (l, r *d) {
|
||||
if i >= 0 {
|
||||
if i > 0 {
|
||||
l = q.x[i-1].ch.(*d)
|
||||
|
|
@ -411,9 +410,7 @@ func (t *tree) find(q interface{}, k uint64) (i int, ok bool) {
|
|||
|
||||
// First returns the first item of the tree in the key collating order, or
|
||||
// (zero-value, zero-value) if the tree is empty.
|
||||
func (t *tree) First() (uint64, *roaring.Container) {
|
||||
var k uint64
|
||||
var v *roaring.Container
|
||||
func (t *tree) First() (k uint64, v *roaring.Container) {
|
||||
if q := t.first; q != nil {
|
||||
q := &q.d[0]
|
||||
k, v = q.k, q.v
|
||||
|
|
@ -464,9 +461,7 @@ func (t *tree) insert(q *d, i int, k uint64, v *roaring.Container) *d {
|
|||
|
||||
// Last returns the last item of the tree in the key collating order, or
|
||||
// (zero-value, zero-value) if the tree is empty.
|
||||
func (t *tree) Last() (uint64, *roaring.Container) {
|
||||
var k uint64
|
||||
var v *roaring.Container
|
||||
func (t *tree) Last() (k uint64, v *roaring.Container) {
|
||||
if q := t.last; q != nil {
|
||||
q := &q.d[q.c-1]
|
||||
k, v = q.k, q.v
|
||||
|
|
@ -854,10 +849,7 @@ func (e *enumerator) Close() {
|
|||
// Next returns the currently enumerated item, if it exists and moves to the
|
||||
// next item in the key collation order. If there is no item to return, err ==
|
||||
// io.EOF is returned.
|
||||
func (e *enumerator) Next() (uint64, *roaring.Container, error) {
|
||||
var k uint64
|
||||
var v *roaring.Container
|
||||
var err error
|
||||
func (e *enumerator) Next() (k uint64, v *roaring.Container, err error) {
|
||||
if err = e.err; err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
|
|
@ -905,11 +897,7 @@ func (e *enumerator) next() error {
|
|||
// Prev returns the currently enumerated item, if it exists and moves to the
|
||||
// previous item in the key collation order. If there is no item to return, err
|
||||
// == io.EOF is returned.
|
||||
func (e *enumerator) Prev() (uint64, *roaring.Container, error) {
|
||||
var k uint64
|
||||
var v *roaring.Container
|
||||
var err error
|
||||
|
||||
func (e *enumerator) Prev() (k uint64, v *roaring.Container, err error) {
|
||||
if err = e.err; err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,8 +121,7 @@ func (btc *bTreeContainers) GetOrCreate(key uint64) *roaring.Container {
|
|||
return btc.lastContainer
|
||||
}
|
||||
|
||||
func (btc *bTreeContainers) Count() uint64 {
|
||||
var n uint64
|
||||
func (btc *bTreeContainers) Count() (n uint64) {
|
||||
e, _ := btc.tree.Seek(0)
|
||||
_, c, err := e.Next()
|
||||
for err != io.EOF {
|
||||
|
|
|
|||
8
field.go
8
field.go
|
|
@ -796,8 +796,8 @@ func groupCompare(a, b string, offset int) (lt, eq bool) {
|
|||
return v < 0, v == 0
|
||||
}
|
||||
|
||||
func (f *Field) allTimeViewsSortedByQuantum() []*view {
|
||||
me := make([]*view, len(f.viewMap), len(f.viewMap))
|
||||
func (f *Field) allTimeViewsSortedByQuantum() (me []*view) {
|
||||
me = make([]*view, len(f.viewMap), len(f.viewMap))
|
||||
prefix := viewStandard + "_"
|
||||
offset := len(viewStandard) + 1
|
||||
i := 0
|
||||
|
|
@ -811,8 +811,8 @@ func (f *Field) allTimeViewsSortedByQuantum() []*view {
|
|||
year := strings.Index(me[0].name, "_") + 4
|
||||
month := year + 2
|
||||
day := month + 2
|
||||
sort.Slice(me, func(i, j int) bool {
|
||||
var eq, lt bool
|
||||
sort.Slice(me, func(i, j int) (lt bool) {
|
||||
var eq bool
|
||||
// group by quantum from year to hour
|
||||
if lt, eq = groupCompare(me[i].name, me[j].name, year); eq {
|
||||
if lt, eq = groupCompare(me[i].name, me[j].name, month); eq {
|
||||
|
|
|
|||
|
|
@ -1162,11 +1162,9 @@ func (f *fragment) readContiguousChecksums(a *[]FragmentBlock, blockID int) (n i
|
|||
}
|
||||
|
||||
// blockData returns bits in a block as row & column ID pairs.
|
||||
func (f *fragment) blockData(id int) ([]uint64, []uint64) {
|
||||
func (f *fragment) blockData(id int) (rowIDs, columnIDs []uint64) {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
rowIDs := make([]uint64, 0)
|
||||
columnIDs := make([]uint64, 0)
|
||||
f.storage.ForEachRange(uint64(id)*HashBlockSize*ShardWidth, (uint64(id)+1)*HashBlockSize*ShardWidth, func(i uint64) {
|
||||
rowIDs = append(rowIDs, i/ShardWidth)
|
||||
columnIDs = append(columnIDs, i%ShardWidth)
|
||||
|
|
|
|||
|
|
@ -299,9 +299,7 @@ type successResponse struct {
|
|||
|
||||
// check determines success or failure based on the error.
|
||||
// It also returns the corresponding http status code.
|
||||
func (r *successResponse) check(err error) int {
|
||||
var statusCode int
|
||||
|
||||
func (r *successResponse) check(err error) (statusCode int) {
|
||||
if err == nil {
|
||||
r.Success = true
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ func (c *Cache) Add(key Key, value interface{}) {
|
|||
}
|
||||
|
||||
// Get looks up a key's value from the cache.
|
||||
func (c *Cache) Get(key Key) (interface{}, bool) {
|
||||
func (c *Cache) Get(key Key) (value interface{}, ok bool) {
|
||||
if c.cache == nil {
|
||||
return nil, false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1895,8 +1895,7 @@ func intersectionCountArrayRun(a, b *Container) (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func intersectionCountRunRun(a, b *Container) int {
|
||||
var n int
|
||||
func intersectionCountRunRun(a, b *Container) (n int) {
|
||||
na, nb := len(a.runs), len(b.runs)
|
||||
for i, j := 0, 0; i < na && j < nb; {
|
||||
va, vb := a.runs[i], b.runs[j]
|
||||
|
|
@ -3145,10 +3144,8 @@ func xorArrayRun(a, b *Container) *Container {
|
|||
}
|
||||
|
||||
// xorCompare computes first exclusive run between two runs.
|
||||
func xorCompare(x *xorstm) (interval16, bool) {
|
||||
var r1 interval16
|
||||
var hasData bool
|
||||
|
||||
func xorCompare(x *xorstm) (r1 interval16, hasData bool) {
|
||||
hasData = false
|
||||
if !x.vaValid || !x.vbValid {
|
||||
if x.vbValid {
|
||||
x.vbValid = false
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue