News for hackers. Stuff that matters.
Re:Show HN: AtomicWrite: cross platform library for atomical... by dicroce on Tuesday March 13, 2018 @01:48PM (#16578080)
I'm curious why it writes the whole file... Can't you do something like:

      if rollback log exists
         recover
      create log
      for each write(),
         write old contents of region to log (along w/ location)
      sync log
      for each write(),
         write new bits
      sync db file
      remove(log)
Re:Show HN: AtomicWrite: cross platform library for atomical... by jeffreyrogers on Tuesday March 13, 2018 @05:43PM (#16580120)
That is probably a better approach for large files. My initial use case was an application that would write an encrypted file containing passwords to disk. The files are relatively small, so that method didn't seem worth the additional complexity of something like what you describe. I believe sqlite does something similar at least in some configurations.

I might add something like this in the future.