Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOT MERGE: Less reliable persistence prototype #1495

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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