Fix ineffassign (#388)

* Fix ineffassign

* upgrade readme
This commit is contained in:
Lunny Xiao 2020-05-10 20:54:36 +08:00 committed by GitHub
parent eb6693a86b
commit b814d6a929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 53 deletions

View File

@ -26,6 +26,7 @@ LedisDB now supports multiple different databases as backends.
Create a workspace and checkout ledisdb source Create a workspace and checkout ledisdb source
```shell
git clone git@github.com:ledisdb/ledisdb.git git clone git@github.com:ledisdb/ledisdb.git
cd ledisdb cd ledisdb
@ -34,6 +35,7 @@ Create a workspace and checkout ledisdb source
make make
make test make test
```
Then you will find all the binary build on `./bin` directory. Then you will find all the binary build on `./bin` directory.
@ -66,7 +68,6 @@ Then you will find all the binary build on `./bin` directory.
If the RocksDB API changes, LedisDB may not build successfully. LedisDB currently supports RocksDB version 5.1 or later. If the RocksDB API changes, LedisDB may not build successfully. LedisDB currently supports RocksDB version 5.1 or later.
## Choose store database ## Choose store database
LedisDB now supports goleveldb, leveldb, rocksdb, and RAM. It will use goleveldb by default. LedisDB now supports goleveldb, leveldb, rocksdb, and RAM. It will use goleveldb by default.
@ -79,7 +80,7 @@ Choosing a store database to use is very simple.
+ Set in command flag + Set in command flag
ledis-server -config=/etc/ledis.conf -db_name=leveldb ledis -config=/etc/ledis.conf -db_name=leveldb
Flag command set will overwrite config setting. Flag command set will overwrite config setting.
@ -95,13 +96,14 @@ If you don't use a configuration, LedisDB will use the default for you.
## Server Example ## Server Example
```shell
//set run environment if not //set run environment if not
source dev.sh source dev.sh
./bin/ledis-server -config=/etc/ledis.conf ./bin/ledis -config=/etc/ledis.conf
//another shell //another shell
./bin/ledis-cli -p 6380 ./bin/ledis cli -p 6380
ledis 127.0.0.1:6380> set a 1 ledis 127.0.0.1:6380> set a 1
OK OK
@ -114,10 +116,12 @@ If you don't use a configuration, LedisDB will use the default for you.
curl http://127.0.0.1:11181/0/GET/hello?type=json curl http://127.0.0.1:11181/0/GET/hello?type=json
→ {"GET":"world"} → {"GET":"world"}
```
## Package Example ## Package Example
```go
import ( import (
lediscfg "github.com/ledisdb/ledisdb/config" lediscfg "github.com/ledisdb/ledisdb/config"
"github.com/ledisdb/ledisdb/ledis" "github.com/ledisdb/ledisdb/ledis"
@ -131,16 +135,18 @@ If you don't use a configuration, LedisDB will use the default for you.
db.Set(key, value) db.Set(key, value)
db.Get(key) db.Get(key)
```
## Replication Example ## Replication Example
Set slaveof in config or dynamiclly Set slaveof in config or dynamiclly
ledis-cli -p 6381 ```shell
ledis cli -p 6381
ledis 127.0.0.1:6381> slaveof 127.0.0.1 6380 ledis 127.0.0.1:6381> slaveof 127.0.0.1 6380
OK OK
```
## Cluster support ## Cluster support
@ -180,7 +186,6 @@ See [Clients](https://github.com/ledisdb/ledisdb/wiki/Clients) to find or contri
+ [pika](https://github.com/Qihoo360/pika) + [pika](https://github.com/Qihoo360/pika)
## Donate ## Donate
If you like the project and want to buy me a cola, you can through: If you like the project and want to buy me a cola, you can through:

View File

@ -106,13 +106,7 @@ func (l *Ledis) Dump(w io.Writer) error {
} }
} }
if err = wb.Flush(); err != nil { return wb.Flush()
return err
}
compressBuf = nil
return nil
} }
// LoadDumpFile clears all data and loads dump file to db // LoadDumpFile clears all data and loads dump file to db
@ -207,9 +201,6 @@ func (l *Ledis) LoadDump(r io.Reader) (*DumpHead, error) {
return nil, err return nil, err
} }
deKeyBuf = nil
deValueBuf = nil
if l.r != nil { if l.r != nil {
if err := l.r.UpdateCommitID(h.CommitID); err != nil { if err := l.r.UpdateCommitID(h.CommitID); err != nil {
return nil, err return nil, err

View File

@ -123,7 +123,7 @@ func (s *FileStore) GetLog(id uint64, l *Log) error {
} }
func (s *FileStore) FirstID() (uint64, error) { func (s *FileStore) FirstID() (uint64, error) {
id := uint64(0) var id uint64
s.rm.RLock() s.rm.RLock()
if len(s.rs) > 0 { if len(s.rs) > 0 {
@ -408,7 +408,6 @@ func (ts tableReaders) check() error {
return fmt.Errorf("invalid index %d in table %s", ts[i].index, ts[i]) return fmt.Errorf("invalid index %d in table %s", ts[i].index, ts[i])
} }
first = ts[i].first
last = ts[i].last last = ts[i].last
index = ts[i].index index = ts[i].index
} }