1 /* 2 * Copyright (C) 2023 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_TRACE_PROCESSOR_DB_COLUMN_DUMMY_STORAGE_H_ 17 #define SRC_TRACE_PROCESSOR_DB_COLUMN_DUMMY_STORAGE_H_ 18 19 #include <cstdint> 20 #include <memory> 21 #include <optional> 22 #include <string> 23 24 #include "perfetto/base/logging.h" 25 #include "perfetto/trace_processor/basic_types.h" 26 #include "src/trace_processor/db/column/data_layer.h" 27 #include "src/trace_processor/db/column/storage_layer.h" 28 #include "src/trace_processor/db/column/types.h" 29 30 namespace perfetto::trace_processor::column { 31 32 // Dummy storage. Used for columns that are not supposed to have operations done 33 // on them. 34 class DummyStorage final : public StorageLayer { 35 public: GetStoragePtr()36 StoragePtr GetStoragePtr() override { PERFETTO_FATAL("Shouldn't be called"); } 37 38 std::unique_ptr<DataLayerChain> MakeChain(); 39 40 private: 41 class ChainImpl : public DataLayerChain { 42 public: 43 ChainImpl() = default; 44 45 SingleSearchResult SingleSearch(FilterOp, 46 SqlValue, 47 uint32_t) const override; 48 49 SearchValidationResult ValidateSearchConstraints(FilterOp, 50 SqlValue) const override; 51 52 RangeOrBitVector SearchValidated(FilterOp, SqlValue, Range) const override; 53 54 void IndexSearchValidated(FilterOp, SqlValue, Indices&) const override; 55 56 void StableSort(Token* start, Token* end, SortDirection) const override; 57 58 void Distinct(Indices&) const override; 59 60 std::optional<Token> MaxElement(Indices&) const override; 61 62 std::optional<Token> MinElement(Indices&) const override; 63 64 SqlValue Get_AvoidUsingBecauseSlow(uint32_t index) const override; 65 66 uint32_t size() const override; 67 DebugString()68 std::string DebugString() const override { return "DummyStorage"; } 69 }; 70 }; 71 72 } // namespace perfetto::trace_processor::column 73 74 #endif // SRC_TRACE_PROCESSOR_DB_COLUMN_DUMMY_STORAGE_H_ 75