示例#1
0
// NewCouchDBTxMgr constructs a `CouchDBTxMgr`
func NewCouchDBTxMgr(conf *Conf, couchDBConnectURL string, dbName string, id string, pw string) *CouchDBTxMgr {

	// TODO cleanup this RocksDB handle
	db := db.CreateDB(&db.Conf{DBPath: conf.DBPath})
	db.Open()

	couchDB, err := couchdb.CreateCouchDBConnectionAndDB(couchDBConnectURL, dbName, id, pw)
	if err != nil {
		logger.Errorf("Error during NewCouchDBTxMgr(): %s\n", err.Error())
		return nil
	}

	// db and stateIndexCF will not be used for CouchDB. TODO to cleanup
	return &CouchDBTxMgr{db: db, couchDB: couchDB}
}
示例#2
0
func initDB(conf *Conf) *db.DB {
	dbInst := db.CreateDB(&db.Conf{
		DBPath: conf.dbPath})
	dbInst.Open()
	return dbInst
}