general improvements
This commit is contained in:
parent
bac08dc7cf
commit
ddb11f0619
25 changed files with 305 additions and 140 deletions
|
|
@ -26,14 +26,15 @@ You can customize it how you like.`
|
|||
const blevePath = "bleve"
|
||||
|
||||
type DB struct {
|
||||
admin bool
|
||||
store store.Store
|
||||
cache *cache.Cache
|
||||
Index *index.Index
|
||||
}
|
||||
|
||||
func New(dir string) (db *DB, err error) {
|
||||
db = &DB{cache: cache.NewCache()}
|
||||
dbFile := filepath.Join(dir, storeFile)
|
||||
func New(cfg core.Config) (db *DB, err error) {
|
||||
db = &DB{admin: cfg.Admin, cache: cache.NewCache()}
|
||||
dbFile := filepath.Join(cfg.DataDir, storeFile)
|
||||
err = godrop.Unveil(dbFile, "rwc")
|
||||
if err != nil {
|
||||
return
|
||||
|
|
@ -42,7 +43,7 @@ func New(dir string) (db *DB, err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
db.Index, err = index.NewIndex(filepath.Join(dir, blevePath))
|
||||
db.Index, err = index.NewIndex(filepath.Join(cfg.DataDir, blevePath))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue