fillOffsets method

void fillOffsets(
  1. FkafkaTopic topic
)

fill FkafkaPartition low and high offsets

Implementation

void fillOffsets(FkafkaTopic topic) {
  assert(topic.partitions != null && topic.partitions!.isNotEmpty);

  for (FkafkaPartition partition in topic.partitions!) {
    Pointer<Int64> low = malloc.allocate(sizeOf<Int64>());
    Pointer<Int64> high = malloc.allocate(sizeOf<Int64>());
    _bridges.rd_kafka_query_watermark_offsets(
        _pc._kafkaPtr,
        topic.name.toNativeUtf8(),
        partition.id,
        low,
        high,
        defaultTimeoutMs
    );

    // set result
    partition.low = low.value;
    partition.high = high.value;

    // release
    malloc.free(low);
    malloc.free(high);
  }
}