| 381 | } |
| 382 | |
| 383 | void ProvenanceReporter::commit() { |
| 384 | if (repo_->isNoop()) { |
| 385 | return; |
| 386 | } |
| 387 | |
| 388 | if (repo_->isFull()) { |
| 389 | logger_->log_debug("Provenance Repository is full"); |
| 390 | return; |
| 391 | } |
| 392 | |
| 393 | std::vector<std::pair<std::string, std::unique_ptr<io::BufferStream>>> flowData; |
| 394 | |
| 395 | for (auto& event : _events) { |
| 396 | std::unique_ptr<io::BufferStream> stramptr(new io::BufferStream()); |
| 397 | event->Serialize(*stramptr.get()); |
| 398 | |
| 399 | flowData.emplace_back(event->getUUIDStr(), std::move(stramptr)); |
| 400 | } |
| 401 | repo_->MultiPut(flowData); |
| 402 | } |
| 403 | |
| 404 | void ProvenanceReporter::create(std::shared_ptr<core::FlowFile> flow, std::string detail) { |
| 405 | auto event = allocate(ProvenanceEventRecord::CREATE, flow); |