Interface.h (2038B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "Microsoft/Schema/ISQLiteIndex.h" 5 #include "Microsoft/Schema/1_4/Interface.h" 6 7 namespace AppInstaller::Repository::Microsoft::Schema::V1_5 8 { 9 // Interface to this schema version exposed through ISQLiteIndex. 10 struct Interface : public V1_4::Interface 11 { 12 Interface(Utility::NormalizationVersion normVersion = Utility::NormalizationVersion::Initial); 13 14 // Version 1.0 15 SQLite::Version GetVersion() const override; 16 void CreateTables(SQLite::Connection& connection, CreateOptions options) override; 17 SQLite::rowid_t AddManifest(SQLite::Connection& connection, const Manifest::Manifest& manifest, const std::optional<std::filesystem::path>& relativePath) override; 18 std::pair<bool, SQLite::rowid_t> UpdateManifest(SQLite::Connection& connection, const Manifest::Manifest& manifest, const std::optional<std::filesystem::path>& relativePath) override; 19 void RemoveManifestById(SQLite::Connection& connection, SQLite::rowid_t manifestId) override; 20 bool CheckConsistency(const SQLite::Connection& connection, bool log) const override; 21 22 protected: 23 24 bool NotNeeded(const SQLite::Connection& connection, std::string_view tableName, std::string_view valueName, SQLite::rowid_t id) const override; 25 26 // Gets a property already knowing that the manifest id is valid. 27 std::optional<std::string> GetPropertyByManifestIdInternal(const SQLite::Connection& connection, SQLite::rowid_t manifestId, PackageVersionProperty property) const override; 28 29 private: 30 // Gets the ARP version ranges for the given package identifier. 31 std::vector<Utility::VersionRange> GetArpVersionRanges(const SQLite::Connection& connection, SQLite::rowid_t packageIdentifier) const; 32 33 // Semantic check to validate all arp version ranges within the index 34 bool ValidateArpVersionConsistency(const SQLite::Connection& connection, bool log) const; 35 }; 36 }