Skip to content

Commit f97feba

Browse files
committed
Pass up more cluster metadata
1 parent 4966e07 commit f97feba

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/clients/base/base.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ export class Base<OptionsType extends BaseOptions = BaseOptions> extends EventEm
409409

410410
// This should never change, but we act defensively here
411411
for (const broker of metadata.brokers) {
412-
const { host, port } = broker
413-
brokers.set(broker.nodeId, { host, port })
412+
const { host, port, rack } = broker
413+
brokers.set(broker.nodeId, { host, port, rack })
414414
}
415415

416416
this.#metadata.brokers = brokers
@@ -428,7 +428,9 @@ export class Base<OptionsType extends BaseOptions = BaseOptions> extends EventEm
428428
partitions[rawPartition.partitionIndex] = {
429429
leader: rawPartition.leaderId,
430430
leaderEpoch: rawPartition.leaderEpoch,
431-
replicas: rawPartition.replicaNodes
431+
replicas: rawPartition.replicaNodes,
432+
isr: rawPartition.isrNodes,
433+
offlineReplicas: rawPartition.offlineReplicas
432434
}
433435
}
434436

src/clients/base/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { type Broker, type ConnectionOptions } from '../../network/connection.ts'
2+
import { type NullableString } from '../../protocol/definitions.ts'
23
import { type Metrics } from '../metrics.ts'
34

45
export interface TopicWithPartitionAndOffset {
@@ -11,6 +12,8 @@ export interface ClusterPartitionMetadata {
1112
leader: number
1213
leaderEpoch: number
1314
replicas: number[]
15+
isr: number[]
16+
offlineReplicas: number[]
1417
}
1518

1619
export interface ClusterTopicMetadata {
@@ -22,7 +25,7 @@ export interface ClusterTopicMetadata {
2225

2326
export interface ClusterMetadata {
2427
id: string
25-
brokers: Map<number, Broker>
28+
brokers: Map<number, Broker & { rack: NullableString }>
2629
topics: Map<string, ClusterTopicMetadata>
2730
lastUpdate: number
2831
}

0 commit comments

Comments
 (0)