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

Method append

libminifi/src/core/ProcessSession.cpp:244–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244void ProcessSession::append(const std::shared_ptr<core::FlowFile> &flow, OutputStreamCallback *callback) {
245 std::shared_ptr<ResourceClaim> claim = flow->getResourceClaim();
246 if (!claim) {
247 // No existed claim for append, we need to create new claim
248 return write(flow, callback);
249 }
250
251 try {
252 uint64_t startTime = utils::timeutils::getTimeMillis();
253 std::shared_ptr<io::BaseStream> stream = content_session_->write(claim, ContentSession::WriteMode::APPEND);
254 if (nullptr == stream) {
255 throw Exception(FILE_OPERATION_EXCEPTION, "Failed to open flowfile content for append");
256 }
257 // Call the callback to write the content
258
259 size_t oldPos = stream->size();
260 // this prevents an issue if we write, above, with zero length.
261 if (oldPos > 0)
262 stream->seek(oldPos + 1);
263 if (callback->process(stream) < 0) {
264 throw Exception(FILE_OPERATION_EXCEPTION, "Failed to process flowfile content");
265 }
266 flow->setSize(stream->size());
267
268 std::stringstream details;
269 details << process_context_->getProcessorNode()->getName() << " modify flow record content " << flow->getUUIDStr();
270 uint64_t endTime = utils::timeutils::getTimeMillis();
271 provenance_report_->modifyContent(flow, details.str(), endTime - startTime);
272 } catch (std::exception &exception) {
273 logger_->log_debug("Caught Exception %s", exception.what());
274 throw;
275 } catch (...) {
276 logger_->log_debug("Caught Exception during process session append");
277 throw;
278 }
279}
280
281int ProcessSession::read(const std::shared_ptr<core::FlowFile> &flow, InputStreamCallback *callback) {
282 try {

Callers 12

mainFunction · 0.45
SQLiteTests.cppFile · 0.45
raiseComponentErrorMethod · 0.45
build_imageMethod · 0.45
build_image_by_pathMethod · 0.45
connectMethod · 0.45
serializeMethod · 0.45
serializeMethod · 0.45
__init__Method · 0.45

Calls 14

getTimeMillisFunction · 0.85
ExceptionClass · 0.85
getResourceClaimMethod · 0.80
setSizeMethod · 0.80
getProcessorNodeMethod · 0.80
log_debugMethod · 0.80
writeMethod · 0.45
sizeMethod · 0.45
seekMethod · 0.45
processMethod · 0.45
getNameMethod · 0.45
getUUIDStrMethod · 0.45

Tested by

no test coverage detected