using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using StellaOps.Vexer.Core; namespace StellaOps.Vexer.Storage.Mongo; public interface IVexProviderStore { ValueTask FindAsync(string id, CancellationToken cancellationToken); ValueTask> ListAsync(CancellationToken cancellationToken); ValueTask SaveAsync(VexProvider provider, CancellationToken cancellationToken); } public interface IVexConsensusStore { ValueTask FindAsync(string vulnerabilityId, string productKey, CancellationToken cancellationToken); ValueTask> FindByVulnerabilityAsync(string vulnerabilityId, CancellationToken cancellationToken); ValueTask SaveAsync(VexConsensus consensus, CancellationToken cancellationToken); } public sealed record VexConnectorState( string ConnectorId, DateTimeOffset? LastUpdated, ImmutableArray DocumentDigests); public interface IVexConnectorStateRepository { ValueTask GetAsync(string connectorId, CancellationToken cancellationToken); ValueTask SaveAsync(VexConnectorState state, CancellationToken cancellationToken); } public interface IVexCacheIndex { ValueTask FindAsync(VexQuerySignature signature, VexExportFormat format, CancellationToken cancellationToken); ValueTask SaveAsync(VexCacheEntry entry, CancellationToken cancellationToken); ValueTask RemoveAsync(VexQuerySignature signature, VexExportFormat format, CancellationToken cancellationToken); } public interface IVexCacheMaintenance { ValueTask RemoveExpiredAsync(DateTimeOffset asOf, CancellationToken cancellationToken); ValueTask RemoveMissingManifestReferencesAsync(CancellationToken cancellationToken); }