Since data have been read, the moveForward will call os.Remove to remove the associated file on disk. But in some scenarios, the caller program maybe crashes and restarts, and the data have been read which also means the file may be removed, but the data haven't been applied in the caller. So the data may lost.
So, in my point of view, it's better to add an interface to remove old files asynchronously to guarantee atomicity.
Since data have been read, the
moveForward
will callos.Remove
to remove the associated file on disk. But in some scenarios, the caller program maybe crashes and restarts, and the data have been read which also means the file may be removed, but the data haven't been applied in the caller. So the data may lost. So, in my point of view, it's better to add an interface to remove old files asynchronously to guarantee atomicity.