Пример #1
0
func (db *HybridDB) Trim() {
	db.Sem.Lock()
	defer db.Sem.Unlock()

	m := new(mapdb.MapDB)
	m.Init(nil)
	db.temporaryStorage = m
}
Пример #2
0
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
}
Пример #3
0
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
}
Пример #4
0
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
}
Пример #5
0
func InitMapDB(cfg *util.FactomdConfig) interfaces.DBOverlay {
	//fmt.Println("InitMapDB")
	dbase := new(mapdb.MapDB)
	dbase.Init(nil)
	return databaseOverlay.NewOverlay(dbase)
}