encodingParams method
Get encoding parameters for a given shard count and blob size.
Implementation
WalrusEncodingParams encodingParams(int nShards, int blobLen) {
final outP = calloc<Uint32>(1);
final outS = calloc<Uint32>(1);
final outSS = calloc<Uint32>(1);
final outPriSize = calloc<Uint64>(1);
final outSecSize = calloc<Uint64>(1);
try {
final ret = _encodingParams(
nShards,
blobLen,
outP,
outS,
outSS,
outPriSize,
outSecSize,
);
if (ret != 0) {
throw WalrusFfiException(
'walrus_encoding_params failed with code $ret',
);
}
return WalrusEncodingParams(
primarySymbols: outP.value,
secondarySymbols: outS.value,
symbolSize: outSS.value,
primarySliverSize: outPriSize.value,
secondarySliverSize: outSecSize.value,
);
} finally {
calloc.free(outP);
calloc.free(outS);
calloc.free(outSS);
calloc.free(outPriSize);
calloc.free(outSecSize);
}
}