IWinGetSQLiteIndex.cs (4014B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="IWinGetSQLiteIndex.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGetUtil.Interfaces 8 { 9 using System; 10 11 /// <summary> 12 /// The properties that can be set with IWinGetSQLiteIndex::SetProperty. 13 /// The values must match those in WinGetUtil.h. 14 /// </summary> 15 public enum SQLiteIndexProperty 16 { 17 /// <summary> 18 /// The base time to use for update tracking. The value is in the Unix epoch. 19 /// Set to an empty string to use the current time. 20 /// Set to 0 to force all files to be output. 21 /// </summary> 22 PackageUpdateTrackingBaseTime = 0, 23 24 /// <summary> 25 /// The full path to a base directory where intermediate files will be output. 26 /// The path does not need to exist, and may not be created if no files need to be written. 27 /// </summary> 28 IntermediateFileOutputPath = 1, 29 } 30 31 /// <summary> 32 /// Interface for index operations. 33 /// </summary> 34 public interface IWinGetSQLiteIndex : IDisposable 35 { 36 /// <summary> 37 /// Migrates the index to the given version. 38 /// </summary> 39 /// <param name="majorVersion">Major version.</param> 40 /// <param name="minorVersion">Minor version.</param> 41 void MigrateTo(uint majorVersion, uint minorVersion); 42 43 /// <summary> 44 /// Sets the given property to the given value. 45 /// </summary> 46 /// <param name="property">The property to set.</param> 47 /// <param name="value">The value to set.</param> 48 void SetProperty(SQLiteIndexProperty property, string value); 49 50 /// <summary> 51 /// Adds manifest to index. 52 /// </summary> 53 /// <param name="manifestPath">Manifest to add.</param> 54 /// <param name="relativePath">Path of the manifest in the repository.</param> 55 void AddManifest(string manifestPath, string relativePath); 56 57 /// <summary> 58 /// Updates manifest in the index. 59 /// </summary> 60 /// <param name="manifestPath">Path to manifest to modify.</param> 61 /// <param name="relativePath">Path of the manifest in the repository.</param> 62 /// <returns>True if index was modified.</returns> 63 bool UpdateManifest(string manifestPath, string relativePath); 64 65 /// <summary> 66 /// Adds or Updates manifest in the index. 67 /// </summary> 68 /// <param name="manifestPath">Path to manifest.</param> 69 /// <param name="relativePath">Path of the manifest in the repository.</param> 70 /// <returns>True if added; false if updated.</returns> 71 bool AddOrUpdateManifest(string manifestPath, string relativePath); 72 73 /// <summary> 74 /// Delete manifest from index. 75 /// </summary> 76 /// <param name="manifestPath">Path to manifest to modify.</param> 77 /// <param name="relativePath">Path of the manifest in the repository.</param> 78 void RemoveManifest(string manifestPath, string relativePath); 79 80 /// <summary> 81 /// Wrapper for WinGetSQLiteIndexPrepareForPackaging. 82 /// </summary> 83 void PrepareForPackaging(); 84 85 /// <summary> 86 /// Checks the index for consistency, ensuring that at a minimum all referenced rows actually exist. 87 /// </summary> 88 /// <returns>Is index consistent.</returns> 89 bool IsIndexConsistent(); 90 91 /// <summary> 92 /// Gets the managed index handle. It is used in additional manifest validation that requires an index. 93 /// </summary> 94 /// <returns>The managed index handle.</returns> 95 IntPtr GetIndexHandle(); 96 } 97 }