improved logging
This commit is contained in:
parent
f8407162ad
commit
05b41cedce
81 changed files with 9802 additions and 279 deletions
15
pkg/db/db.go
15
pkg/db/db.go
|
|
@ -3,11 +3,13 @@
|
|||
package db
|
||||
|
||||
import (
|
||||
"io"
|
||||
"path/filepath"
|
||||
|
||||
"git.giftfish.de/ston1th/docstore/pkg/core"
|
||||
"git.giftfish.de/ston1th/docstore/pkg/index"
|
||||
"git.giftfish.de/ston1th/docstore/pkg/store"
|
||||
"io"
|
||||
"path/filepath"
|
||||
"github.com/go-logr/logr"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -18,14 +20,15 @@ const (
|
|||
const blevePath = "bleve"
|
||||
|
||||
type DB struct {
|
||||
log logr.Logger
|
||||
rm countMutex
|
||||
IndexMutex countMutex
|
||||
store store.Store
|
||||
Index *index.Index
|
||||
}
|
||||
|
||||
func New(cfg *core.Config) (db *DB, err error) {
|
||||
db, err = NewPlain(cfg)
|
||||
func New(log logr.Logger, cfg *core.Config) (db *DB, err error) {
|
||||
db, err = NewPlain(log, cfg)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
@ -48,8 +51,8 @@ func New(cfg *core.Config) (db *DB, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func NewPlain(cfg *core.Config) (db *DB, err error) {
|
||||
db = new(DB)
|
||||
func NewPlain(log logr.Logger, cfg *core.Config) (db *DB, err error) {
|
||||
db = &DB{log: log}
|
||||
dbFile := filepath.Join(cfg.RunDir, storeFile)
|
||||
db.store, err = store.NewBoltStore(dbFile, nil)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue