/** * Block sizes in the Owner Free Filesystem (OFF) are carefully chosen powers of 2 * that balance several key factors: * 1. Storage efficiency * 2. Memory usage * 3. XOR operation performance * 4. Network transfer efficiency * * Block Size Selection: * - Smaller blocks (512B - 4KB): Better for small files, less padding waste * - Medium blocks (1MB): Good balance for typical files * - Large blocks (64MB - 256MB): Better for large files, more efficient storage */ import { BrightChainStringKey } from './brightChainStrings'; /** * Block size exponents (2^x) for calculating block sizes. * These are chosen to provide a good range of sizes while maintaining * power-of-2 alignment for efficient operations. */ export declare const blockSizeExponents: readonly [9, 10, 12, 20, 26, 28]; /** * Actual block sizes in bytes, calculated from the exponents. * Each size is optimized for different use cases and storage patterns. */ export declare const blockSizeLengths: readonly [number, number, number, number, number, number]; /** * Block size enumeration defining standard block sizes in OFF. * Each size is optimized for specific use cases and provides different * trade-offs between storage efficiency and performance. */ export declare enum BlockSize { /** * Invalid or unknown block size. * Used for error conditions and initialization. */ Unknown = 0, /** * Message size (512B) * Optimal for: * 1. Small messages * 2. Configuration data * 3. Metadata storage */ Message, /** * Tiny size (1KB) * Optimal for: * 1. Small files * 2. Configuration files * 3. Quick operations */ Tiny, /** * Small size (4KB) * Optimal for: * 1. Small to medium files * 2. System page size alignment * 3. Efficient disk I/O */ Small, /** * Medium size (1MB) * Optimal for: * 1. Medium-sized files * 2. Balanced performance * 3. Common file sizes */ Medium, /** * Large size (64MB) * Optimal for: * 1. Large files * 2. Streaming operations * 3. High throughput */ Large, /** * Huge size (256MB) * Optimal for: * 1. Very large files * 2. Maximum throughput * 3. Minimal overhead */ Huge } /** * List of valid block sizes for validation and iteration. * Excludes Unknown size as it's not valid for actual use. */ export declare const validBlockSizes: readonly BlockSize[]; /** * Human-readable names for block sizes. * Used for display and logging purposes. */ export declare const blockSizeStringNames: Record; /** * Map of block sizes to their metadata. * Provides quick access to size information and names. */ export declare const BlockSizeInfo: { [key in BlockSize]: { blockSize: BlockSize; length: number; name: string; }; }; /** * Validate if a length matches a valid block size. * @param length - The length to validate * @param allowNonStandard - Whether to allow non-standard block sizes (for testing) * @returns True if the length is a valid block size */ export declare function validateBlockSize(length: number, allowNonStandard?: boolean): boolean; /** * Convert a byte length to its BlockSize enum value. * @param length - The length in bytes * @param allowNonStandard - Whether to allow non-standard block sizes (for testing) * @returns The corresponding BlockSize enum value * @throws InvalidBlockSizeLengthError if the length doesn't match a valid block size */ export declare function lengthToBlockSize(length: number, allowNonStandard?: boolean): BlockSize; /** * Convert a byte length to the closest BlockSize enum value. * @param length - The length in bytes * @returns The closest BlockSize enum value */ export declare function lengthToClosestBlockSize(length: number): BlockSize; /** * Convert a BlockSize enum value to its string representation. * @param blockSize - The BlockSize enum value * @returns The human-readable name of the block size * @throws Error if the block size is invalid */ export declare function blockSizeToSizeString(blockSize: BlockSize): string; //# sourceMappingURL=blockSize.d.ts.map