namespace StellaOps.Provcache;
///
/// Interface for lazy evidence chunk fetching from various sources.
/// Enables on-demand evidence retrieval for air-gapped auditors.
///
public interface ILazyEvidenceFetcher
{
///
/// Gets the fetcher type (e.g., "http", "file").
///
string FetcherType { get; }
///
/// Fetches a single chunk by index.
///
/// The proof root identifying the evidence.
/// The chunk index to fetch.
/// Cancellation token.
/// The fetched chunk or null if not found.
Task FetchChunkAsync(
string proofRoot,
int chunkIndex,
CancellationToken cancellationToken = default);
///
/// Fetches multiple chunks by index.
///
/// The proof root identifying the evidence.
/// The chunk indices to fetch.
/// Cancellation token.
/// Async enumerable of fetched chunks.
IAsyncEnumerable FetchChunksAsync(
string proofRoot,
IEnumerable chunkIndices,
CancellationToken cancellationToken = default);
///
/// Fetches all remaining chunks for a proof root.
///
/// The proof root identifying the evidence.
/// The chunk manifest for reference.
/// Indices of chunks already present locally.
/// Cancellation token.
/// Async enumerable of fetched chunks.
IAsyncEnumerable FetchRemainingChunksAsync(
string proofRoot,
ChunkManifest manifest,
IReadOnlySet existingIndices,
CancellationToken cancellationToken = default);
///
/// Checks if the source is available for fetching.
///
/// Cancellation token.
/// True if the source is available.
Task IsAvailableAsync(CancellationToken cancellationToken = default);
///
/// Gets the manifest from the source.
///
/// The proof root to get manifest for.
/// Cancellation token.
/// The chunk manifest or null if not available.
Task FetchManifestAsync(
string proofRoot,
CancellationToken cancellationToken = default);
}