All files / packages/topic/src partition-session.ts

100% Statements 11/11
100% Branches 0/0
100% Functions 5/5
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                                1228x       1228x       1228x       1228x                 1228x 1228x 1228x       33232x       1x       401x       3x      
export class TopicPartitionSession {
	/**
	 * Partition session identifier.
	 */
	readonly partitionSessionId: bigint
	/**
	 * Partition identifier.
	 */
	readonly partitionId: bigint
	/**
	 * Topic path.
	 */
	readonly topicPath: string
	/**
	 * Partition offsets.
	 */
	partitionOffsets = { start: 0n, end: 0n }
	/**
	 * Offset of the last committed message from the partition.
	 */
	partitionCommittedOffset = 0n
	/**
	 * Flag indicating whether the session is currently active.
	 */
	#stopped = false
	/**
	 * Flag indicating whether the session has ended.
	 */
	#ended = false
 
	/**
	 * Creates a new instance of TopicPartitionSession.
	 * @param partitionSessionId - The identifier of the partition session.
	 * @param partitionId - The identifier of the partition.
	 * @param topicPath - The path of the topic.
	 */
	constructor(partitionSessionId: bigint, partitionId: bigint, topicPath: string) {
		this.partitionSessionId = partitionSessionId
		this.partitionId = partitionId
		this.topicPath = topicPath
	}
 
	get isStopped(): boolean {
		return this.#stopped
	}
 
	get isEnded(): boolean {
		return this.#ended
	}
 
	stop(): void {
		this.#stopped = true
	}
 
	end(): void {
		this.#ended = true
	}
}