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

Method commit

libminifi/src/core/ContentSession.cpp:69–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69void ContentSession::commit() {
70 for (const auto& resource : managedResources_) {
71 auto outStream = repository_->write(*resource.first);
72 if (outStream == nullptr) {
73 throw Exception(REPOSITORY_EXCEPTION, "Couldn't open the underlying resource for write: " + resource.first->getContentFullPath());
74 }
75 const int size = gsl::narrow<int>(resource.second->size());
76 const int bytes_written = outStream->write(const_cast<uint8_t*>(resource.second->getBuffer()), size);
77 if (bytes_written != size) {
78 throw Exception(REPOSITORY_EXCEPTION, "Failed to write new resource: " + resource.first->getContentFullPath());
79 }
80 }
81 for (const auto& resource : extendedResources_) {
82 auto outStream = repository_->write(*resource.first, true);
83 if (outStream == nullptr) {
84 throw Exception(REPOSITORY_EXCEPTION, "Couldn't open the underlying resource for append: " + resource.first->getContentFullPath());
85 }
86 const int size = gsl::narrow<int>(resource.second->size());
87 const int bytes_written = outStream->write(const_cast<uint8_t*>(resource.second->getBuffer()), size);
88 if (bytes_written != size) {
89 throw Exception(REPOSITORY_EXCEPTION, "Failed to append to resource: " + resource.first->getContentFullPath());
90 }
91 }
92
93 managedResources_.clear();
94 extendedResources_.clear();
95}
96
97void ContentSession::rollback() {
98 managedResources_.clear();

Callers 12

runNextProcessorMethod · 0.45
runNextProcessorMethod · 0.45
runCurrentProcessorMethod · 0.45
writeMethod · 0.45
triggerMethod · 0.45
MergeFileTests.cppFile · 0.45
SessionTests.cppFile · 0.45
RepoTests.cppFile · 0.45
test_templateFunction · 0.45
onTriggerMethod · 0.45

Calls 6

ExceptionClass · 0.85
writeMethod · 0.45
getContentFullPathMethod · 0.45
sizeMethod · 0.45
getBufferMethod · 0.45
clearMethod · 0.45

Tested by 5

runNextProcessorMethod · 0.36
runCurrentProcessorMethod · 0.36
writeMethod · 0.36
triggerMethod · 0.36
test_templateFunction · 0.36