Publish actual part lengths and expose rejected batch status

This commit is contained in:
evgeny committed 2026-10-13 20:07:02 +02:00
1 parent baf3eb62ba
commit ff847423e8
2 files changed
+20 -12

No files matched your search

+7 -4
View File
@@ -48,10 +48,12 @@ static int source_flush(struct stream_source *source) {
}
uint8_t flags = source->has_batch && now_ms - source->last_batch_ms >= STREAM_TIMESTAMP_PERIOD_MS ? STREAM_BLOCK_TIME_RESET : 0;
const uint8_t *blocks[RS_MAX_BLOCKS];
int result = stream_encoder_encode(source->encoder, source->next_seq, (uint16_t)now_ms, flags, source->input, source->used, blocks);
size_t block_length = 0;
int result = stream_encoder_encode(source->encoder, source->next_seq, (uint16_t)now_ms, flags,
source->input, source->used, blocks, &block_length);
if (result != STREAM_OK) return source_fail(source, result);
for (unsigned i = 0; i < source->descriptor.n; i++) {
result = stream_buffer_put(source->buffer, blocks[i], stream_block_size(&source->descriptor));
result = stream_buffer_put(source->buffer, blocks[i], block_length);
if (result != STREAM_OK) return source_fail(source, result < 0 ? result : STREAM_ERR_STATE);
}
uint64_t seq = source->next_seq++;
@@ -60,9 +62,10 @@ static int source_flush(struct stream_source *source) {
source->has_batch = 1;
source->last_batch_ms = now_ms;
if (!source->report_ms || now_ms - source->report_ms >= 1000) {
DEBUG_DEBUG(DEBUG_CATEGORY_STREAM, "source progress source=%llx seq=%llu bytes=%llu timestamp=%u flags=%u",
DEBUG_DEBUG(DEBUG_CATEGORY_STREAM, "source progress source=%llx seq=%llu bytes=%llu timestamp=%u flags=%u part=%zu max=%zu",
(unsigned long long)source->descriptor.source_node_id, (unsigned long long)seq,
(unsigned long long)source->emitted_bytes, (uint16_t)now_ms, flags);
(unsigned long long)source->emitted_bytes, (uint16_t)now_ms, flags,
block_length, stream_block_capacity(&source->descriptor));
source->report_ms = now_ms;
}
if (source->ready) source->ready(source, seq, source->arg);