ouroboros-consensus-0.1.0.1: Consensus layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010

Ouroboros.Consensus.Node.Recovery

Synopsis

Documentation

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.