From 84a70ad0c0987240f526f7c06f5db938dbf767d8 Mon Sep 17 00:00:00 2001 From: silentsai Date: Thu, 22 May 2014 20:02:22 +0800 Subject: [PATCH] add the missing code file for the db flush --- ledis/ledis_db.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ledis/ledis_db.go diff --git a/ledis/ledis_db.go b/ledis/ledis_db.go new file mode 100644 index 0000000..af583c1 --- /dev/null +++ b/ledis/ledis_db.go @@ -0,0 +1,19 @@ +package ledis + +func (db *DB) Flush() (drop int64, err error) { + all := [...](func() (int64, error)){ + db.KvFlush, + db.LFlush, + db.HFlush, + db.ZFlush} + + for _, flush := range all { + if n, e := flush(); e != nil { + err = e + return + } else { + drop += n + } + } + return +}