func (db *HybridDB) Trim() { db.Sem.Lock() defer db.Sem.Unlock() m := new(mapdb.MapDB) m.Init(nil) db.temporaryStorage = m }
func (s *State) InitMapDB() error { if s.DB != nil { return nil } dbase := new(mapdb.MapDB) dbase.Init(nil) s.DB = databaseOverlay.NewOverlay(dbase) return nil }
func NewBoltMapHybridDB(bucketList [][]byte, filename string) *HybridDB { answer := new(HybridDB) m := new(mapdb.MapDB) m.Init(bucketList) answer.temporaryStorage = m b := new(boltdb.BoltDB) b.Init(bucketList, filename) answer.persistentStorage = b return answer }
func NewLevelMapHybridDB(filename string, create bool) (*HybridDB, error) { answer := new(HybridDB) m := new(mapdb.MapDB) m.Init(nil) answer.temporaryStorage = m b, err := leveldb.NewLevelDB(filename, create) if err != nil { return nil, err } answer.persistentStorage = b return answer, nil }
func InitMapDB(cfg *util.FactomdConfig) interfaces.DBOverlay { //fmt.Println("InitMapDB") dbase := new(mapdb.MapDB) dbase.Init(nil) return databaseOverlay.NewOverlay(dbase) }