stabilizaiton work - projects rework for maintenanceability and ui livening

This commit is contained in:
master
2026-02-03 23:40:04 +02:00
parent 074ce117ba
commit 557feefdc3
3305 changed files with 186813 additions and 107843 deletions

View File

@@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace StellaOps.Provcache.Postgres;
public sealed partial class PostgresEvidenceChunkRepository
{
/// <inheritdoc />
public async Task StoreChunksAsync(
string proofRoot,
IEnumerable<EvidenceChunk> chunks,
CancellationToken cancellationToken = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(proofRoot);
ArgumentNullException.ThrowIfNull(chunks);
var chunkList = chunks.ToList();
if (chunkList.Count == 0)
{
_logger.LogDebug("No chunks to store for proof root {ProofRoot}", proofRoot);
return;
}
// Update proof root in chunks if not set
var entities = chunkList.Select(c => MapToEntity(c, proofRoot)).ToList();
_context.EvidenceChunks.AddRange(entities);
await _context.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
_logger.LogDebug("Stored {Count} chunks for proof root {ProofRoot}", chunkList.Count, proofRoot);
}
/// <inheritdoc />
public async Task<int> DeleteChunksAsync(
string proofRoot,
CancellationToken cancellationToken = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(proofRoot);
var deleted = await _context.EvidenceChunks
.Where(e => e.ProofRoot == proofRoot)
.ExecuteDeleteAsync(cancellationToken)
.ConfigureAwait(false);
_logger.LogDebug("Deleted {Count} chunks for proof root {ProofRoot}", deleted, proofRoot);
return deleted;
}
}