@@ -88,10 +88,10 @@ type Namespaces interface {
8888 // SetNamespaceMessageTTLWithContext sets the messages Time to Live for all the topics within a namespace
8989 SetNamespaceMessageTTLWithContext (ctx context.Context , namespace string , ttlInSeconds int ) error
9090
91- // GetNamespaceMessageTTL returns the message TTL for a namespace
91+ // GetNamespaceMessageTTL returns the message TTL for a namespace. Returns -1 if not set
9292 GetNamespaceMessageTTL (namespace string ) (int , error )
9393
94- // GetNamespaceMessageTTLWithContext returns the message TTL for a namespace
94+ // GetNamespaceMessageTTLWithContext returns the message TTL for a namespace. Returns -1 if not set
9595 GetNamespaceMessageTTLWithContext (ctx context.Context , namespace string ) (int , error )
9696
9797 // GetRetention returns the retention configuration for a namespace
@@ -226,10 +226,11 @@ type Namespaces interface {
226226 // SetOffloadDeleteLagWithContext sets the offload deletion lag for a namespace
227227 SetOffloadDeleteLagWithContext (ctx context.Context , namespace utils.NameSpaceName , timeMs int64 ) error
228228
229- // GetOffloadDeleteLag returns the offload deletion lag for a namespace, in milliseconds
229+ // GetOffloadDeleteLag returns the offload deletion lag for a namespace, in milliseconds. Returns -1 if not set
230230 GetOffloadDeleteLag (namespace utils.NameSpaceName ) (int64 , error )
231231
232- // GetOffloadDeleteLagWithContext returns the offload deletion lag for a namespace, in milliseconds
232+ // GetOffloadDeleteLagWithContext returns the offload deletion lag for a namespace, in milliseconds.
233+ // Returns -1 if not set
233234 GetOffloadDeleteLagWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int64 , error )
234235
235236 // SetOffloadThreshold sets the offloadThreshold for a namespace
@@ -238,10 +239,10 @@ type Namespaces interface {
238239 // SetOffloadThresholdWithContext sets the offloadThreshold for a namespace
239240 SetOffloadThresholdWithContext (ctx context.Context , namespace utils.NameSpaceName , threshold int64 ) error
240241
241- // GetOffloadThreshold returns the offloadThreshold for a namespace
242+ // GetOffloadThreshold returns the offloadThreshold for a namespace. Returns -1 if not set
242243 GetOffloadThreshold (namespace utils.NameSpaceName ) (int64 , error )
243244
244- // GetOffloadThresholdWithContext returns the offloadThreshold for a namespace
245+ // GetOffloadThresholdWithContext returns the offloadThreshold for a namespace. Returns -1 if not set
245246 GetOffloadThresholdWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int64 , error )
246247
247248 // SetOffloadThresholdInSeconds sets the offloadThresholdInSeconds for a namespace
@@ -250,10 +251,10 @@ type Namespaces interface {
250251 // SetOffloadThresholdInSecondsWithContext sets the offloadThresholdInSeconds for a namespace
251252 SetOffloadThresholdInSecondsWithContext (ctx context.Context , namespace utils.NameSpaceName , threshold int64 ) error
252253
253- // GetOffloadThresholdInSeconds returns the offloadThresholdInSeconds for a namespace
254+ // GetOffloadThresholdInSeconds returns the offloadThresholdInSeconds for a namespace. Returns -1 if not set
254255 GetOffloadThresholdInSeconds (namespace utils.NameSpaceName ) (int64 , error )
255256
256- // GetOffloadThresholdInSecondsWithContext returns the offloadThresholdInSeconds for a namespace
257+ // GetOffloadThresholdInSecondsWithContext returns the offloadThresholdInSeconds for a namespace. Returns -1 if not set
257258 GetOffloadThresholdInSecondsWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int64 , error )
258259
259260 // SetCompactionThreshold sets the compactionThreshold for a namespace
@@ -262,10 +263,10 @@ type Namespaces interface {
262263 // SetCompactionThresholdWithContext sets the compactionThreshold for a namespace
263264 SetCompactionThresholdWithContext (ctx context.Context , namespace utils.NameSpaceName , threshold int64 ) error
264265
265- // GetCompactionThreshold returns the compactionThreshold for a namespace
266+ // GetCompactionThreshold returns the compactionThreshold for a namespace. Returns -1 if not set
266267 GetCompactionThreshold (namespace utils.NameSpaceName ) (int64 , error )
267268
268- // GetCompactionThresholdWithContext returns the compactionThreshold for a namespace
269+ // GetCompactionThresholdWithContext returns the compactionThreshold for a namespace. Returns -1 if not set
269270 GetCompactionThresholdWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int64 , error )
270271
271272 // SetMaxConsumersPerSubscription sets maxConsumersPerSubscription for a namespace.
@@ -276,10 +277,11 @@ type Namespaces interface {
276277 //nolint: revive // It's ok here to use a built-in function name (max)
277278 SetMaxConsumersPerSubscriptionWithContext (ctx context.Context , namespace utils.NameSpaceName , max int ) error
278279
279- // GetMaxConsumersPerSubscription returns the maxConsumersPerSubscription for a namespace.
280+ // GetMaxConsumersPerSubscription returns the maxConsumersPerSubscription for a namespace. Returns -1 if not set
280281 GetMaxConsumersPerSubscription (namespace utils.NameSpaceName ) (int , error )
281282
282283 // GetMaxConsumersPerSubscriptionWithContext returns the maxConsumersPerSubscription for a namespace.
284+ // Returns -1 if not set
283285 GetMaxConsumersPerSubscriptionWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int , error )
284286
285287 // SetMaxConsumersPerTopic sets maxConsumersPerTopic for a namespace.
@@ -290,10 +292,10 @@ type Namespaces interface {
290292 //nolint: revive // It's ok here to use a built-in function name (max)
291293 SetMaxConsumersPerTopicWithContext (ctx context.Context , namespace utils.NameSpaceName , max int ) error
292294
293- // GetMaxConsumersPerTopic returns the maxProducersPerTopic for a namespace.
295+ // GetMaxConsumersPerTopic returns the maxProducersPerTopic for a namespace. Returns -1 if not set
294296 GetMaxConsumersPerTopic (namespace utils.NameSpaceName ) (int , error )
295297
296- // GetMaxConsumersPerTopicWithContext returns the maxProducersPerTopic for a namespace.
298+ // GetMaxConsumersPerTopicWithContext returns the maxProducersPerTopic for a namespace. Returns -1 if not set
297299 GetMaxConsumersPerTopicWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int , error )
298300
299301 // SetMaxProducersPerTopic sets maxProducersPerTopic for a namespace.
@@ -304,10 +306,10 @@ type Namespaces interface {
304306 //nolint: revive // It's ok here to use a built-in function name (max)
305307 SetMaxProducersPerTopicWithContext (ctx context.Context , namespace utils.NameSpaceName , max int ) error
306308
307- // GetMaxProducersPerTopic returns the maxProducersPerTopic for a namespace.
309+ // GetMaxProducersPerTopic returns the maxProducersPerTopic for a namespace. Returns -1 if not set
308310 GetMaxProducersPerTopic (namespace utils.NameSpaceName ) (int , error )
309311
310- // GetMaxProducersPerTopicWithContext returns the maxProducersPerTopic for a namespace.
312+ // GetMaxProducersPerTopicWithContext returns the maxProducersPerTopic for a namespace. Returns -1 if not set
311313 GetMaxProducersPerTopicWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int , error )
312314
313315 // SetMaxTopicsPerNamespace sets maxTopicsPerNamespace for a namespace.
@@ -851,7 +853,7 @@ func (n *namespaces) GetNamespaceMessageTTL(namespace string) (int, error) {
851853}
852854
853855func (n * namespaces ) GetNamespaceMessageTTLWithContext (ctx context.Context , namespace string ) (int , error ) {
854- var ttl int
856+ var ttl = - 1
855857 nsName , err := utils .GetNamespaceName (namespace )
856858 if err != nil {
857859 return 0 , err
@@ -1114,7 +1116,7 @@ func (n *namespaces) GetOffloadDeleteLag(namespace utils.NameSpaceName) (int64,
11141116}
11151117
11161118func (n * namespaces ) GetOffloadDeleteLagWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int64 , error ) {
1117- var result int64
1119+ var result int64 = - 1
11181120 endpoint := n .pulsar .endpoint (n .basePath , namespace .String (), "offloadDeletionLagMs" )
11191121 err := n .pulsar .Client .GetWithContext (ctx , endpoint , & result )
11201122 return result , err
@@ -1143,7 +1145,7 @@ func (n *namespaces) GetMaxConsumersPerSubscriptionWithContext(
11431145 ctx context.Context ,
11441146 namespace utils.NameSpaceName ,
11451147) (int , error ) {
1146- var result int
1148+ var result = - 1
11471149 endpoint := n .pulsar .endpoint (n .basePath , namespace .String (), "maxConsumersPerSubscription" )
11481150 err := n .pulsar .Client .GetWithContext (ctx , endpoint , & result )
11491151 return result , err
@@ -1167,7 +1169,7 @@ func (n *namespaces) GetOffloadThreshold(namespace utils.NameSpaceName) (int64,
11671169}
11681170
11691171func (n * namespaces ) GetOffloadThresholdWithContext (ctx context.Context , namespace utils.NameSpaceName ) (int64 , error ) {
1170- var result int64
1172+ var result int64 = - 1
11711173 endpoint := n .pulsar .endpoint (n .basePath , namespace .String (), "offloadThreshold" )
11721174 err := n .pulsar .Client .GetWithContext (ctx , endpoint , & result )
11731175 return result , err
@@ -1194,7 +1196,7 @@ func (n *namespaces) GetOffloadThresholdInSecondsWithContext(
11941196 ctx context.Context ,
11951197 namespace utils.NameSpaceName ,
11961198) (int64 , error ) {
1197- var result int64
1199+ var result int64 = - 1
11981200 endpoint := n .pulsar .endpoint (n .basePath , namespace .String (), "offloadThresholdInSeconds" )
11991201 err := n .pulsar .Client .GetWithContext (ctx , endpoint , & result )
12001202 return result , err
@@ -1223,7 +1225,7 @@ func (n *namespaces) GetMaxConsumersPerTopicWithContext(
12231225 ctx context.Context ,
12241226 namespace utils.NameSpaceName ,
12251227) (int , error ) {
1226- var result int
1228+ var result = - 1
12271229 endpoint := n .pulsar .endpoint (n .basePath , namespace .String (), "maxConsumersPerTopic" )
12281230 err := n .pulsar .Client .GetWithContext (ctx , endpoint , & result )
12291231 return result , err
@@ -1250,7 +1252,7 @@ func (n *namespaces) GetCompactionThresholdWithContext(
12501252 ctx context.Context ,
12511253 namespace utils.NameSpaceName ,
12521254) (int64 , error ) {
1253- var result int64
1255+ var result int64 = - 1
12541256 endpoint := n .pulsar .endpoint (n .basePath , namespace .String (), "compactionThreshold" )
12551257 err := n .pulsar .Client .GetWithContext (ctx , endpoint , & result )
12561258 return result , err
@@ -1279,7 +1281,7 @@ func (n *namespaces) GetMaxProducersPerTopicWithContext(
12791281 ctx context.Context ,
12801282 namespace utils.NameSpaceName ,
12811283) (int , error ) {
1282- var result int
1284+ var result = - 1
12831285 endpoint := n .pulsar .endpoint (n .basePath , namespace .String (), "maxProducersPerTopic" )
12841286 err := n .pulsar .Client .GetWithContext (ctx , endpoint , & result )
12851287 return result , err
@@ -2014,7 +2016,7 @@ func (n *namespaces) GetMaxTopicsPerNamespaceWithContext(
20142016 ctx context.Context ,
20152017 namespace utils.NameSpaceName ,
20162018) (int , error ) {
2017- var result int
2019+ var result int // This method does not require a sentinel value of -1 since the API never returns empty
20182020 endpoint := n .pulsar .endpoint (n .basePath , namespace .String (), "maxTopicsPerNamespace" )
20192021 err := n .pulsar .Client .GetWithContext (ctx , endpoint , & result )
20202022 return result , err
0 commit comments