Skip to content

Commit

Permalink
Restore usage of persistenceIncremental in Hydra.Network.Reliability
Browse files Browse the repository at this point in the history
We do not want to update this module (yet) with a different means for persistence.
  • Loading branch information
ch1bo committed Mar 4, 2024
1 parent 9b9da57 commit c92df27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions hydra-node/src/Hydra/Network/Reliability.hs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ mkMessagePersistence ::
PersistenceIncremental (Heartbeat msg) m ->
Persistence (Vector Int) m ->
MessagePersistence m msg
mkMessagePersistence numberOfParties persistenceIncremental ackPersistence =
mkMessagePersistence numberOfParties msgPersistence ackPersistence =
MessagePersistence
{ loadAcks = do
macks <- load ackPersistence
Expand All @@ -199,13 +199,11 @@ mkMessagePersistence numberOfParties persistenceIncremental ackPersistence =
, saveAcks = \acks -> do
save ackPersistence acks
, loadMessages = do
loadAll persistenceIncremental
loadAll msgPersistence
, appendMessage = \msg -> do
append persistenceIncremental msg
append msgPersistence msg
}

-- TODO(Elaine): this can probably be replaced with new persistence

-- | Middleware function to handle message counters tracking and resending logic.
--
-- '''NOTE''': There is some "abstraction leak" here, because the `withReliability`
Expand Down
1 change: 0 additions & 1 deletion hydra-node/src/Hydra/Node/Network.hs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ configureMessagePersistence ::
m (MessagePersistence m msg)
configureMessagePersistence tracer persistenceDir numberOfParties = do
msgPersistence <- createPersistenceIncremental $ storedMessagesFile persistenceDir
-- NOTE(Elaine): after deliberation, new persistence should be fine for network messages
ackPersistence@Persistence{load} <- createPersistence $ acksFile persistenceDir
mAcks <- load
ackPersistence' <- case fmap (\acks -> length acks == numberOfParties) mAcks of
Expand Down

0 comments on commit c92df27

Please sign in to comment.