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

@@ -65,10 +65,11 @@ type SectionLog struct {
// SectionStat is sub seciont of config.
type SectionStat struct {
Engine string `yaml:"engine"`
Redis SectionRedis `yaml:"redis"`
BoltDB SectionBoltDB `yaml:"boltdb"`
BuntDB SectionBuntDB `yaml:"buntdb"`
Engine string `yaml:"engine"`
Redis SectionRedis `yaml:"redis"`
BoltDB SectionBoltDB `yaml:"boltdb"`
BuntDB SectionBuntDB `yaml:"buntdb"`
LevelDB SectionLevelDB `yaml:"leveldb"`
}
// SectionRedis is sub seciont of config.
@@ -89,6 +90,11 @@ type SectionBuntDB struct {
Path string `yaml:"path"`
}
// SectionLevelDB is sub seciont of config.
type SectionLevelDB struct {
Path string `yaml:"path"`
}
// SectionPID is sub seciont of config.
type SectionPID struct {
Enabled bool `yaml:"enabled"`
@@ -148,6 +154,7 @@ func BuildDefaultPushConf() ConfYaml {
conf.Stat.BoltDB.Bucket = "gorush"
conf.Stat.BuntDB.Path = "gorush.db"
conf.Stat.LevelDB.Path = "gorush.db"
return conf
}

View File

@@ -49,3 +49,5 @@ stat:
bucket: "gorush"
buntdb:
path: "gorush.db"
leveldb:
path: "gorush.db"

View File

@@ -102,6 +102,7 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() {
assert.Equal(suite.T(), "gorush", suite.ConfGorushDefault.Stat.BoltDB.Bucket)
assert.Equal(suite.T(), "gorush.db", suite.ConfGorushDefault.Stat.BuntDB.Path)
assert.Equal(suite.T(), "gorush.db", suite.ConfGorushDefault.Stat.LevelDB.Path)
}
func (suite *ConfigTestSuite) TestValidateConf() {
@@ -154,6 +155,7 @@ func (suite *ConfigTestSuite) TestValidateConf() {
assert.Equal(suite.T(), "gorush", suite.ConfGorush.Stat.BoltDB.Bucket)
assert.Equal(suite.T(), "gorush.db", suite.ConfGorush.Stat.BuntDB.Path)
assert.Equal(suite.T(), "gorush.db", suite.ConfGorush.Stat.LevelDB.Path)
}
func TestConfigTestSuite(t *testing.T) {