support LevelDB key/value database.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2016-09-19 16:19:20 +08:00
parent 2fba9b3d74
commit bf56f592e8
9 changed files with 238 additions and 16 deletions

View File

@@ -2,6 +2,8 @@ package gorush
import (
"github.com/appleboy/gorush/storage/boltdb"
"github.com/appleboy/gorush/storage/buntdb"
"github.com/appleboy/gorush/storage/leveldb"
"github.com/appleboy/gorush/storage/memory"
"github.com/appleboy/gorush/storage/redis"
"github.com/gin-gonic/gin"
@@ -40,20 +42,24 @@ func InitAppStatus() error {
StatStorage = memory.New()
case "redis":
StatStorage = redis.New(PushConf)
err := StatStorage.Init()
if err != nil {
LogError.Error("redis error: " + err.Error())
return err
}
case "boltdb":
StatStorage = boltdb.New(PushConf)
case "buntdb":
StatStorage = buntdb.New(PushConf)
case "leveldb":
StatStorage = leveldb.New(PushConf)
default:
StatStorage = memory.New()
}
err := StatStorage.Init()
if err != nil {
LogError.Error("storage error: " + err.Error())
return err
}
return nil
}