Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Node.Recovery
Synopsis
- newtype LastShutDownWasClean = LastShutDownWasClean Bool
- createCleanShutdownMarker :: IOLike m => HasFS m h -> m ()
- hasCleanShutdownMarker :: HasFS m h -> m Bool
- removeCleanShutdownMarker :: HasFS m h -> m ()
- runWithCheckedDB :: forall a m h blk. ( IOLike m, StandardHash blk, Typeable blk) => Proxy blk -> HasFS m h -> ( LastShutDownWasClean -> ( ChainDB m blk -> m a -> m a) -> m a) -> m a
Documentation
newtype LastShutDownWasClean Source #
Did the ChainDB already have existing clean-shutdown marker on disk?
Constructors
LastShutDownWasClean Bool |
Instances
Eq LastShutDownWasClean Source # | |
Defined in Ouroboros.Consensus.Node.Recovery Methods (==) :: LastShutDownWasClean -> LastShutDownWasClean -> Bool Source # (/=) :: LastShutDownWasClean -> LastShutDownWasClean -> Bool Source # |
|
Show LastShutDownWasClean Source # | |
Defined in Ouroboros.Consensus.Node.Recovery |
createCleanShutdownMarker :: IOLike m => HasFS m h -> m () Source #
Create the
cleanShutdownMarkerFile
.
Idempotent.
hasCleanShutdownMarker :: HasFS m h -> m Bool Source #
Return
True
when
cleanShutdownMarkerFile
exists.
removeCleanShutdownMarker :: HasFS m h -> m () Source #
Remove
cleanShutdownMarkerFile
.
Will throw an
FsResourceDoesNotExist
error when it does not exist.
runWithCheckedDB :: forall a m h blk. ( IOLike m, StandardHash blk, Typeable blk) => Proxy blk -> HasFS m h -> ( LastShutDownWasClean -> ( ChainDB m blk -> m a -> m a) -> m a) -> m a Source #
A bracket function that manages the clean-shutdown marker on disk.
- If the marker is missing on startup, then ChainDB initialization will revalidate the database contents.
- If the OS kills the nodes, then we don't have the opportunity to write out the marker file, which is fine, since we want the next startup to do revalidation.
- If initialization was cleanly interrupted (eg SIGINT), then we leave the marker the marker in the same state as it was at the beginning of said initialization.
-
At the end of a successful initialization, we remove the marker and install
a shutdown handler that writes the marker except for certain exceptions
(see
exceptionRequiresRecovery
) that indicate corruption, for which we want the next startup to do revalidation.