@@ -115,9 +115,14 @@ func (s *PartitionSettings) FromRaw(raw *rawtopic.PartitioningSettings) {
115115//
116116// Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
117117type TopicDescription struct {
118- Path string
119- PartitionSettings PartitionSettings
120- Consumers []Consumer
118+ Path string
119+ PartitionSettings PartitionSettings
120+ Consumers []Consumer
121+ SupportedCodecs []Codec
122+ RetentionPeriod time.Duration
123+ PartitionWriteBurstBytes int64
124+ PartitionWriteSpeedBytesPerSecond int64
125+ Attributes map [string ]string
121126}
122127
123128// FromRaw
@@ -133,4 +138,41 @@ func (d *TopicDescription) FromRaw(raw *rawtopic.DescribeTopicResult) {
133138 for i := 0 ; i < len (raw .Consumers ); i ++ {
134139 d .Consumers [i ].FromRaw (& raw .Consumers [i ])
135140 }
141+
142+ d .SupportedCodecs = make ([]Codec , len (raw .SupportedCodecs ))
143+ for i := 0 ; i < len (raw .SupportedCodecs ); i ++ {
144+ d .SupportedCodecs [i ] = Codec (raw .SupportedCodecs [i ])
145+ }
146+
147+ d .PartitionWriteSpeedBytesPerSecond = raw .PartitionWriteSpeedBytesPerSecond
148+ d .PartitionWriteBurstBytes = raw .PartitionWriteBurstBytes
149+ for k , v := range raw .Attributes {
150+ d .Attributes [k ] = v
151+ }
152+ }
153+
154+ // ToRaw
155+ //
156+ // # Experimental
157+ //
158+ // Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
159+ func (d * TopicDescription ) ToRaw (raw * rawtopic.DescribeTopicResult ) {
160+ raw .Self .Name = d .Path
161+ d .PartitionSettings .ToRaw (& raw .PartitioningSettings )
162+
163+ raw .Consumers = make ([]rawtopic.Consumer , len (d .Consumers ))
164+ for i := 0 ; i < len (d .Consumers ); i ++ {
165+ d .Consumers [i ].ToRaw (& raw .Consumers [i ])
166+ }
167+
168+ raw .SupportedCodecs = make ([]rawtopiccommon.Codec , len (d .SupportedCodecs ))
169+ for i := 0 ; i < len (d .SupportedCodecs ); i ++ {
170+ raw .SupportedCodecs [i ] = rawtopiccommon .Codec (d .SupportedCodecs [i ])
171+ }
172+
173+ raw .PartitionWriteBurstBytes = d .PartitionWriteBurstBytes
174+ raw .PartitionWriteSpeedBytesPerSecond = d .PartitionWriteSpeedBytesPerSecond
175+ for k , v := range d .Attributes {
176+ raw .Attributes [k ] = v
177+ }
136178}
0 commit comments