mirror of https://github.com/dtm-labs/dtm.git
csharpjavadistributed-transactionsdtmgogolangmicroservicenodejsphpdatabasesagaseatatcctransactiontransactionsxapythondistributed
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
716 B
31 lines
716 B
package registry
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/dtm-labs/dtm/common"
|
|
"github.com/dtm-labs/dtm/dtmsvr/storage"
|
|
"github.com/dtm-labs/dtm/dtmsvr/storage/boltdb"
|
|
"github.com/dtm-labs/dtm/dtmsvr/storage/redis"
|
|
"github.com/dtm-labs/dtm/dtmsvr/storage/sql"
|
|
)
|
|
|
|
var config = &common.Config
|
|
|
|
var stores map[string]storage.Store = map[string]storage.Store{
|
|
"redis": &redis.RedisStore{},
|
|
"mysql": &sql.SqlStore{},
|
|
"postgres": &sql.SqlStore{},
|
|
"boltdb": &boltdb.BoltdbStore{},
|
|
}
|
|
|
|
func GetStore() storage.Store {
|
|
return stores[config.Store.Driver]
|
|
}
|
|
|
|
// WaitStoreUp wait for db to go up
|
|
func WaitStoreUp() {
|
|
for err := GetStore().Ping(); err != nil; err = GetStore().Ping() {
|
|
time.Sleep(3 * time.Second)
|
|
}
|
|
}
|
|
|