M2: local cache of pack indexes (ngb_index)

Opening a repository lists index/ once and downloads only index files
that are not cached; packs written by this server are cached on write,
stale cache rows are dropped. Each resumable step therefore no longer
downloads every index file from the location.
This commit is contained in:
2026-10-02 00:55:46 +02:00
parent 446e317786
commit 05e2c9fe45
9 changed files with 210 additions and 7 deletions
+2 -1
View File
@@ -28,6 +28,7 @@ class TargetService {
private KeyService $keys,
private ICrypto $crypto,
private IAppManager $appManager,
private \OCA\NgBackup\Db\DbIndexCache $indexCache,
) {
}
@@ -98,7 +99,7 @@ class TargetService {
}
public function repository(Target $target): Repository {
$repo = Repository::openWithKey($this->backend($target), $this->keys->keyRing());
$repo = Repository::openWithKey($this->backend($target), $this->keys->keyRing(), $this->indexCache);
if ($target->getRepositoryId() !== null && $repo->id() !== $target->getRepositoryId()) {
throw new \RuntimeException('The target now contains a different repository than when it was added');
}