47 lines
994 B
PHP
47 lines
994 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Ingest;
|
|
|
|
use App\Entity\DocumentVersion;
|
|
use App\Knowledge\ChunkManager;
|
|
use Symfony\Component\Uid\Uuid;
|
|
|
|
final readonly class ChunkWriteService
|
|
{
|
|
public function __construct(
|
|
private ChunkManager $chunkManager
|
|
)
|
|
{
|
|
}
|
|
|
|
public function countAllChunks(): int
|
|
{
|
|
return $this->chunkManager->countAllChunks();
|
|
}
|
|
|
|
public function compactByDocumentId(Uuid $documentId): void
|
|
{
|
|
$this->chunkManager->compactByDocument($documentId);
|
|
}
|
|
|
|
/**
|
|
* @param iterable<array<string,mixed>> $chunks
|
|
*/
|
|
public function appendChunks(iterable $chunks): void
|
|
{
|
|
$this->chunkManager->appendChunks($chunks);
|
|
}
|
|
|
|
/**
|
|
* Vollständiger Rewrite des NDJSON-Index (Global Reindex).
|
|
*
|
|
* @param iterable<array<string,mixed>> $allChunks
|
|
*/
|
|
public function rewriteAll(iterable $allChunks): void
|
|
{
|
|
$this->chunkManager->rewriteAll($allChunks);
|
|
}
|
|
|
|
} |