wp
This commit is contained in:
@@ -10,19 +10,13 @@ import (
|
||||
"time"
|
||||
|
||||
"gordenko.dev/dima/qb"
|
||||
"gordenko.dev/dima/qb/atree"
|
||||
"gordenko.dev/dima/qb/inbox"
|
||||
"gordenko.dev/dima/qb/recovery"
|
||||
"gordenko.dev/dima/qb/storage"
|
||||
"gordenko.dev/dima/qb/worker"
|
||||
)
|
||||
|
||||
// type metricLockEntry struct {
|
||||
// XLock bool
|
||||
// RLocks int
|
||||
// WaitQueue []any
|
||||
// }
|
||||
//metricLockEntries map[uint32]*metricLockEntry
|
||||
|
||||
type Database struct {
|
||||
mutex sync.Mutex
|
||||
dir string
|
||||
@@ -30,6 +24,7 @@ type Database struct {
|
||||
workerInbox *inbox.Inbox
|
||||
worker *worker.Worker
|
||||
storage *storage.Writer
|
||||
atree *atree.Atree
|
||||
tcpPort int
|
||||
logfile *os.File
|
||||
logger *log.Logger
|
||||
@@ -122,8 +117,6 @@ func New(opt Options) (_ *Database, err error) {
|
||||
return nil, fmt.Errorf("storage.NewWriter: %s", err)
|
||||
}
|
||||
|
||||
fmt.Println("storage created")
|
||||
|
||||
s.worker = worker.New(worker.Options{
|
||||
Inbox: s.workerInbox,
|
||||
StorageInbox: storageInbox,
|
||||
@@ -133,7 +126,14 @@ func New(opt Options) (_ *Database, err error) {
|
||||
ExitCh: opt.ExitCh,
|
||||
WaitGroup: opt.WaitGroup,
|
||||
})
|
||||
fmt.Println("worker created")
|
||||
|
||||
s.atree, err = atree.New(atree.Options{
|
||||
DataFile: dataFile,
|
||||
IndexFile: indexFile,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("atree.New: %s", err)
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
@@ -146,13 +146,6 @@ func (s *Database) ListenAndServe() (err error) {
|
||||
//s.waitGroup.Add(1)
|
||||
go s.storage.Run()
|
||||
|
||||
// s.atree, err = atree.New(atree.Options{
|
||||
// Dir: s.dir,
|
||||
// DatabaseName: s.databaseName,
|
||||
// })
|
||||
// if err != nil {
|
||||
// return fmt.Errorf("atree.New: %s", err)
|
||||
// }
|
||||
// s.atree.Run()
|
||||
|
||||
s.waitGroup.Add(1)
|
||||
|
||||
Reference in New Issue
Block a user