Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard Class Reference

RAII guard that removes a temporary file unless committed. More...

#include <ca-checkpoint.H>

Public Member Functions

 Tmp_File_Guard (std::filesystem::path p) noexcept
 
 Tmp_File_Guard (const Tmp_File_Guard &)=delete
 
Tmp_File_Guard & operator= (const Tmp_File_Guard &)=delete
 
 ~Tmp_File_Guard () noexcept
 
void commit () noexcept
 Mark the temporary file as successfully renamed; suppress cleanup.
 
const std::filesystem::path & path () const noexcept
 Access the underlying path.
 

Private Attributes

std::filesystem::path path_
 
bool committed_ = false
 

Detailed Description

RAII guard that removes a temporary file unless committed.

Used during atomic writes so a thrown exception (or early return) always cleans up the partial <path>.tmp.* sibling.

Definition at line 309 of file ca-checkpoint.H.

Constructor & Destructor Documentation

◆ Tmp_File_Guard() [1/2]

Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard::Tmp_File_Guard ( std::filesystem::path  p)
inlineexplicitnoexcept

Definition at line 315 of file ca-checkpoint.H.

◆ Tmp_File_Guard() [2/2]

Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard::Tmp_File_Guard ( const Tmp_File_Guard &  )
delete

◆ ~Tmp_File_Guard()

Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard::~Tmp_File_Guard ( )
inlinenoexcept

Definition at line 322 of file ca-checkpoint.H.

References Aleph::blossom_maximum_cardinality_matching(), committed_, and path_.

Member Function Documentation

◆ commit()

void Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard::commit ( )
inlinenoexcept

Mark the temporary file as successfully renamed; suppress cleanup.

Definition at line 332 of file ca-checkpoint.H.

References committed_.

Referenced by Aleph::CA::ca_checkpoint_detail::atomic_write_file().

◆ operator=()

Tmp_File_Guard & Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard::operator= ( const Tmp_File_Guard &  )
delete

◆ path()

const std::filesystem::path & Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard::path ( ) const
inlinenoexcept

Access the underlying path.

Definition at line 335 of file ca-checkpoint.H.

References path_.

Member Data Documentation

◆ committed_

bool Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard::committed_ = false
private

Definition at line 312 of file ca-checkpoint.H.

Referenced by ~Tmp_File_Guard(), and commit().

◆ path_

std::filesystem::path Aleph::CA::ca_checkpoint_detail::Tmp_File_Guard::path_
private

Definition at line 311 of file ca-checkpoint.H.

Referenced by ~Tmp_File_Guard(), and path().


The documentation for this class was generated from the following file: