Camel.DataCache.commit_atomic

### Method

# Camel DataCachecommit_atomic

unstable since: 3.62

#### Declaration [src]

    GIOStream*
    camel_data_cache_commit_atomic (
      CamelDataCache* cdc,
      GIOStream* stream,
      GError** error
    )

#### Description [src]

Finalise an atomic cache write. `stream` is closed and unreffed, the temporary file is renamed to its final location, and a new `GIOStream` opened on the committed file is returned (equivalent to calling `camel_data_cache_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 camel_data_cache_discard_atomic().

Available since: 3.62

#### Parameters

`stream`

  Type: `GIOStream`

  The `GIOStream` returned by camel_data_cache_add_atomic().

  The instance takes ownership of the data, and is responsible for freeing it.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GIOStream`

A `GIOStream` for the committed file, or `NULL` on error.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.