From 324e4237cf619895ff770e0ddc5507ce50006326 Mon Sep 17 00:00:00 2001 From: Sreekanth Sivasankaran Date: Wed, 1 Mar 2017 16:23:36 +0530 Subject: [PATCH] adding configurable Abort Close --- index/store/moss/store.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/index/store/moss/store.go b/index/store/moss/store.go index 3e153d3a..50ee1636 100644 --- a/index/store/moss/store.go +++ b/index/store/moss/store.go @@ -41,7 +41,8 @@ type Store struct { llstore store.KVStore // May be nil. llstats statsFunc // May be nil. - s *stats + s *stats + config map[string]interface{} } type statsFunc func() map[string]interface{} @@ -167,12 +168,22 @@ func New(mo store.MergeOperator, config map[string]interface{}) ( mo: mo, llstore: llStore, llstats: llStats, + config: config, } rv.s = &stats{s: &rv} return &rv, nil } func (s *Store) Close() error { + if v, ok := s.config["mossAbortCloseEnabled"]; ok && v.(bool) == true { + msw, ok := s.llstore.(*mossStoreWrapper) + if ok { + if s := msw.Actual(); s != nil { + s.CloseEx(moss.StoreCloseExOptions{Abort: true}) + } + } + } + return s.ms.Close() }