mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #12855 from ptabor/20210409-backend-hooks
(no)StoreV2 (Part 4): Backend hooks: precommit updates consistency_index
This commit is contained in:
@@ -106,6 +106,8 @@ type backend struct {
|
||||
stopc chan struct{}
|
||||
donec chan struct{}
|
||||
|
||||
hooks Hooks
|
||||
|
||||
lg *zap.Logger
|
||||
}
|
||||
|
||||
@@ -126,6 +128,9 @@ type BackendConfig struct {
|
||||
UnsafeNoFsync bool `json:"unsafe-no-fsync"`
|
||||
// Mlock prevents backend database file to be swapped
|
||||
Mlock bool
|
||||
|
||||
// Hooks are getting executed during lifecycle of Backend's transactions.
|
||||
Hooks Hooks
|
||||
}
|
||||
|
||||
func DefaultBackendConfig() BackendConfig {
|
||||
@@ -192,6 +197,9 @@ func newBackend(bcfg BackendConfig) *backend {
|
||||
lg: bcfg.Logger,
|
||||
}
|
||||
b.batchTx = newBatchTxBuffered(b)
|
||||
// We set it after newBatchTxBuffered to skip the 'empty' commit.
|
||||
b.hooks = bcfg.Hooks
|
||||
|
||||
go b.run()
|
||||
return b
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user