| 687 | |
| 688 | |
| 689 | flow_file_record *invoke_ff(standalone_processor* proc, const flow_file_record *input_ff) { |
| 690 | if (proc == nullptr) { |
| 691 | return nullptr; |
| 692 | } |
| 693 | auto plan = ExecutionPlan::getPlan(proc->getUUID()); |
| 694 | if (!plan) { |
| 695 | // This is not a standalone processor, shouldn't be used with invoke! |
| 696 | return nullptr; |
| 697 | } |
| 698 | |
| 699 | plan->reset(); |
| 700 | |
| 701 | if (input_ff) { |
| 702 | auto content_repo = static_cast<std::shared_ptr<minifi::core::ContentRepository> *>(input_ff->crp); |
| 703 | auto ff_data = std::make_shared<flowfile_input_params>(); |
| 704 | |
| 705 | if(input_ff->crp && (*content_repo)) { |
| 706 | std::shared_ptr<minifi::ResourceClaim> claim = std::make_shared<minifi::ResourceClaim>(input_ff->contentLocation, |
| 707 | *content_repo); |
| 708 | ff_data->content_stream = (*content_repo)->read(*claim); |
| 709 | } else { |
| 710 | ff_data->content_stream = std::make_shared<minifi::io::BufferStream>(); |
| 711 | file_buffer fb = file_to_buffer(input_ff->contentLocation); |
| 712 | ff_data->content_stream->write(fb.buffer, gsl::narrow<int>(fb.file_len)); |
| 713 | free(fb.buffer); |
| 714 | } |
| 715 | |
| 716 | ff_data->attributes = *static_cast<AttributeMap*>(input_ff->attributes); |
| 717 | plan->runNextProcessor(nullptr, ff_data); |
| 718 | } |
| 719 | while (plan->runNextProcessor()) { |
| 720 | } |
| 721 | return flowfile_to_record(plan->getCurrentFlowFile(), plan.get()); |
| 722 | } |
| 723 | |
| 724 | flow_file_record *invoke_chunk(standalone_processor* proc, uint8_t* buf, uint64_t size) { |
| 725 | if (proc == nullptr || buf == nullptr || size == 0) { |
no test coverage detected