| 49 | } |
| 50 | |
| 51 | std::shared_ptr<FlowFileRecord> FlowFileRecord::DeSerialize(const std::string& key, const std::shared_ptr<core::Repository>& flowRepository, |
| 52 | const std::shared_ptr<core::ContentRepository>& content_repo, utils::Identifier& container) { |
| 53 | std::string value; |
| 54 | |
| 55 | if (!flowRepository->Get(key, value)) { |
| 56 | logger_->log_error("NiFi FlowFile Store event %s can not found", key); |
| 57 | return nullptr; |
| 58 | } |
| 59 | io::BufferStream stream((const uint8_t*) value.data(), gsl::narrow<int>(value.length())); |
| 60 | |
| 61 | auto record = DeSerialize(stream, content_repo, container); |
| 62 | |
| 63 | if (record) { |
| 64 | logger_->log_debug("NiFi FlowFile retrieve uuid %s size " "%" PRIu64 " connection %s success", record->getUUIDStr(), stream.size(), container.to_string()); |
| 65 | } else { |
| 66 | logger_->log_debug("Couldn't deserialize FlowFile %s from the stream of size " "%" PRIu64, key, stream.size()); |
| 67 | } |
| 68 | |
| 69 | return record; |
| 70 | } |
| 71 | |
| 72 | bool FlowFileRecord::Serialize(io::OutputStream &outStream) { |
| 73 | int ret; |