1 /* 2 * Copyright 2023 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef FCP_CLIENT_ENGINE_EXAMPLE_QUERY_PLAN_ENGINE_H_ 17 #define FCP_CLIENT_ENGINE_EXAMPLE_QUERY_PLAN_ENGINE_H_ 18 19 #include <string> 20 #include <vector> 21 22 #include "fcp/client/engine/common.h" 23 #include "fcp/client/engine/example_iterator_factory.h" 24 #include "fcp/client/opstats/opstats_logger.h" 25 26 namespace fcp { 27 namespace client { 28 namespace engine { 29 30 // A class used to "run" (interpret) an ExampleQuerySpec-based plan. Each 31 // instance should generally only be used once to run a plan. 32 class ExampleQueryPlanEngine { 33 public: 34 ExampleQueryPlanEngine( 35 std::vector<ExampleIteratorFactory*> example_iterator_factories, 36 ::fcp::client::opstats::OpStatsLogger* opstats_logger); 37 38 // Runs a plan and writes an output into a checkpoint at the given path. 39 ::fcp::client::engine::PlanResult RunPlan( 40 const google::internal::federated::plan::ExampleQuerySpec& 41 example_query_spec, 42 const std::string& output_checkpoint_filename); 43 44 private: 45 std::vector<ExampleIteratorFactory*> example_iterator_factories_; 46 ::fcp::client::opstats::OpStatsLogger* opstats_logger_; 47 }; 48 } // namespace engine 49 } // namespace client 50 } // namespace fcp 51 52 #endif // FCP_CLIENT_ENGINE_EXAMPLE_QUERY_PLAN_ENGINE_H_ 53