2014-05-22 16:02:22 +04:00
|
|
|
package ledis
|
|
|
|
|
2014-06-03 11:40:10 +04:00
|
|
|
func (db *DB) FlushAll() (drop int64, err error) {
|
2014-05-22 16:02:22 +04:00
|
|
|
all := [...](func() (int64, error)){
|
2014-06-12 06:51:36 +04:00
|
|
|
db.flush,
|
|
|
|
db.lFlush,
|
|
|
|
db.hFlush,
|
|
|
|
db.zFlush}
|
2014-05-22 16:02:22 +04:00
|
|
|
|
|
|
|
for _, flush := range all {
|
|
|
|
if n, e := flush(); e != nil {
|
|
|
|
err = e
|
|
|
|
return
|
|
|
|
} else {
|
|
|
|
drop += n
|
|
|
|
}
|
|
|
|
}
|
2014-06-03 11:40:10 +04:00
|
|
|
|
2014-05-22 16:02:22 +04:00
|
|
|
return
|
|
|
|
}
|
2014-06-03 11:40:10 +04:00
|
|
|
|
2014-06-12 06:51:36 +04:00
|
|
|
func (db *DB) newEliminator() *elimination {
|
2014-06-03 11:40:10 +04:00
|
|
|
eliminator := newEliminator(db)
|
|
|
|
eliminator.regRetireContext(kvExpType, db.kvTx, db.delete)
|
2014-06-05 12:13:35 +04:00
|
|
|
eliminator.regRetireContext(lExpType, db.listTx, db.lDelete)
|
|
|
|
eliminator.regRetireContext(hExpType, db.hashTx, db.hDelete)
|
|
|
|
eliminator.regRetireContext(zExpType, db.zsetTx, db.zDelete)
|
2014-06-03 11:40:10 +04:00
|
|
|
|
2014-06-12 06:51:36 +04:00
|
|
|
return eliminator
|
2014-06-03 11:40:10 +04:00
|
|
|
}
|