/** * Copyright (c) 2025 Elara AI Pty Ltd * Licensed under BSL 1.1. See LICENSE for details. */ import { type Structure, type VersionVector, type DatasetRef } from '@elaraai/e3-types'; import type { StorageBackend } from './storage/interfaces.js'; /** * Check version vector consistency across a set of input vectors. * * All vectors must agree on shared keys (same root input path must have * the same hash in every vector that contains it). This ensures that * a task's inputs are all derived from the same snapshot of each root input. * * @param inputVectors - Version vectors from each task input * @returns Consistency result: either consistent (with merged vector) or inconsistent (with conflict path) */ export declare function checkVersionConsistency(inputVectors: VersionVector[]): { consistent: true; merged: VersionVector; } | { consistent: false; conflictPath: string; }; /** * Merge consistent version vectors (union of all keys). * * Assumes all vectors are consistent (no conflicting hashes for shared keys). * Use checkVersionConsistency first if consistency is not guaranteed. * * @param vectors - Version vectors to merge * @returns Merged version vector */ export declare function mergeVersionVectors(vectors: VersionVector[]): VersionVector; /** * Build a version vector for a root input dataset. * * Root inputs reference only themselves in their version vector. * * @param path - The keypath string of the input dataset (e.g., ".inputs.sales") * @param hash - The content hash of the input value * @returns A version vector with a single entry */ export declare function inputVersionVector(path: string, hash: string): VersionVector; /** * Convert a TreePath-style keypath (e.g., ".inputs.sales") to a filesystem-style * dataset ref path (e.g., "inputs/sales") for use with DatasetRefStore. */ export declare function keypathToRefPath(keypath: string): string; /** * Convert a filesystem-style dataset ref path (e.g., "inputs/sales") to a * TreePath-style keypath (e.g., ".inputs.sales"). */ export declare function refPathToKeypath(refPath: string): string; /** * Snapshot all root input version vectors from refs. * * Root inputs are datasets not produced by any task (i.e., their path * is NOT in the taskOutputPaths set). * * @param storage - Storage backend * @param repo - Repository identifier * @param ws - Workspace name * @param structure - The workspace's data structure * @param taskOutputPaths - Set of keypath strings that are task outputs * @returns Map of keypath -> content hash for all assigned root input datasets */ export declare function snapshotInputVersions(storage: StorageBackend, repo: string, ws: string, structure: Structure, taskOutputPaths: Set): Promise>; /** * Detect which inputs changed since a previous snapshot. * * @param storage - Storage backend * @param repo - Repository identifier * @param ws - Workspace name * @param previousSnapshot - Previous snapshot from snapshotInputVersions * @param structure - The workspace's data structure * @param taskOutputPaths - Set of keypath strings that are task outputs * @returns Array of changed inputs with previous and new hashes */ export declare function detectInputChanges(storage: StorageBackend, repo: string, ws: string, previousSnapshot: Map, structure: Structure, taskOutputPaths: Set): Promise>; /** * Build tree objects from per-dataset refs on demand, returning the root hash. * * This reconstructs the traditional tree object hierarchy from the flat * per-dataset ref files. Used for compatibility with existing code that * expects a root hash (e.g., DataflowRun snapshots, workspace export). * * @param storage - Storage backend * @param repo - Repository identifier * @param ws - Workspace name * @param structure - The workspace's data structure * @returns The root tree hash */ export declare function computeRootHash(storage: StorageBackend, repo: string, ws: string, structure: Structure): Promise; /** * Walk a structure and write DatasetRef files for each leaf dataset. * * Used during deploy to initialize refs from a package's tree objects. * * @param storage - Storage backend * @param repo - Repository identifier * @param ws - Workspace name * @param structure - The structure to walk * @param rootHash - The root tree hash from the package */ export declare function writeRefsFromTree(storage: StorageBackend, repo: string, ws: string, structure: Structure, rootHash: string): Promise; /** * Initialize per-dataset ref files from a package's inline refs map. * * Used during deploy to copy per-dataset refs from the package into * the workspace. Walks the structure and writes refs from the package's * refs map, falling back to unassigned for any missing entries. * * @param storage - Storage backend * @param repo - Repository identifier * @param ws - Workspace name * @param structure - The package's data structure * @param refs - Map of refPath to DatasetRef from the package */ export declare function writeRefsFromPackage(storage: StorageBackend, repo: string, ws: string, structure: Structure, refs: Map): Promise; //# sourceMappingURL=dataset-refs.d.ts.map