winget-cli

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

StatusItemTable.h (2307B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include "Database/Schema/IConfigurationDatabase.h"
      5 #include <winget/SQLiteWrapper.h>
      6 #include <vector>
      7 #include <tuple>
      8 
      9 namespace winrt::Microsoft::Management::Configuration::implementation::Database::Schema::V0_3
     10 {
     11     struct StatusItemTable
     12     {
     13         StatusItemTable(AppInstaller::SQLite::Connection& connection);
     14 
     15         // Creates the table.
     16         void Create();
     17 
     18         // Removes the status for the target set.
     19         void RemoveForSet(AppInstaller::SQLite::rowid_t target);
     20 
     21         // Gets all status items that have changed since the given change identifier, in order of changes (last item is the new latest change to pass next).
     22         std::vector<IConfigurationDatabase::StatusItemTuple> GetStatusSince(int64_t changeIdentifier);
     23 
     24         // Gets the latest change identifier and the set status items.
     25         std::tuple<int64_t, std::vector<IConfigurationDatabase::StatusItemTuple>> GetStatusBaseline();
     26 
     27         // Updates a set's state.
     28         void UpdateSetState(const guid& setInstanceIdentifier, ConfigurationSetState state);
     29 
     30         // Updates whether a set is in the queue or not.
     31         void UpdateSetInQueue(const guid& setInstanceIdentifier, bool inQueue);
     32 
     33         // Updates a unit's state.
     34         void UpdateUnitState(const guid& setInstanceIdentifier, const IConfigurationDatabase::ConfigurationSetChangeDataPtr& changeData);
     35 
     36         // Gets a set's state.
     37         ConfigurationSetState GetSetState(const guid& instanceIdentifier);
     38 
     39         // Gets a set's latest apply begin time.
     40         std::chrono::system_clock::time_point GetSetApplyBegun(const GUID& instanceIdentifier);
     41 
     42         // Gets a set's latest apply end time.
     43         std::chrono::system_clock::time_point GetSetApplyEnded(const GUID& instanceIdentifier);
     44 
     45         // Gets a unit's state.
     46         ConfigurationUnitState GetUnitState(const guid& instanceIdentifier);
     47 
     48         // Gets a unit's latest result information.
     49         std::optional<std::tuple<HRESULT, std::string, std::string, ConfigurationUnitResultSource>> GetUnitResultInformation(const guid& instanceIdentifier);
     50 
     51     private:
     52         AppInstaller::SQLite::Connection& m_connection;
     53     };
     54 }