shared

package
v0.1.41 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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountExcludedInSubtree

func CountExcludedInSubtree(database *db.DB, queueType string, rootPath string) (int, error)

CountExcludedInSubtree counts excluded nodes within the subtree at rootPath (single SQL query).

func CountExcludedNodes

func CountExcludedNodes(database *db.DB, queueType string) (int, error)

CountExcludedNodes counts all excluded nodes in the table (excluded = true).

func CountPendingNodes

func CountPendingNodes(database *db.DB, queueType string) (int, error)

CountPendingNodes counts all pending nodes across all levels for a queue type (from stats table).

func CountSubtree

func CountSubtree(database *db.DB, queueType string, rootPath string) (db.SubtreeStats, error)

CountSubtree returns aggregate counts for the subtree at rootPath using a single SQL query (path prefix). Uses db.CountSubtree.

func DeleteSubtree

func DeleteSubtree(database *db.DB, queueType string, rootPath string) error

DeleteSubtree deletes all nodes in the subtree at rootPath and recomputes stats for affected depths. Uses Writer.DeleteSubtree.

func GetTopLevelChildren

func GetTopLevelChildren(database *db.DB, queueType string, rootPath string) ([]*db.NodeState, error)

GetTopLevelChildren returns direct children of the node at rootPath (by parent_path = rootPath).

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 MarkNodeAsExcluded

func MarkNodeAsExcluded(database *db.DB, queueType string, nodePath string) error

MarkNodeAsExcluded marks a node as excluded in the database (direct live-table update).

func MarkNodeAsFailed

func MarkNodeAsFailed(database *db.DB, queueType string, nodePath string) error

MarkNodeAsFailed marks a node as failed in the database (direct live-table update + stats recompute).

func MarkNodeAsPending

func MarkNodeAsPending(database *db.DB, queueType string, nodePath string) error

MarkNodeAsPending marks a node as pending in the database (direct live-table update + stats recompute).

func MarkNodeAsUnexcluded

func MarkNodeAsUnexcluded(database *db.DB, queueType string, nodePath string) error

MarkNodeAsUnexcluded marks a node as not excluded in the database (direct live-table update).

func PickFirstExcludedTopLevelChild

func PickFirstExcludedTopLevelChild(database *db.DB, queueType string, rootPath string) (*db.NodeState, error)

PickFirstExcludedTopLevelChild picks the first top-level child that is currently excluded. Only selects folders (not files) that are excluded. Useful for deterministic tests.

func PickRandomExcludedTopLevelChild

func PickRandomExcludedTopLevelChild(database *db.DB, queueType string, rootPath string) (*db.NodeState, error)

PickRandomExcludedTopLevelChild picks a random top-level child that is currently excluded. Only selects folders (not files) that are excluded.

func PickRandomTopLevelChild

func PickRandomTopLevelChild(database *db.DB, queueType string, rootPath string) (*db.NodeState, error)

PickRandomTopLevelChild picks a random top-level child from the root. Only selects folders (not files).

func PrintVerification

func PrintVerification(result migration.Result)

PrintVerification prints the verification results in a formatted way.

func SetupEphemeralTest

func SetupEphemeralTest(removeMigrationDB bool) (migration.Config, error)

SetupEphemeralTest assembles the Spectra-backed migration configuration using ephemeral mode. Ephemeral mode doesn't persist data to a database, so no Spectra DB cleanup is needed. removeMigrationDB controls whether to remove the migration database (use false for resumption tests).

func SetupLocalTest

func SetupLocalTest(srcPath, dstPath string, removeMigrationDB bool) (migration.Config, error)

SetupLocalTest assembles a local filesystem-backed migration configuration. srcPath and dstPath are absolute paths to the source and destination directories. removeMigrationDB controls whether to remove the migration database (use false for resumption tests).

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 SetupTest

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

SetupTest assembles the Spectra-backed migration configuration. cleanSpectraDB controls whether to delete the existing Spectra DB (use false for resumption tests). removeMigrationDB controls whether to remove the migration database (use false for resumption tests).

Types

This section is empty.

Jump to

Keyboard shortcuts

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