Skip to content

Commit 0be47a3

Browse files
jasagredogeo2a
authored andcommitted
Rename runReadLocked to unsafeRunReadLocked now that it is exposed
1 parent 4decdd0 commit 0be47a3

File tree

2 files changed

+3
-3
lines changed
  • ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB

2 files changed

+3
-3
lines changed

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ withTransferrableReadAccess h rr f = getEnv h $ \ldbEnv -> do
771771
-- the forker was opened.
772772
join $ readTVarIO tv
773773
)
774-
runReadLocked (acquireAtTarget ldbEnv f >>= traverse (newForker h ldbEnv tv rr))
774+
unsafeRunReadLocked (acquireAtTarget ldbEnv f >>= traverse (newForker h ldbEnv tv rr))
775775

776776
-- | Acquire both a value handle and a db changelog at the tip. Holds a read lock
777777
-- while doing so.

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1/Lock.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ mkLedgerDBLock :: IOLike m => m (LedgerDBLock m)
5959
mkLedgerDBLock = LedgerDBLock <$> Lock.new ()
6060

6161
-- | An action in @m@ that has to hold the read lock. See @withReadLock@.
62-
newtype ReadLocked m a = ReadLocked {runReadLocked :: m a}
62+
newtype ReadLocked m a = ReadLocked {unsafeRunReadLocked :: m a}
6363
deriving newtype (Functor, Applicative, Monad)
6464

6565
-- | Enforce that the action has to be run while holding the read lock.
@@ -69,7 +69,7 @@ readLocked = ReadLocked
6969
-- | Acquire the ledger DB read lock and hold it while performing an action
7070
withReadLock :: IOLike m => LedgerDBLock m -> ReadLocked m a -> m a
7171
withReadLock (LedgerDBLock lock) m =
72-
Lock.withReadAccess lock (\() -> runReadLocked m)
72+
Lock.withReadAccess lock (\() -> unsafeRunReadLocked m)
7373

7474
-- | An action in @m@ that has to hold the write lock. See @withWriteLock@.
7575
newtype WriteLocked m a = WriteLocked {runWriteLocked :: m a}

0 commit comments

Comments
 (0)