shared

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: LGPL-2.1 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InspectCopyBuckets

func InspectCopyBuckets(dbPath string) error

InspectCopyBuckets opens the database and prints the first 10 items from each copy status bucket for each level. If a bucket doesn't exist, it prints that information.

func LoadSpectraRoots

func LoadSpectraRoots(spectraFS *sdk.SpectraFS) (types.Folder, types.Folder, error)

LoadSpectraRoots fetches the Spectra root nodes and maps them to types.Folder structures.

func PrintCopyVerification

func PrintCopyVerification(stats queue.QueueStats)

PrintCopyVerification prints the copy phase statistics in a formatted way.

func RunInspectCopyBuckets

func RunInspectCopyBuckets()

RunInspectCopyBuckets is a main function that can be called from a test or standalone

func SetupCopyTest

func SetupCopyTest(cleanSpectraDB bool, removeMigrationDB bool) (*db.DB, types.FSAdapter, types.FSAdapter, error)

SetupCopyTest sets up the database and adapters for copy phase testing. cleanSpectraDB controls whether to delete the existing Spectra DB (use false for copy tests). removeMigrationDB controls whether to remove the migration database (use false to use pre-provisioned DB). Returns the database instance, source adapter, destination adapter, and error.

func SetupCopyTestConfig

func SetupCopyTestConfig(cleanSpectraDB bool, removeMigrationDB bool) (migration.Config, error)

SetupCopyTestConfig returns a full migration.Config for the copy test (Spectra roots, DB at copy/shared/main_test.db). Use with migration.LetsMigrate to run traversal and produce a DuckDB ready for copy-phase tests. cleanSpectraDB: false to keep existing Spectra DB. removeMigrationDB: true to create a fresh migration DB.

func SetupLocalCopyTest

func SetupLocalCopyTest(srcPath, dstPath string, removeMigrationDB bool) (*db.DB, types.FSAdapter, types.FSAdapter, error)

SetupLocalCopyTest sets up the database and adapters for local filesystem copy phase testing. srcPath and dstPath are absolute paths to the source and destination directories. removeMigrationDB controls whether to remove the migration database (use true for fresh test). Returns the DuckDB instance, source adapter, destination adapter, and error.

func SetupSpectraFS

func SetupSpectraFS(configPath string, cleanDB bool) (*sdk.SpectraFS, error)

SetupSpectraFS creates a SpectraFS instance, handling DB cleanup appropriately. Since each test run is a separate process, we can't rely on in-memory state. Instead, we check if the DB file exists (from the config) and only clean it if explicitly requested. The SDK should load existing data from the DB file if it exists. The configPath should point to a JSON config file that contains the db_path.

func VerifyCopyCompletion

func VerifyCopyCompletion(database *db.DB) error

VerifyCopyCompletion verifies that all copy status buckets are in expected state. Uses stats bucket for O(1) lookups instead of O(N) scans. Checks that no pending copy tasks remain and reports successful/failed counts.

Types

This section is empty.

Jump to

Keyboard shortcuts

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