LFUDA changes #47

Closed
nikooo777 wants to merge 12 commits from improvements into master
4 changed files with 15 additions and 16 deletions
Showing only changes of commit 869030fc58 - Show all commits

View file

@ -40,8 +40,6 @@ func NewLFUDAStore(component string, store BlobStore, maxSize float64) *LFUDASto
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
const nameLFUDA = "lfuda"
var fakeTrue = []byte{'t'}
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
// Name is the cache type name
func (l *LFUDAStore) Name() string { return nameLFUDA }
@ -66,7 +64,7 @@ func (l *LFUDAStore) Get(hash string) (stream.Blob, error) {
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
// Put stores the blob. Following LFUDA rules it's not guaranteed that a SET will store the value!!!
lyoshenka commented 2020-11-27 22:29:30 +01:00 (Migrated from github.com)
Review

👍 for the comment

:+1: for the comment
func (l *LFUDAStore) Put(hash string, blob stream.Blob) error {
l.lfuda.Set(hash, fakeTrue)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
l.lfuda.Set(hash, true)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
has, _ := l.Has(hash)
if has {
err := l.store.Put(hash, blob)
@ -77,14 +75,16 @@ func (l *LFUDAStore) Put(hash string, blob stream.Blob) error {
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
return nil
}
// PutSD stores the sd blob
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
// PutSD stores the sd blob. Following LFUDA rules it's not guaranteed that a SET will store the value!!!
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
func (l *LFUDAStore) PutSD(hash string, blob stream.Blob) error {
lyoshenka commented 2020-11-27 22:31:02 +01:00 (Migrated from github.com)
Review

why are Put and PutSD implemented differently?

why are Put and PutSD implemented differently?
err := l.store.PutSD(hash, blob)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
if err != nil {
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
return err
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
l.lfuda.Set(hash, true)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
has, _ := l.Has(hash)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
if has {
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
err := l.store.PutSD(hash, blob)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
if err != nil {
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
return err
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
}
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
}
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
l.lfuda.Set(hash, fakeTrue)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
return nil
}
@ -109,12 +109,13 @@ func (l *LFUDAStore) loadExisting(store lister, maxItems int) error {
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
if err != nil {
return err
}
logrus.Infof("read %d files from disk", len(existing))
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
added := 0
for _, h := range existing {
l.lfuda.Set(h, fakeTrue)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
l.lfuda.Set(h, true)
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
added++
if maxItems > 0 && added >= maxItems { // underlying cache is bigger than LRU cache
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
if maxItems > 0 && added >= maxItems { // underlying cache is bigger than the cache
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
break
}
}

lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool
lyoshenka commented 2020-11-27 22:26:46 +01:00 (Migrated from github.com)
Review

seems weird to do this. why not an actual bool, or an empty struct?

seems weird to do this. why not an actual `bool`, or an empty struct?
nikooo777 commented 2020-12-09 19:19:18 +01:00 (Migrated from github.com)
Review

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM.

I since worked with the developer of the library to address this so i believe we can go back to using a bool

the reason I did this was because the library wasn't treating a bool as a 1byte type and it would waste a lot of RAM. I since worked with the developer of the library to address this so i believe we can go back to using a bool

View file

@ -8,7 +8,6 @@ import (
lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement
lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement
"time"
"github.com/lbryio/lbry.go/v2/extras/errors"
log "github.com/sirupsen/logrus"
lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -68,8 +67,6 @@ func TestFUDAStore_Eviction(t *testing.T) {
lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement
lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement
assert.Equal(t, cacheMaxBlobs, len(mem.Debug()))
keys := lfuda.lfuda.Keys()
lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement
log.Infof("%+v", keys)
lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement
for k, v := range map[string]bool{
"one": false,
"two": true,

lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement
lyoshenka commented 2020-11-27 22:34:03 +01:00 (Migrated from github.com)
Review

use t.Log() insteade

use `t.Log()` insteade
nikooo777 commented 2020-12-09 19:20:19 +01:00 (Migrated from github.com)
Review

ah right, this can actually be removed. it was a debug statement

ah right, this can actually be removed. it was a debug statement

View file

@ -6,6 +6,7 @@ import (
"github.com/lbryio/reflector.go/internal/metrics"
golru "github.com/hashicorp/golang-lru"
"github.com/sirupsen/logrus"
)
// LRUStore adds a max cache size and LRU eviction to a BlobStore
@ -106,11 +107,12 @@ func (l *LRUStore) Delete(hash string) error {
// loadExisting imports existing blobs from the underlying store into the LRU cache
func (l *LRUStore) loadExisting(store lister, maxItems int) error {
logrus.Infof("loading at most %d items", maxItems)
existing, err := store.list()
if err != nil {
return err
}
logrus.Infof("read %d files from disk", len(existing))
added := 0
for _, h := range existing {
l.lru.Add(h, true)

View file

@ -83,6 +83,5 @@ func AllFiles(startDir string, basename bool) ([]string, error) {
close(pathChan)
pathWG.Wait()
logrus.Infoln("loaded LRU")
return paths, nil
}