dosyago/sirdb

atomic writes

o0101 opened this issue · 0 comments

o0101 commented

 writes are already atomic because we use sync file operations and node is single-threaded.

lalaland1125 15 minutes ago 

File renames are atomic. This is a solved problem:

  1. Write your updates to a copy of the file.

  2. Do an atomic rename of that copy to the original.

but I like this because it's even safer say if something interrupts the write for whatever reason you already have a record without changing the original