mirror of
https://github.com/kopia/kopia.git
synced 2026-05-09 23:33:22 -04:00
Move general functionality from the `content verify` CLI command implementation to helpers in the content package. The primary motivation is to allow reusing the content verification functionality during maintenance. A separate followup change also extends content verification to include additional stats useful for debugging repository corruptions. Overview of the changes: - Relocation of the content verification functionality to the content package. The entry point is content.WriteManager.VerifyContents. This is primarily code movement with no functional changes. - Addition of unit tests for the content verification functionality by exercising content.WriteManager.VerifyContents. - Minor functional change: changing the logging level from Error to Warn for the "inner loop" error messages. This allows filtering out these messages if needed, while still observing the error message that is logged for the overall operation.
25 lines
942 B
Go
25 lines
942 B
Go
package content
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/kopia/kopia/internal/epoch"
|
|
"github.com/kopia/kopia/repo/format"
|
|
)
|
|
|
|
// Reader defines content read API.
|
|
type Reader interface {
|
|
// returns true if the repository supports content compression.
|
|
// this may be slightly stale if the repository recently
|
|
// got upgraded, in which case it will return false which is safe.
|
|
SupportsContentCompression() bool
|
|
ContentFormat() format.Provider
|
|
GetContent(ctx context.Context, id ID) ([]byte, error)
|
|
ContentInfo(ctx context.Context, id ID) (Info, error)
|
|
IterateContents(ctx context.Context, opts IterateOptions, callback IterateCallback) error
|
|
IteratePacks(ctx context.Context, opts IteratePackOptions, callback IteratePacksCallback) error
|
|
ListActiveSessions(ctx context.Context) (map[SessionID]*SessionInfo, error)
|
|
EpochManager(ctx context.Context) (*epoch.Manager, bool, error)
|
|
VerifyContents(ctx context.Context, o VerifyOptions) error
|
|
}
|