ouroboros-consensus-diffusion-0.18.0.0: Integration for the Ouroboros Network layer
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Node.Recovery

Synopsis

Documentation

newtype LastShutDownWasClean Source #

Did the ChainDB already have existing clean-shutdown marker on disk?

createCleanShutdownMarkerIOLike m ⇒ HasFS m h → m () Source #

Create the cleanShutdownMarkerFile.

Idempotent.

hasCleanShutdownMarkerHasFS m h → m Bool Source #

Return True when cleanShutdownMarkerFile exists.

removeCleanShutdownMarkerHasFS m h → m () Source #

Remove cleanShutdownMarkerFile.

Will throw an FsResourceDoesNotExist error when it does not exist.

runWithCheckedDB ∷ ∀ a m h blk. (IOLike m, StandardHash blk, Typeable blk) ⇒ Proxy blk → Tracer m (TraceEvent 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.