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 | 16641x 16641x 16641x 16641x 16641x 16641x 16641x 16641x 16586x 16641x 16586x 16641x 1x | import type { Codec } from '@ydbjs/api/topic'
import type { TopicPartitionSession } from './partition-session.js'
type TopicMessageOptions = {
partitionSession: TopicPartitionSession
producer: string
payload: Uint8Array
codec: Codec
seqNo: bigint
offset?: bigint
uncompressedSize?: bigint
createdAt?: number
writtenAt?: number
metadataItems?: Record<string, Uint8Array>
}
export class TopicMessage {
readonly partitionSession: WeakRef<TopicPartitionSession>
readonly producer: string
readonly payload: Uint8Array
readonly codec: Codec
readonly seqNo: bigint
readonly offset?: bigint
readonly uncompressedSize?: bigint
readonly createdAt?: number
readonly writtenAt?: number
readonly metadataItems?: Record<string, Uint8Array>
constructor(options: TopicMessageOptions) {
this.partitionSession = new WeakRef(options.partitionSession)
this.producer = options.producer
this.codec = options.codec
this.seqNo = options.seqNo
this.offset = options.offset ?? 0n
this.payload = options.payload
this.uncompressedSize = options.uncompressedSize ?? 0n
if (options.createdAt !== undefined) {
this.createdAt = options.createdAt
}
if (options.writtenAt !== undefined) {
this.writtenAt = options.writtenAt
}
if (options.metadataItems !== undefined) {
this.metadataItems = options.metadataItems
}
}
get alive(): boolean {
const session = this.partitionSession.deref()
return session ? !session.isStopped : false
}
}
|