using StellaOps.Scheduler.Models;
namespace StellaOps.Scheduler.ImpactIndex;
///
/// Provides read access to the scheduler impact index.
///
public interface IImpactIndex
{
///
/// Resolves the impacted image set for the provided package URLs.
///
/// Package URLs to look up.
/// When true, restricts results to components marked as runtime/entrypoint usage.
/// Selector scoping the query.
/// Cancellation token.
ValueTask ResolveByPurlsAsync(
IEnumerable purls,
bool usageOnly,
Selector selector,
CancellationToken cancellationToken = default);
///
/// Resolves impacted images by vulnerability identifiers if the index has the mapping available.
///
/// Vulnerability identifiers to look up.
/// When true, restricts results to components marked as runtime/entrypoint usage.
/// Selector scoping the query.
/// Cancellation token.
ValueTask ResolveByVulnerabilitiesAsync(
IEnumerable vulnerabilityIds,
bool usageOnly,
Selector selector,
CancellationToken cancellationToken = default);
///
/// Resolves all tracked images for the provided selector.
///
/// Selector scoping the query.
/// When true, restricts results to images with entrypoint usage.
/// Cancellation token.
ValueTask ResolveAllAsync(
Selector selector,
bool usageOnly,
CancellationToken cancellationToken = default);
///
/// Removes an image digest and its component mappings from the index.
/// Used when an image is deleted or aged out.
///
ValueTask RemoveAsync(
string imageDigest,
CancellationToken cancellationToken = default);
///
/// Creates a compacted snapshot of the index for persistence (e.g., RocksDB/Redis).
///
ValueTask CreateSnapshotAsync(
CancellationToken cancellationToken = default);
///
/// Restores index state from a previously persisted snapshot.
///
ValueTask RestoreSnapshotAsync(
ImpactIndexSnapshot snapshot,
CancellationToken cancellationToken = default);
}