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

Ouroboros.Consensus.Node.DbLock

Synopsis

Documentation

newtype DbLocked Source #

Constructors

DbLocked FilePath 

Instances

Instances details
Exception DbLocked Source # 
Instance details

Defined in Ouroboros.Consensus.Node.DbLock

Show DbLocked Source # 
Instance details

Defined in Ouroboros.Consensus.Node.DbLock

Methods

showsPrecIntDbLockedShowS #

showDbLockedString #

showList ∷ [DbLocked] → ShowS #

Eq DbLocked Source # 
Instance details

Defined in Ouroboros.Consensus.Node.DbLock

Methods

(==)DbLockedDbLockedBool #

(/=)DbLockedDbLockedBool #

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

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