MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / commit

Method commit

libminifi/src/core/ProcessSessionReadCallback.cpp:68–89  ·  view source on GitHub ↗

Renames tmp file to final destination Returns true if commit succeeded

Source from the content-addressed store, hash-verified

66// Renames tmp file to final destination
67// Returns true if commit succeeded
68bool ProcessSessionReadCallback::commit() {
69 bool success = false;
70
71 logger_->log_debug("committing export operation to %s", _destFile);
72
73 if (_writeSucceeded) {
74 if (!_tmpFileOs.flush()) {
75 return false;
76 }
77 _tmpFileOs.close();
78
79 if (rename(_tmpFile.c_str(), _destFile.c_str())) {
80 logger_->log_warn("commit export operation to %s failed because rename() call failed", _destFile);
81 } else {
82 success = true;
83 logger_->log_debug("commit export operation to %s succeeded", _destFile);
84 }
85 } else {
86 logger_->log_error("commit export operation to %s failed because write failed", _destFile);
87 }
88 return success;
89}
90
91// Clean up resources
92ProcessSessionReadCallback::~ProcessSessionReadCallback() {

Callers

nothing calls this directly

Calls 6

log_debugMethod · 0.80
c_strMethod · 0.80
log_warnMethod · 0.80
log_errorMethod · 0.80
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected