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

Function updateFlow

controller/Controller.h:72–97  ·  view source on GitHub ↗

* Updates the flow to the provided file */

Source from the content-addressed store, hash-verified

70 * Updates the flow to the provided file
71 */
72int updateFlow(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out, std::string file) {
73 socket->initialize();
74 std::vector<uint8_t> data;
75 uint8_t op = minifi::c2::Operation::UPDATE;
76 minifi::io::BufferStream stream;
77 stream.write(&op, 1);
78 stream.write("flow");
79 stream.write(file);
80 if (socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size())) < 0) {
81 return -1;
82 }
83 // read the response
84 uint8_t resp = 0;
85 socket->read(&resp, 1);
86 if (resp == minifi::c2::Operation::DESCRIBE) {
87 uint16_t connections = 0;
88 socket->read(connections);
89 out << connections << " are full" << std::endl;
90 for (int i = 0; i < connections; i++) {
91 std::string fullcomponent;
92 socket->read(fullcomponent);
93 out << fullcomponent << " is full" << std::endl;
94 }
95 }
96 return 0;
97}
98
99/**
100 * Lists connections which are full

Callers 2

mainFunction · 0.85

Calls 5

initializeMethod · 0.45
writeMethod · 0.45
getBufferMethod · 0.45
sizeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected