Skip to content

Commit

Permalink
compression/rle: delete RLE compression (ethereum#16468)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl authored and mariameda committed Aug 19, 2018
1 parent 29b1d02 commit 2e9ecd1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 170 deletions.
101 changes: 0 additions & 101 deletions compression/rle/read_write.go

This file was deleted.

50 changes: 0 additions & 50 deletions compression/rle/read_write_test.go

This file was deleted.

6 changes: 0 additions & 6 deletions ethdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ func (db *LDBDatabase) Path() string {

// Put puts the given key / value to the queue
func (db *LDBDatabase) Put(key []byte, value []byte) error {
// Generate the data to write to disk, update the meter and write
//value = rle.Compress(value)

return db.db.Put(key, value, nil)
}

Expand All @@ -103,18 +100,15 @@ func (db *LDBDatabase) Has(key []byte) (bool, error) {

// Get returns the given key if it's present.
func (db *LDBDatabase) Get(key []byte) ([]byte, error) {
// Retrieve the key and increment the miss counter if not found
dat, err := db.db.Get(key, nil)
if err != nil {
return nil, err
}
return dat, nil
//return rle.Decompress(dat)
}

// Delete deletes the key from the queue and database
func (db *LDBDatabase) Delete(key []byte) error {
// Execute the actual operation
return db.db.Delete(key, nil)
}

Expand Down
15 changes: 2 additions & 13 deletions swarm/storage/database.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package storage
import (
"fmt"

"github.com/NiluPlatform/go-nilu/compression/rle"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/iterator"
"github.com/syndtr/goleveldb/leveldb/opt"
Expand All @@ -31,8 +30,7 @@ import (
const openFileLimit = 128

type LDBDatabase struct {
db *leveldb.DB
comp bool
db *leveldb.DB
}

func NewLDBDatabase(file string) (*LDBDatabase, error) {
Expand All @@ -42,16 +40,12 @@ func NewLDBDatabase(file string) (*LDBDatabase, error) {
return nil, err
}

database := &LDBDatabase{db: db, comp: false}
database := &LDBDatabase{db: db}

return database, nil
}

func (self *LDBDatabase) Put(key []byte, value []byte) {
if self.comp {
value = rle.Compress(value)
}

err := self.db.Put(key, value, nil)
if err != nil {
fmt.Println("Error put", err)
Expand All @@ -63,11 +57,6 @@ func (self *LDBDatabase) Get(key []byte) ([]byte, error) {
if err != nil {
return nil, err
}

if self.comp {
return rle.Decompress(dat)
}

return dat, nil
}

Expand Down

0 comments on commit 2e9ecd1

Please sign in to comment.