import type { CpOptions, MkdirOptions, SqlClient } from "../../types.js"; import { type MarkdownChunk } from "../../chunking.js"; import type { InternalEntryShape } from "../internals/entry-shapes.js"; import { FsVisibilityBase } from "./visibility.js"; export declare class FsWriteOpsBase extends FsVisibilityBase { protected validateFileSize(content: string | Uint8Array): void; protected validateNodeCount(tx: SqlClient): Promise; protected validatePathDepth(path: string): void; protected validateWorkspaceBytes(tx: SqlClient, hash: Uint8Array, sizeBytes: number, userPath: string): Promise; protected upsertEntry(tx: SqlClient, versionId: number, posixPath: string, nodeType: string, blobHash: Uint8Array | null, sizeBytes: number, mode: number, symlinkTarget: string | null): Promise; protected writeTombstone(tx: SqlClient, versionId: number, posixPath: string): Promise; protected writeTombstonesForVisibleSubtree(tx: SqlClient, versionId: number, rootPosix: string, includeRoot: boolean): Promise; protected copyVisibleSubtreeEntries(tx: SqlClient, versionId: number, srcPosix: string, destPosix: string, includeRoot: boolean): Promise; protected countVisibleSubtreeNodes(tx: SqlClient, versionId: number, rootPosix: string): Promise<{ total: number; files: number; }>; /** * Apply a pre-fetched entry shape to the destination version's `fs_entries`. * Used by batch operations (merge, cherry-pick, revert, detach) to copy * within the same workspace without rehashing content. A `null` shape writes * a tombstone. */ protected writeEntryShape(tx: SqlClient, versionId: number, posixPath: string, shape: InternalEntryShape | null): Promise; protected writeEntryShapes(tx: SqlClient, versionId: number, writes: Array<{ internalPath: string; shape: InternalEntryShape | null; }>): Promise; protected internalWriteFile(tx: SqlClient, versionId: number, path: string, content: string | Uint8Array, parentKnownMissing?: boolean): Promise; /** * Maintain the chunk-level index for a just-written blob. Chunks key off * the blob hash, so an unchanged rewrite (or the same content at another * path) costs a single existence probe. Runs in the write's transaction: * a failed write never leaves chunks behind, and the fs_blobs row the FK * needs is already in place. */ protected maybeChunk(tx: SqlClient, hash: Uint8Array, content: string | Uint8Array): Promise; /** * Turn Postgres's "relation does not exist" for `fs_blob_chunks` into the * migration story. The table ships with newer `setup()` runs; a database * migrated by an older bash-gres doesn't have it, and the chunking feature * fails fast with instructions rather than a bare SQL error. Databases * that never enable `chunking` are untouched — the table is only queried * when the feature (or one of its explicit APIs) is used. */ protected rethrowMissingChunkTable(e: unknown): never; /** Batched insert of one blob's chunk rows (no-op on an empty set). */ protected insertChunkRows(tx: SqlClient, hash: Uint8Array, chunks: MarkdownChunk[]): Promise; protected tryFastWriteFile(path: string, content: string | Uint8Array): Promise<{ status: string; inserted: boolean | null; } | null>; /** * Run the fused validation+blob+entry upsert and return the status without * throwing. Manages the optimistic node-count cache: increments before the * write, decrements on validation failure, on overwrite (xmax != 0), or * on SQL error. Caller is responsible for translating a non-'ok' status * into an `FsError`. */ private attemptFusedWrite; private internalMkdirForWriteParent; private decrementCachedNodeCount; private tryOptimisticNodeCountIncrement; /** Embed a single text through the batch `embed` option and validate it. */ protected embedOne(text: string): Promise; protected internalMkdir(tx: SqlClient, versionId: number, path: string, options?: MkdirOptions): Promise; protected internalCp(tx: SqlClient, versionId: number, src: string, dest: string, options?: CpOptions, counter?: { count: number; }): Promise; } //# sourceMappingURL=write-ops.d.ts.map