ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Node.DbLock

Synopsis

Documentation

withLockDB :: MountPoint -> IO a -> IO a Source #

We use an empty file (dbLockFsPath) as a lock of the database so that the database cannot be opened by more than one process. We wait up to dbLockTimeout to take the lock, before timing out and throwing a DbLocked exception.

Defaults

dbLockFsPath :: FsPath Source #

The default lock file

dbLockTimeout :: DiffTime Source #

Default time to wait on the lock

For testing purposes

withLockDB_ Source #

Arguments

:: forall m a. (IOLike m, MonadTimer m) 
=> FileLock m 
-> MountPoint

Root of the path

-> FsPath

File to lock

-> DiffTime

Timeout

-> m a 
-> m a 

We use the given FsPath in the MountPoint as a lock of the database so that the database cannot be opened by more than one process. We wait the given DiffTime on the thread taking the lock. In case of a timeout, we throw a DbLocked exception.

Some systems may delete the empty file when all its handles are closed. This is not an issue, since the file is created if it doesn't exist.