0
0
Fork 0

Merge pull request #546 from sreekanth-cb/store_abort_close

Store abort close
This commit is contained in:
Marty Schoch 2017-03-07 12:35:18 -05:00 committed by GitHub
commit 1bcfe4efa1
2 changed files with 13 additions and 2 deletions

View File

@ -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 val, ok := s.config["mossAbortCloseEnabled"]; ok {
if v, ok := val.(bool); ok && v {
if msw, ok := s.llstore.(*mossStoreWrapper); ok {
if s := msw.Actual(); s != nil {
_ = s.CloseEx(moss.StoreCloseExOptions{Abort: true})
}
}
}
}
return s.ms.Close()
}

2
vendor/manifest vendored
View File

@ -29,7 +29,7 @@
"importpath": "github.com/couchbase/moss",
"repository": "https://github.com/couchbase/moss",
"vcs": "git",
"revision": "564b451e917875e4c580cd4a14a6bbb44a1faf7e",
"revision": "fc637b3f82ec5b8139b0d295f6588c6a2bea5a16",
"branch": "master",
"notests": true
},