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/trace_processor/basic_types.h" 25 #include "src/trace_processor/db/column/data_layer.h" 26 #include "src/trace_processor/db/column/types.h" 27 28 namespace perfetto::trace_processor::column { 29 30 // Dummy storage. Used for columns that are not supposed to have operations done 31 // on them. 32 class DummyStorage final : public DataLayer { 33 public: 34 class ChainImpl : public DataLayerChain { 35 public: 36 ChainImpl() = default; 37 38 SingleSearchResult SingleSearch(FilterOp, 39 SqlValue, 40 uint32_t) const override; 41 42 SearchValidationResult ValidateSearchConstraints(FilterOp, 43 SqlValue) const override; 44 45 RangeOrBitVector SearchValidated(FilterOp, SqlValue, Range) const override; 46 47 void IndexSearchValidated(FilterOp, SqlValue, Indices&) const override; 48 49 void StableSort(SortToken* start, 50 SortToken* end, 51 SortDirection) const override; 52 53 void Distinct(Indices&) const override; 54 55 std::optional<Token> MaxElement(Indices&) const override; 56 57 std::optional<Token> MinElement(Indices&) const override; 58 59 SqlValue Get_AvoidUsingBecauseSlow(uint32_t index) const override; 60 61 void Serialize(StorageProto*) const override; 62 63 uint32_t size() const override; 64 DebugString()65 std::string DebugString() const override { return "DummyStorage"; } 66 }; 67 std::unique_ptr<DataLayerChain> MakeChain(); 68 }; 69 70 } // namespace perfetto::trace_processor::column 71 72 #endif // SRC_TRACE_PROCESSOR_DB_COLUMN_DUMMY_STORAGE_H_ 73