Skip to content

Commit

Permalink
Re-enable network message persistence with non-durable write
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed Jul 10, 2024
1 parent 0909f2c commit 30ecb7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 2 additions & 6 deletions hydra-node/src/Hydra/Network/Reliability.hs
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,11 @@ mkMessagePersistence numberOfParties msgPersistence ackPersistence =
Nothing -> pure $ replicate numberOfParties 0
Just acks -> pure acks
, saveAcks = \acks -> do
-- FIXME: no network message persistence
-- save ackPersistence acks
pure ()
save ackPersistence acks
, loadMessages = do
loadAll msgPersistence
, appendMessage = \msg -> do
-- FIXME: no network message persistence
-- append msgPersistence msg
pure ()
append msgPersistence msg
}

-- | Middleware function to handle message counters tracking and resending logic.
Expand Down
5 changes: 3 additions & 2 deletions hydra-node/src/Hydra/Persistence.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Data.ByteString qualified as BS
import Data.ByteString.Char8 qualified as C8
import System.Directory (createDirectoryIfMissing, doesFileExist)
import System.FilePath (takeDirectory)
import UnliftIO.IO.File (withBinaryFile, writeBinaryFileDurableAtomic)
import UnliftIO.IO.File (withBinaryFile, writeBinaryFile)

data PersistenceException
= PersistenceException String
Expand All @@ -36,7 +36,8 @@ createPersistence fp = do
pure $
Persistence
{ save = \a -> do
writeBinaryFileDurableAtomic fp . toStrict $ Aeson.encode a
-- FIXME: this is not atomic / durable
writeBinaryFile fp . toStrict $ Aeson.encode a
, load =
liftIO (doesFileExist fp) >>= \case
False -> pure Nothing
Expand Down

0 comments on commit 30ecb7d

Please sign in to comment.