mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 19:37:51 +00:00
storage check
This commit is contained in:
parent
73d45b7c6a
commit
e2d7b878f1
3 changed files with 21 additions and 4 deletions
|
|
@ -147,16 +147,30 @@ type Fragment struct {
|
|||
mesg_time time.Duration
|
||||
}
|
||||
|
||||
func getStorage(db string, slice int, frame string) Storage {
|
||||
choice := 2
|
||||
switch choice {
|
||||
case 1:
|
||||
return NewMemoryStorage()
|
||||
case 2:
|
||||
s, _ := NewKVStorage("/tmp/pilosa/", slice, db)
|
||||
return s
|
||||
case 3:
|
||||
return NewCassStorage()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewFragment(frag_id SUUID, db string, slice int, frame string) *Fragment {
|
||||
var impl Pilosa
|
||||
log.Println("XXXXXXXXXXXXXXXXXXXXXXXXXXXX", frame)
|
||||
switch frame {
|
||||
default:
|
||||
log.Println("General")
|
||||
impl = NewGeneral(db, slice, NewMemoryStorage())
|
||||
impl = NewGeneral(db, slice, getStorage(db, slice, frame))
|
||||
case "Brand":
|
||||
log.Println("Brand")
|
||||
impl = NewBrand(db, slice, NewMemoryStorage(), 50000, 45000, 100)
|
||||
impl = NewBrand(db, slice, getStorage(db, slice, frame), 50000, 45000, 100)
|
||||
}
|
||||
|
||||
f := new(Fragment)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func TestFragment(t *testing.T) {
|
|||
bi1 := uint64(1234)
|
||||
bi2 := uint64(4321)
|
||||
|
||||
dummy.SetBit(general, bi2, 2) //set_bit creates the bitmap
|
||||
dummy.SetBit(general, bi2, 65537) //set_bit creates the bitmap
|
||||
|
||||
bh1, _ := dummy.Get(general, bi1)
|
||||
bh2, _ := dummy.Get(general, bi2)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,10 @@ func NewKVStorage(path string, slice int, db string) (Storage, error) {
|
|||
// log.Println("Hello")
|
||||
obj := new(KVStorage)
|
||||
|
||||
f, err := os.Create(fmt.Sprintf("%sKV.%s.%d", path, db, slice))
|
||||
base_path := fmt.Sprintf("%s/%s", path, db)
|
||||
os.MkdirAll(base_path, 0755)
|
||||
|
||||
f, err := os.Create(fmt.Sprintf("%s/%d.kvlite", base_path, slice))
|
||||
s, err := gkvlite.NewStore(f)
|
||||
obj.cc = s.SetCollection(db, nil)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue