From ae3600aeeaa204b2da445d85505da6cac94da3f0 Mon Sep 17 00:00:00 2001 From: Steve Yen Date: Tue, 6 Jan 2015 18:59:02 -0800 Subject: [PATCH] expose forestdb rollback methods --- index/store/forestdb/store.go | 4 ++-- index/store/forestdb/store_test.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/index/store/forestdb/store.go b/index/store/forestdb/store.go index e8998903..03f8d6c3 100644 --- a/index/store/forestdb/store.go +++ b/index/store/forestdb/store.go @@ -133,7 +133,7 @@ func (s *Store) newSnapshot() (*forestdb.KVStore, error) { return s.dbkv.SnapshotOpen(seqNum) } -func (s *Store) getRollbackID() ([]byte, error) { +func (s *Store) GetRollbackID() ([]byte, error) { seqNum, err := s.getSeqNum() if err != nil { return nil, err @@ -146,7 +146,7 @@ func (s *Store) getRollbackID() ([]byte, error) { return buf.Bytes(), nil } -func (s *Store) rollbackTo(rollbackId []byte) error { +func (s *Store) RollbackTo(rollbackId []byte) error { s.writer.Lock() defer s.writer.Unlock() buf := bytes.NewReader(rollbackId) diff --git a/index/store/forestdb/store_test.go b/index/store/forestdb/store_test.go index 69d1ff0d..de63c828 100644 --- a/index/store/forestdb/store_test.go +++ b/index/store/forestdb/store_test.go @@ -72,7 +72,7 @@ func TestRollbackSameHandle(t *testing.T) { } // get the rollback id - rollbackId, err := s.getRollbackID() + rollbackId, err := s.GetRollbackID() if err != nil { t.Error(err) } @@ -103,7 +103,7 @@ func TestRollbackSameHandle(t *testing.T) { reader.Close() // now rollback - err = s.rollbackTo(rollbackId) + err = s.RollbackTo(rollbackId) if err != nil { t.Fatal(err) } @@ -152,7 +152,7 @@ func TestRollbackNewHandle(t *testing.T) { } // get the rollback id - rollbackId, err := s.getRollbackID() + rollbackId, err := s.GetRollbackID() if err != nil { t.Error(err) } @@ -183,7 +183,7 @@ func TestRollbackNewHandle(t *testing.T) { reader.Close() // now rollback - err = s.rollbackTo(rollbackId) + err = s.RollbackTo(rollbackId) if err != nil { t.Fatal(err) } @@ -246,7 +246,7 @@ func TestRollbackOtherHandle(t *testing.T) { } // get the rollback id - rollbackId, err := s.getRollbackID() + rollbackId, err := s.GetRollbackID() if err != nil { t.Error(err) } @@ -277,7 +277,7 @@ func TestRollbackOtherHandle(t *testing.T) { reader.Close() // now rollback - err = s.rollbackTo(rollbackId) + err = s.RollbackTo(rollbackId) if err != nil { t.Fatal(err) }