1 /* 2 * Copyright (C) 2024 The Android Open Source Project 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 SRC_BIGTRACE_WORKER_WORKER_IMPL_H_ 17 #define SRC_BIGTRACE_WORKER_WORKER_IMPL_H_ 18 19 #include <unordered_map> 20 21 #include "protos/perfetto/bigtrace/worker.grpc.pb.h" 22 #include "protos/perfetto/bigtrace/worker.pb.h" 23 #include "src/bigtrace/worker/repository_policies/trace_processor_loader.h" 24 25 namespace perfetto::bigtrace { 26 27 class WorkerImpl final : public protos::BigtraceWorker::Service { 28 public: WorkerImpl(std::unordered_map<std::string,std::unique_ptr<TraceProcessorLoader>> registry)29 explicit WorkerImpl( 30 std::unordered_map<std::string, std::unique_ptr<TraceProcessorLoader>> 31 registry) 32 : registry_(std::move(registry)) {} 33 grpc::Status QueryTrace( 34 grpc::ServerContext*, 35 const protos::BigtraceQueryTraceArgs* args, 36 protos::BigtraceQueryTraceResponse* response) override; 37 38 private: 39 std::unordered_map<std::string, std::unique_ptr<TraceProcessorLoader>> 40 registry_; 41 }; 42 43 } // namespace perfetto::bigtrace 44 45 #endif // SRC_BIGTRACE_WORKER_WORKER_IMPL_H_ 46