private Task <bool> GetResultAsync(ICatalogLeafItem leaf) { if (_lastCommitTimestamp.HasValue && _lastCommitTimestamp.Value != leaf.CommitTimestamp) { _commitCount++; // Simulate a failure every N commits to demonstrate how cursors and failures interact. if (_commitCount % FailAfterCommitCount == 0) { _logger.LogError( "{commitCount} catalog commits have been processed. We will now simulate a failure.", FailAfterCommitCount); return(Task.FromResult(false)); } } _lastCommitTimestamp = leaf.CommitTimestamp; return(Task.FromResult(true)); }
/// <summary> /// Parse the package version as a <see cref="NuGetVersion" />. /// </summary> /// <param name="leaf">The catalog leaf.</param> /// <returns>The package version.</returns> public static NuGetVersion ParsePackageVersion(this ICatalogLeafItem leaf) { return(NuGetVersion.Parse(leaf.PackageVersion)); }
/// <summary> /// Determines if the provided catalog leaf is contains package details. /// </summary> /// <param name="leaf">The catalog leaf.</param> /// <returns>True if the catalog leaf contains package details.</returns> public static bool IsPackageDetails(this ICatalogLeafItem leaf) { return(leaf.Type == CatalogLeafType.PackageDetails); }
/// <summary> /// Parse the package version as a <see cref="NuGetVersion" />. /// </summary> /// <param name="leaf">The catalog leaf.</param> /// <returns>The package version.</returns> private static NuGetVersion ParsePackageVersion(this ICatalogLeafItem leaf) => NuGetVersion.Parse(leaf.PackageVersion);