/** * NOTE: In some places, this file uses `snake_case` for field names. * This deviates from the normal camelCase convention, but is intentional to match external specs/protocols. */ /** * Erasure coding schemes supported by Shelby. */ declare enum ErasureCodingScheme { ClayCode_16Total_10Data_13Helper = "ClayCode_16Total_10Data_13Helper", ClayCode_4Total_2Data_3Helper = "ClayCode_4Total_2Data_3Helper" } /** * Union of all supported erasure coding parameter types. * When new erasure schemes are added, union them to this type. */ type ErasureSchemeParams = (typeof ERASURE_CODE_PARAMS)["ClayCode_16Total_10Data_13Helper"] | (typeof ERASURE_CODE_PARAMS)["ClayCode_4Total_2Data_3Helper"]; type ErasureCodeParams = Record; /** * Parameters for each supported erasure coding scheme. * * - `erasure_n`: Total number of chunks (data + parity) * - `erasure_k`: Number of data chunks required to reconstruct original data * - `erasure_d`: Number of helper nodes */ declare const ERASURE_CODE_PARAMS: { readonly ClayCode_16Total_10Data_13Helper: { readonly erasure_n: 16; readonly erasure_k: 10; readonly erasure_d: 13; readonly enumIndex: 0; }; readonly ClayCode_4Total_2Data_3Helper: { readonly erasure_n: 4; readonly erasure_k: 2; readonly erasure_d: 3; readonly enumIndex: 1; }; }; /** * Look up an erasure coding scheme by its total-chunk count (`erasure_n`). * Returns the `[scheme, params]` entry, or `undefined` if no scheme matches. * Shared by callers that need to recover a scheme's `erasure_k`/`erasure_d` * (or its key for {@link ERASURE_CODE_AND_CHUNK_MAPPING}) from `erasure_n` * alone, so the lookup stays in one place as schemes are added. */ declare function findErasureSchemeByErasureN(erasureN: number): [ErasureCodingScheme, ErasureSchemeParams] | undefined; /** * Number of storage-provider acknowledgements required to finalize a blob on * chain: the erasure scheme's helper-node count (`erasure_d`), recovered from * the scheme's total-chunk count (`erasure_n`). Throws if `erasureN` matches no * known scheme. */ declare function requiredAckCount(erasureN: number): number; /** * The total number of chunks (data + parity) in the erasure coding scheme. */ declare const DEFAULT_ERASURE_N: 16; /** * The number of data chunks in the erasure coding scheme. */ declare const DEFAULT_ERASURE_K: 10; /** * The number of helper nodes in the erasure coding scheme. */ declare const DEFAULT_ERASURE_D: 13; /** * The number of parity chunks in the erasure coding scheme (derived as n - k). */ declare const DEFAULT_ERASURE_M: number; /** * The size of a sample in a Chunk. */ declare const DEFAULT_SAMPLE_SIZE = 1024; export { DEFAULT_ERASURE_D, DEFAULT_ERASURE_K, DEFAULT_ERASURE_M, DEFAULT_ERASURE_N, DEFAULT_SAMPLE_SIZE, ERASURE_CODE_PARAMS, type ErasureCodeParams, ErasureCodingScheme, type ErasureSchemeParams, findErasureSchemeByErasureN, requiredAckCount };