Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
maurodelazeri committed Jan 6, 2023
1 parent 5ee0974 commit 1396ace
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions leveldb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package leveldb

import (
"container/list"
"context"
"fmt"
"io"
"os"
Expand All @@ -18,7 +17,7 @@ import (
"sync/atomic"
"time"

"github.com/go-redis/redis/v8"
"github.com/go-redis/redis"
"github.com/maurodelazeri/goleveldb/leveldb/cache"
"github.com/maurodelazeri/goleveldb/leveldb/errors"
"github.com/maurodelazeri/goleveldb/leveldb/iterator"
Expand Down Expand Up @@ -872,20 +871,20 @@ func (db *DB) has(auxm *memdb.DB, auxt tFiles, key []byte, seq uint64, ro *opt.R
func (db *DB) Get(key []byte, ro *opt.ReadOptions) (value []byte, err error) {
fmt.Println("GET BABY key", string(key))

val2, err := db.rdb.Get(context.Background(), string(key)).Result()
if err == redis.Nil {
return nil, nil
} else if err != nil {
return nil, err
}
return []byte(val2), nil
// val2, err := db.rdb.Get(context.Background(), string(key)).Result()
// if err == redis.Nil {
// return nil, nil
// } else if err != nil {
// return nil, err
// }
// return []byte(val2), nil

//fmt.Println("GET BABY key", string(key))
// //fmt.Println("GET BABY key", string(key))

err = db.ok()
if err != nil {
return
}
// err = db.ok()
// if err != nil {
// return
// }

se := db.acquireSnapshot()
defer db.releaseSnapshot(se)
Expand All @@ -896,19 +895,19 @@ func (db *DB) Get(key []byte, ro *opt.ReadOptions) (value []byte, err error) {
//
// It is safe to modify the contents of the argument after Has returns.
func (db *DB) Has(key []byte, ro *opt.ReadOptions) (ret bool, err error) {
fmt.Println("HAS BABY key", string(key))
_, err = db.rdb.Get(context.Background(), string(key)).Result()
if err == redis.Nil {
return false, nil
} else if err != nil {
return false, err
}
return true, nil

err = db.ok()
if err != nil {
return
}
// fmt.Println("HAS BABY key", string(key))
// _, err = db.rdb.Get(context.Background(), string(key)).Result()
// if err == redis.Nil {
// return false, nil
// } else if err != nil {
// return false, err
// }
// return true, nil

// err = db.ok()
// if err != nil {
// return
// }

se := db.acquireSnapshot()
defer db.releaseSnapshot(se)
Expand Down

0 comments on commit 1396ace

Please sign in to comment.