From b2e86584701af21c23478a444ac7e32b6b908191 Mon Sep 17 00:00:00 2001 From: siddontang Date: Tue, 14 Mar 2017 22:15:17 +0800 Subject: [PATCH] remove no used code --- ledis/multi.go | 75 --------------------------------------------- ledis/multi_test.go | 51 ------------------------------ 2 files changed, 126 deletions(-) delete mode 100644 ledis/multi.go delete mode 100644 ledis/multi_test.go diff --git a/ledis/multi.go b/ledis/multi.go deleted file mode 100644 index 861a437..0000000 --- a/ledis/multi.go +++ /dev/null @@ -1,75 +0,0 @@ -package ledis - -// import ( -// "errors" -// "fmt" -// ) - -// var ( -// ErrNestMulti = errors.New("nest multi not supported") -// ErrMultiDone = errors.New("multi has been closed") -// ) - -// type Multi struct { -// *DB -// } - -// func (db *DB) IsInMulti() bool { -// return db.status == DBInMulti -// } - -// // begin a mutli to execute commands, -// // it will block any other write operations before you close the multi, unlike transaction, mutli can not rollback -// func (db *DB) Multi() (*Multi, error) { -// if db.IsInMulti() { -// return nil, ErrNestMulti -// } - -// m := new(Multi) - -// m.DB = new(DB) -// m.DB.status = DBInMulti - -// m.DB.l = db.l - -// m.l.wLock.Lock() - -// m.DB.sdb = db.sdb - -// m.DB.bucket = db.sdb - -// m.DB.index = db.index - -// m.DB.kvBatch = m.newBatch() -// m.DB.listBatch = m.newBatch() -// m.DB.hashBatch = m.newBatch() -// m.DB.zsetBatch = m.newBatch() -// // m.DB.binBatch = m.newBatch() -// m.DB.setBatch = m.newBatch() - -// m.DB.lbkeys = db.lbkeys - -// return m, nil -// } - -// func (m *Multi) newBatch() *batch { -// return m.l.newBatch(m.bucket.NewWriteBatch(), &multiBatchLocker{}, nil) -// } - -// func (m *Multi) Close() error { -// if m.bucket == nil { -// return ErrMultiDone -// } -// m.l.wLock.Unlock() -// m.bucket = nil -// return nil -// } - -// func (m *Multi) Select(index int) error { -// if index < 0 || index >= int(m.l.cfg.Databases) { -// return fmt.Errorf("invalid db index %d", index) -// } - -// m.DB.index = uint8(index) -// return nil -// } diff --git a/ledis/multi_test.go b/ledis/multi_test.go deleted file mode 100644 index 02a292a..0000000 --- a/ledis/multi_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package ledis - -// import ( -// "sync" -// "testing" -// ) - -// func TestMulti(t *testing.T) { -// db := getTestDB() - -// key := []byte("test_multi_1") -// v1 := []byte("v1") -// v2 := []byte("v2") - -// m, err := db.Multi() -// if err != nil { -// t.Fatal(err) -// } - -// wg := sync.WaitGroup{} - -// wg.Add(1) - -// go func() { -// if err := db.Set(key, v2); err != nil { -// t.Fatal(err) -// } -// wg.Done() -// }() - -// if err := m.Set(key, v1); err != nil { -// t.Fatal(err) -// } - -// if v, err := m.Get(key); err != nil { -// t.Fatal(err) -// } else if string(v) != string(v1) { -// t.Fatal(string(v)) -// } - -// m.Close() - -// wg.Wait() - -// if v, err := db.Get(key); err != nil { -// t.Fatal(err) -// } else if string(v) != string(v2) { -// t.Fatal(string(v)) -// } - -// }