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 3f6785bcc0
commit 370f3c55fa
9 changed files with 210 additions and 7 deletions
+20
View File
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
// SPDX-FileCopyrightText: 2026 Dillard Blom
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace OCA\NgBackup\Repository;
/** Optional local cache of pack index entries (the repository's index/ files stay authoritative). */
interface IIndexCache {
/** @return array<string, list<array{id:string, offset:int, length:int, raw:int, flags:int}>> packId => entries */
public function all(string $repositoryId): array;
/** @param list<array{id:string, offset:int, length:int, raw:int, flags:int}> $entries */
public function put(string $repositoryId, string $packId, array $entries): void;
/** @param list<string> $packIds */
public function remove(string $repositoryId, array $packIds): void;
}