ouroboros-consensus-diffusion-0.22.0.1: Integration for the Ouroboros Network layer
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Node.DbLock

Synopsis

Documentation

newtype DbLocked Source #

Constructors

DbLocked FilePath 

withLockDBMountPointIO 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

dbLockFsPathFsPath Source #

The default lock file

dbLockTimeoutDiffTime Source #

Default time to wait on the lock

For testing purposes

withLockDB_ Source #

Arguments

∷ (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.