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

Method process

libminifi/src/core/ProcessSessionReadCallback.cpp:44–64  ·  view source on GitHub ↗

Copy the entire file contents to the temporary file

Source from the content-addressed store, hash-verified

42
43// Copy the entire file contents to the temporary file
44int64_t ProcessSessionReadCallback::process(const std::shared_ptr<io::BaseStream>& stream) {
45 // Copy file contents into tmp file
46 _writeSucceeded = false;
47 size_t size = 0;
48 uint8_t buffer[8192];
49 do {
50 int read = stream->read(buffer, 8192);
51 if (read < 0) {
52 return -1;
53 }
54 if (read == 0) {
55 break;
56 }
57 if (!_tmpFileOs.write(reinterpret_cast<char*>(buffer), read)) {
58 return -1;
59 }
60 size += read;
61 } while (size < stream->size());
62 _writeSucceeded = true;
63 return size;
64}
65
66// Renames tmp file to final destination
67// Returns true if commit succeeded

Callers 3

writeMethod · 0.45
appendMethod · 0.45
readMethod · 0.45

Calls 3

readMethod · 0.45
writeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected