From 25e649add8c7d4e10608e0e55f4da00bcbd02617 Mon Sep 17 00:00:00 2001 From: Travis Date: Wed, 19 Apr 2017 11:41:41 -0500 Subject: [PATCH] remove `cacheSize` argument from `NewFragment()` --- fragment.go | 4 ++-- fragment_test.go | 6 +++--- view.go | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fragment.go b/fragment.go index 5704e774d..9bee4288e 100644 --- a/fragment.go +++ b/fragment.go @@ -94,7 +94,7 @@ type Fragment struct { } // NewFragment returns a new instance of Fragment. -func NewFragment(path, db, frame, view string, slice uint64, cacheSize uint32) *Fragment { +func NewFragment(path, db, frame, view string, slice uint64) *Fragment { return &Fragment{ path: path, db: db, @@ -102,7 +102,7 @@ func NewFragment(path, db, frame, view string, slice uint64, cacheSize uint32) * view: view, slice: slice, cacheType: DefaultCacheType, - cacheSize: cacheSize, + cacheSize: DefaultCacheSize, LogOutput: ioutil.Discard, MaxOpN: DefaultFragmentMaxOpN, diff --git a/fragment_test.go b/fragment_test.go index e03d5111c..f54f5415b 100644 --- a/fragment_test.go +++ b/fragment_test.go @@ -593,7 +593,7 @@ func BenchmarkFragment_Blocks(b *testing.B) { } // Open the fragment specified by the path. - f := pilosa.NewFragment(*FragmentPath, "d", "f", pilosa.ViewStandard, 0, pilosa.DefaultCacheSize) + f := pilosa.NewFragment(*FragmentPath, "d", "f", pilosa.ViewStandard, 0) if err := f.Open(); err != nil { b.Fatal(err) } @@ -654,7 +654,7 @@ func NewFragment(db, frame, view string, slice uint64) *Fragment { file.Close() f := &Fragment{ - Fragment: pilosa.NewFragment(file.Name(), db, frame, view, slice, pilosa.DefaultCacheSize), + Fragment: pilosa.NewFragment(file.Name(), db, frame, view, slice), BitmapAttrStore: MustOpenAttrStore(), } f.Fragment.BitmapAttrStore = f.BitmapAttrStore.AttrStore @@ -685,7 +685,7 @@ func (f *Fragment) Reopen() error { return err } - f.Fragment = pilosa.NewFragment(path, f.DB(), f.Frame(), f.View(), f.Slice(), pilosa.DefaultCacheSize) + f.Fragment = pilosa.NewFragment(path, f.DB(), f.Frame(), f.View(), f.Slice()) f.Fragment.BitmapAttrStore = f.BitmapAttrStore.AttrStore if err := f.Open(); err != nil { return err diff --git a/view.go b/view.go index 9ded867ce..c7ec92733 100644 --- a/view.go +++ b/view.go @@ -216,8 +216,9 @@ func (v *View) createFragmentIfNotExists(slice uint64) (*Fragment, error) { } func (v *View) newFragment(path string, slice uint64) *Fragment { - frag := NewFragment(path, v.db, v.frame, v.name, slice, v.cacheSize) + frag := NewFragment(path, v.db, v.frame, v.name, slice) frag.cacheType = v.cacheType + frag.cacheSize = v.cacheSize frag.LogOutput = v.LogOutput frag.stats = v.stats.WithTags(fmt.Sprintf("slice:%d", slice)) return frag