winget-cli

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

UpdateFlow.h (2509B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include "ExecutionContext.h"
      5 #include "WorkflowBase.h"
      6 
      7 namespace AppInstaller::CLI::Workflow
      8 {
      9     // Iterates through all available versions from a package and find latest applicable version
     10     // Required Args: bool indicating whether to report update not found
     11     // Inputs: InstalledPackageVersion?, Package
     12     // Outputs: Manifest?, Installer?
     13     struct SelectLatestApplicableVersion : public WorkflowTask
     14     {
     15         SelectLatestApplicableVersion(bool isSinglePackage) :
     16             WorkflowTask("SelectLatestApplicableUpdate"), m_isSinglePackage(isSinglePackage) {}
     17 
     18         void operator()(Execution::Context& context) const override;
     19 
     20     private:
     21         bool m_isSinglePackage;
     22     };
     23 
     24     // Ensures the update package has higher version than installed
     25     // Required Args: None
     26     // Inputs: Manifest, InstalledPackageVersion
     27     // Outputs: None
     28     void EnsureUpdateVersionApplicable(Execution::Context& context);
     29 
     30     // Update all packages from SearchResult to latest if applicable
     31     // Required Args: None
     32     // Inputs: SearchResult
     33     // Outputs: None
     34     void UpdateAllApplicable(Execution::Context& context);
     35 
     36     // Select single package version for install or upgrade
     37     // Required Args: bool indicating whether the flow is for upgrade
     38     // Inputs: Source, SearchResult
     39     // Outputs: None
     40     struct SelectSinglePackageVersionForInstallOrUpgrade : public WorkflowTask
     41     {
     42         SelectSinglePackageVersionForInstallOrUpgrade(OperationType operation, bool allowDowngrade = false) :
     43             WorkflowTask("SelectSinglePackageVersionForInstallOrUpgrade"), m_operationType(operation), m_allowDowngrade(allowDowngrade) {}
     44 
     45         void operator()(Execution::Context& context) const override;
     46 
     47     private:
     48         mutable OperationType m_operationType;
     49         bool m_allowDowngrade;
     50     };
     51 
     52     // Install or upgrade a single package
     53     // Required Args: bool indicating whether the flow is for upgrade
     54     // Inputs: Source
     55     // Outputs: None
     56     struct InstallOrUpgradeSinglePackage : public WorkflowTask
     57     {
     58         InstallOrUpgradeSinglePackage(OperationType operation) :
     59             WorkflowTask("InstallOrUpgradeSinglePackage"), m_operationType(operation) {}
     60 
     61         void operator()(Execution::Context& context) const override;
     62 
     63     private:
     64         mutable OperationType m_operationType;
     65     };
     66 }