repository: expose AssociatedBlobSet via repository interface

This commit is contained in:
Michael Eischer
2025-11-26 20:59:08 +01:00
parent 0f05277b47
commit 07d090f233
2 changed files with 28 additions and 0 deletions
+12
View File
@@ -2,6 +2,7 @@ package restic
import (
"context"
"iter"
"github.com/restic/restic/internal/backend"
"github.com/restic/restic/internal/crypto"
@@ -26,6 +27,7 @@ type Repository interface {
LookupBlob(t BlobType, id ID) []PackedBlob
LookupBlobSize(t BlobType, id ID) (size uint, exists bool)
NewAssociatedBlobSet() AssociatedBlobSet
// ListBlobs runs fn on all blobs known to the index. When the context is cancelled,
// the index iteration returns immediately with ctx.Err(). This blocks any modification of the index.
ListBlobs(ctx context.Context, fn func(PackedBlob)) error
@@ -186,3 +188,13 @@ type FindBlobSet interface {
Has(bh BlobHandle) bool
Insert(bh BlobHandle)
}
type AssociatedBlobSet interface {
Has(bh BlobHandle) bool
Insert(bh BlobHandle)
Delete(bh BlobHandle)
Len() int
Keys() iter.Seq[BlobHandle]
Intersect(other AssociatedBlobSet) AssociatedBlobSet
Sub(other AssociatedBlobSet) AssociatedBlobSet
}