etcd: decouple embedded etcd instance startup

This refactor changes how we instantiate the etcd based Backend to allow
separate initialization and startup for the embedded instance.
This commit is contained in:
Andras Banki-Horvath committed 2021-05-04 17:33:05 +02:00
1 parent 6757e14998
commit 9992e5c0b5
5 files changed
+46 -47

No files matched your search

+7
View File
@@ -234,6 +234,13 @@ func Main(cfg *Config, lisCfg ListenerCfg, interceptor signal.Interceptor) error
ctx, cancel := context.WithCancel(ctx)
defer cancel()
// Run configuration dependent DB pre-initialization. Note that this
// needs to be done early and once during the startup process, before
// any DB access.
if err := cfg.DB.Init(ctx, cfg.localDatabaseDir()); err != nil {
return err
}
localChanDB, remoteChanDB, cleanUp, err := initializeDatabases(ctx, cfg)
switch {
case err == channeldb.ErrDryRunMigrationOK: