import { Logger } from "../utils/logger.cjs"; //#region src/types/options.d.ts /** * Statistics tracking for IAVL operations. * Based on Go IAVL v1.3.5 options.go Statistics struct. */ interface Statistics { /** Each time GetNode operation hit cache */ cacheHitCnt: number; /** Each time GetNode operation miss cache */ cacheMissCnt: number; /** Each time GetFastNode operation hit cache */ fastCacheHitCnt: number; /** Each time GetFastNode operation miss cache */ fastCacheMissCnt: number; } /** * Creates a new statistics object with all counters at zero. */ declare function createStatistics(): Statistics; /** * Options for configuring an IAVL tree. */ interface Options { /** * Whether to fsync writes to disk. * Default: false */ sync?: boolean; /** * Initial version number for new trees. * Default: 0 */ initialVersion?: number; /** * Threshold in bytes for flushing batch writes. * When accumulated writes exceed this size, they are committed. * Default: 100000 (100KB) */ flushThreshold?: number; /** * Whether to enable asynchronous pruning of old versions. * Default: false */ asyncPruning?: boolean; /** * Maximum number of nodes to cache in memory (LRU). * Default: 10000 */ cacheSize?: number; /** * Maximum number of fast nodes to cache in memory (LRU). * Fast nodes store the latest key-value state. * Default: 100000 */ fastCacheSize?: number; /** * Whether to skip fast storage upgrade when loading existing trees. * Default: false */ skipFastStorageUpgrade?: boolean; /** * Logger instance for IAVL operations. * If not provided, uses the default logger. */ logger?: Logger; /** * Statistics tracker for monitoring IAVL operations. * If provided, statistics will be collected. */ statistics?: Statistics; } /** * Default options for IAVL tree. * Matches Go's DefaultOptions() - only flushThreshold is set by default. * initialVersion is intentionally undefined (not set) to match Go behavior. */ declare const DEFAULT_OPTIONS: { readonly sync: false; readonly flushThreshold: 100000; readonly asyncPruning: false; readonly cacheSize: 10000; readonly fastCacheSize: 100000; readonly skipFastStorageUpgrade: false; }; /** * Merges user-provided options with defaults. * * @param options - User-provided options * @param defaultLogger - Default logger to use if none provided * @returns Complete options object with defaults filled in (except initialVersion which is optional) */ declare function mergeOptions(options?: Options, defaultLogger?: Logger): Required> & Pick; /** * Validates options and throws if invalid. * * @param options - Options to validate * @throws Error if options are invalid */ declare function validateOptions(options: Options): void; //#endregion export { DEFAULT_OPTIONS, Options, Statistics, createStatistics, mergeOptions, validateOptions }; //# sourceMappingURL=options.d.cts.map