verify

package
v1.10.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyFileDeepWithContainersDir added in v0.8.0

func VerifyFileDeepWithContainersDir(dbconn *sql.DB, fileId int, containersDir string) error

func VerifyFileFullWithContainersDir added in v0.8.0

func VerifyFileFullWithContainersDir(dbconn *sql.DB, fileId int, containersDir string) error

func VerifyFileStandardWithContainersDir added in v0.8.0

func VerifyFileStandardWithContainersDir(dbconn *sql.DB, fileId int, containersDir string) error

func VerifyRepository added in v1.8.0

func VerifyRepository(dbconn *sql.DB, containersDir string) error

VerifyRepository provides layered verification orchestration for repositories that may include v1.8 packed-block storage.

Layer order:

  1. metadata integrity (chunk reachability)
  2. physical block integrity (storage_blocks + chunk_block_refs)
  3. decoded block integrity (payload hash and codec validation)
  4. chunk slice integrity (chunk-to-block slice validation)
  5. legacy compatibility checks

func VerifyRepositoryFast added in v1.8.0

func VerifyRepositoryFast(dbconn *sql.DB, containersDir string) error

VerifyRepositoryFast runs the lightweight repository checks. Fast mode is intended for quick operational health checks: metadata graph + packed block hash integrity.

func VerifySystemDeepWithContainersDir added in v0.8.0

func VerifySystemDeepWithContainersDir(dbconn *sql.DB, containersDir string) error

func VerifySystemFastWithContainersDir added in v1.8.0

func VerifySystemFastWithContainersDir(dbconn *sql.DB, containersDir string) error

func VerifySystemFullWithContainersDir added in v0.8.0

func VerifySystemFullWithContainersDir(dbconn *sql.DB, containersDir string) error

func VerifySystemStandardWithContainersDir added in v0.8.0

func VerifySystemStandardWithContainersDir(dbconn *sql.DB, containersDir string) error

Types

type BlockStorageMetadata added in v1.9.0

type BlockStorageMetadata struct {
	BlockID          int64
	ContainerID      int64
	ContainerOffset  int64
	ContainerName    string
	ContainerMaxSize int64

	FormatVersion    int64
	Codec            string
	PlaintextSize    int64
	CompressedSize   *int64
	StoredSize       int64
	CompressionCodec string
	CompressionLevel *int

	LogicalHash    []byte
	CompressedHash []byte
	PhysicalHash   []byte
}

BlockStorageMetadata carries the persisted block metadata required to verify and decode a packed storage block from container bytes.

type ChunkerVersionMetadataSummary added in v1.5.0

type ChunkerVersionMetadataSummary struct {
	EmptyLogicalFileVersions int64
	EmptyChunkVersions       int64
}

ChunkerVersionMetadataSummary captures repository-level version-metadata integrity. These checks are intentionally structural: read-side flows should reject missing metadata without depending on the current active chunker.

Semantics guardrail:

  • logical_file.chunker_version identifies recipe provenance metadata
  • chunk.chunker_version identifies chunk-origin metadata
  • neither field is used here to enforce cross-row equality constraints because deduplicated chunks may be referenced across version eras

func CheckChunkerVersionMetadataIntegrity added in v1.5.0

func CheckChunkerVersionMetadataIntegrity(dbconn *sql.DB) (ChunkerVersionMetadataSummary, error)

type ContainerReader added in v1.9.0

type ContainerReader interface {
	ReadStoredPayload(ctx context.Context, meta BlockStorageMetadata) ([]byte, error)
}

ContainerReader reads the persisted payload bytes for a block from storage.

type FilesystemContainerReader added in v1.9.0

type FilesystemContainerReader struct {
	ContainersDir string
}

FilesystemContainerReader loads container payload bytes from the local container directory.

func (FilesystemContainerReader) ReadStoredPayload added in v1.9.0

func (r FilesystemContainerReader) ReadStoredPayload(_ context.Context, meta BlockStorageMetadata) ([]byte, error)

ReadStoredPayload reads the exact stored payload bytes for one packed block.

type PhysicalFileIntegritySummary added in v1.2.0

type PhysicalFileIntegritySummary struct {
	OrphanPhysicalFileRows    int64
	LogicalRefCountMismatches int64
	NegativeLogicalRefCounts  int64
}

PhysicalFileIntegritySummary captures the current-state physical mapping invariants introduced in v1.2. This type is intentionally small and cheap to compute so standard verify can audit it on every run.

func CheckPhysicalFileGraphIntegrity added in v1.2.0

func CheckPhysicalFileGraphIntegrity(dbconn *sql.DB) (PhysicalFileIntegritySummary, error)

type SnapshotReachabilityIntegritySummary added in v1.3.0

type SnapshotReachabilityIntegritySummary struct {
	SnapshotFileRows               int64
	OrphanSnapshotPathRefs         int64
	DuplicateSnapshotPathPairs     int64
	SnapshotReferencedLogicalFiles int64
	SnapshotOnlyLogicalFiles       int64
	SharedLogicalFiles             int64
	OrphanSnapshotLogicalRefs      int64
	InvalidSnapshotLifecycleStates int64
	RetainedMissingChunkGraph      int64
}

SnapshotReachabilityIntegritySummary captures snapshot-specific retention consistency checks audited during verify.

func CheckSnapshotReachabilityIntegrity added in v1.3.0

func CheckSnapshotReachabilityIntegrity(dbconn *sql.DB) (SnapshotReachabilityIntegritySummary, error)

CheckSnapshotReachabilityIntegrity audits persisted snapshot metadata against logical-file lifecycle and retention expectations.

type VerifiedBlock added in v1.9.0

type VerifiedBlock struct {
	LogicalPayload []byte
	DecodedBlock   *blocks.EncodedBlock
	Metadata       BlockStorageMetadata
}

VerifiedBlock is the successful output of the staged block verification pipeline.

func VerifyStoredBlock added in v1.9.0

func VerifyStoredBlock(ctx context.Context, meta BlockStorageMetadata, reader ContainerReader) (*VerifiedBlock, error)

VerifyStoredBlock executes the packed-block verification pipeline in stage order and returns the decoded logical block on success.

type VerifyFailure added in v1.9.0

type VerifyFailure struct {
	Category     string
	Stage        VerifyStage
	BlockID      *int64
	ContainerID  *int64
	Offset       *int64
	ExpectedHash string
	ActualHash   string
	Detail       string
	Cause        error
}

func (*VerifyFailure) Error added in v1.9.0

func (v *VerifyFailure) Error() string

func (*VerifyFailure) Unwrap added in v1.9.0

func (v *VerifyFailure) Unwrap() error

type VerifyLevel

type VerifyLevel int
const (
	VerifyFast VerifyLevel = iota
	VerifyStandard
	VerifyFull
	VerifyDeep
)

type VerifyStage added in v1.9.0

type VerifyStage string
const (
	VerifyStagePhysicalPayload VerifyStage = "physical_payload"
	VerifyStageDecrypt         VerifyStage = "decrypt"
	VerifyStageCompressedHash  VerifyStage = "compressed_hash"
	VerifyStageDecompress      VerifyStage = "decompress"
	VerifyStageLogicalHash     VerifyStage = "logical_hash"
	VerifyStageBlockDecode     VerifyStage = "block_decode"
	VerifyStageChunkRefs       VerifyStage = "chunk_refs"
	VerifyStageSnapshots       VerifyStage = "snapshots"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL