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

Function getConnectionSize

controller/Controller.h:168–188  ·  view source on GitHub ↗

* Prints the connection size for the provided connection. * @param socket socket ptr * @param connection connection whose size will be returned. */

Source from the content-addressed store, hash-verified

166 * @param connection connection whose size will be returned.
167 */
168int getConnectionSize(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out, std::string connection) {
169 socket->initialize();
170 std::vector<uint8_t> data;
171 uint8_t op = minifi::c2::Operation::DESCRIBE;
172 minifi::io::BufferStream stream;
173 stream.write(&op, 1);
174 stream.write("queue");
175 stream.write(connection);
176 if (socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size())) < 0) {
177 return -1;
178 }
179 // read the response
180 uint8_t resp = 0;
181 socket->read(&resp, 1);
182 if (resp == minifi::c2::Operation::DESCRIBE) {
183 std::string size;
184 socket->read(size);
185 out << "Size/Max of " << connection << " " << size << std::endl;
186 }
187 return 0;
188}
189
190int listComponents(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out, bool show_header = true) {
191 socket->initialize();

Callers 1

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