channeldb/db: adds optional dry-run abort for migrations
This commit is contained in:
4 files changed
+87
-4
No files matched your search
@@ -31,6 +31,10 @@ type Options struct {
|
||||
|
||||
// clock is the time source used by the database.
|
||||
clock clock.Clock
|
||||
|
||||
// dryRun will fail to commit a successful migration when opening the
|
||||
// database if set to true.
|
||||
dryRun bool
|
||||
}
|
||||
|
||||
// DefaultOptions returns an Options populated with default values.
|
||||
@@ -73,3 +77,11 @@ func OptionClock(clock clock.Clock) OptionModifier {
|
||||
o.clock = clock
|
||||
}
|
||||
}
|
||||
|
||||
// OptionDryRunMigration controls whether or not to intentially fail to commit a
|
||||
// successful migration that occurs when opening the database.
|
||||
func OptionDryRunMigration(dryRun bool) OptionModifier {
|
||||
return func(o *Options) {
|
||||
o.dryRun = dryRun
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user