commit_atomic


Description:

[ Version ( since = "3.62" ) ]
public IOStream commit_atomic (owned IOStream stream) throws Error

Finalise an atomic cache write.

stream is closed and unreffed, the temporary file is renamed to its final location, and a new IOStream opened on the committed file is returned (equivalent to calling @get after a successful write).

On failure the temporary file is removed and the bag reservation is released, so the caller does not need to call discard_atomic.

Parameters:

this

A DataCache

stream

the IOStream returned by add_atomic

Returns:

a IOStream for the committed file, or null on error