set the cache size on frame creation

This commit is contained in:
Michael Baird 2017-03-07 15:34:01 -06:00 committed by Travis
parent 3b71ed1b2f
commit 591c35c95f
2 changed files with 4 additions and 22 deletions

4
db.go
View file

@ -391,6 +391,10 @@ func (db *DB) createFrame(name string, opt FrameOptions) (*Frame, error) {
if opt.RowLabel != "" {
f.rowLabel = opt.RowLabel
}
if opt.CacheSize != 0 {
f.rankedCacheSize = opt.CacheSize
}
f.inverseEnabled = opt.InverseEnabled
if err := f.saveMeta(); err != nil {
f.Close()

View file

@ -222,25 +222,6 @@ func (f *Fragment) openStorage() error {
}
// // It will be the one and only identifier after a package specifier.
// var testNameRegexp = regexp.MustCompile(`\.(Test[\p{L}_\p{N}]*)$`)
// // Returns the name of the test function from the call stack. See
// // http://stackoverflow.com/q/35535635/149482 for another method.
// func GetTestName() string {
// pc := make([]uintptr, 32)
// n := runtime.Callers(0, pc)
// for i := 0; i < n; i++ {
// name := runtime.FuncForPC(pc[i]).Name()
// ms := testNameRegexp.FindStringSubmatch(name)
// if ms == nil {
// continue
// }
// return ms[1]
// }
// panic("test name could not be recovered")
// }
// openCache initializes the cache from bitmap ids persisted to disk.
func (f *Fragment) openCache() error {
// Determine cache type from frame name.
@ -256,9 +237,6 @@ func (f *Fragment) openCache() error {
return ErrInvalidCacheType
}
// fmt.Println(GetTestName())
// fmt.Printf("CACHE SIZE: %d\n", f.cacheSize)
// Read cache data from disk.
path := f.CachePath()
buf, err := ioutil.ReadFile(path)