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 a788cb7 commit ab6a98a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions leveldb/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,6 @@ func encodeBatchHeader(dst []byte, seq uint64, batchLen int) []byte {
dst = ensureBuffer(dst, batchHeaderLen)
binary.LittleEndian.PutUint64(dst, seq)
binary.LittleEndian.PutUint32(dst[8:], uint32(batchLen))

s := fmt.Sprintf("leveldb encodeBatchHeader key %v len %v seq %v data %v.\n", string(dst[8:]), uint32(batchLen), seq, string(dst))
fmt.Println(s)

return dst
}

Expand Down
1 change: 1 addition & 0 deletions leveldb/db_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func (tr *Transaction) Write(b *Batch, wo *opt.WriteOptions) error {
if tr.closed {
return errTransactionDone
}

return b.replayInternal(func(i int, kt keyType, k, v []byte) error {
return tr.put(kt, k, v)
})
Expand Down
9 changes: 4 additions & 5 deletions leveldb/db_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package leveldb

import (
"fmt"
"sync/atomic"
"time"

Expand Down Expand Up @@ -274,8 +273,8 @@ func (db *DB) writeLocked(batch, ourBatch *Batch, merge, sync bool) error {
// It is safe to modify the contents of the arguments after Write returns but
// not before. Write will not modify content of the batch.
func (db *DB) Write(batch *Batch, wo *opt.WriteOptions) error {
s := fmt.Sprintf("leveldb WriteEEEEEEEEEEEEEEEE len %v dump %v data %v", batch.Dump(), batch.Len(), string(batch.data))
fmt.Println(s)
// s := fmt.Sprintf("leveldb WriteEEEEEEEEEEEEEEEE len %v dump %v data %v", batch.Dump(), batch.Len(), string(batch.data))
// fmt.Println(s)

if err := db.ok(); err != nil || batch == nil || batch.Len() == 0 {
return err
Expand Down Expand Up @@ -399,8 +398,8 @@ func (db *DB) Put(key, value []byte, wo *opt.WriteOptions) error {
// It is safe to modify the contents of the arguments after Delete returns but
// not before.
func (db *DB) Delete(key []byte, wo *opt.WriteOptions) error {
s := fmt.Sprintf("leveldb DELETE %v", string(key))
fmt.Println(s)
// s := fmt.Sprintf("leveldb DELETE %v", string(key))
// fmt.Println(s)

return db.putRec(keyTypeDel, key, nil, wo)
}
Expand Down

0 comments on commit ab6a98a

Please sign in to comment.