winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

ICheckpointDatabase.h (2214B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include <winget/SQLiteWrapper.h>
      5 #include <winget/SQLiteVersion.h>
      6 
      7 namespace AppInstaller::Repository::Microsoft::Schema
      8 {
      9     struct ICheckpointDatabase
     10     {
     11         virtual ~ICheckpointDatabase() = default;
     12 
     13         // Gets the schema version that this index interface is built for.
     14         virtual SQLite::Version GetVersion() const = 0;
     15 
     16         // Creates all of the version dependent tables within the database.
     17         virtual void CreateTables(SQLite::Connection& connection) = 0;
     18 
     19         // Version 1.0
     20         // Returns a bool value indicating whether all checkpoint tables are empty.
     21         virtual bool IsEmpty(SQLite::Connection& connection) = 0;
     22 
     23         // Returns all checkpoint ids in descending (newest at the front) order.
     24         virtual std::vector<SQLite::rowid_t> GetCheckpointIds(SQLite::Connection& connection) = 0;
     25          
     26         // Adds a new checkpoint to the Checkpoint table.
     27         virtual SQLite::rowid_t AddCheckpoint(SQLite::Connection& connection, std::string_view checkpointName) = 0;
     28 
     29         // Gets the data types associated with a checkpoint id.
     30         virtual std::vector<int> GetCheckpointDataTypes(SQLite::Connection& connection, SQLite::rowid_t checkpointId) = 0;
     31 
     32         // Sets the field values for a checkpoint data type.
     33         virtual void SetCheckpointDataValues(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int dataType, std::string_view name, const std::vector<std::string>& values) = 0;
     34 
     35         // Gets all field names for a checkpoint data type.
     36         virtual std::vector<std::string> GetCheckpointDataFields(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int dataType) = 0;
     37 
     38         // Gets all field values for a checkpoint data type.
     39         virtual std::optional<std::vector<std::string>> GetCheckpointDataFieldValues(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int dataType, std::string_view name) = 0;
     40     
     41         // Removes all values for a checkpoint data type.
     42         virtual void RemoveCheckpointDataType(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int dataType) = 0;
     43     };
     44 }