247
var readerState *persistencespb.QueueReaderState
248
switch s.isTieredStackEnabled {
250
>
if attr.HighPriorityState == nil || attr.LowPriorityState == nil {
251
return NewStreamError("streamSender encountered unsupported SyncReplicationState", nil)
252
}
254
>
Scopes: []*persistencespb.QueueSliceScope{
255
>
// index 0 is for overall low watermark. In tiered stack it is Min(LowWatermark-high priority, LowWatermark-low priority)
256
>
{
257
>
Range: &persistencespb.QueueSliceRange{
258
>
InclusiveMin: shard.ConvertToPersistenceTaskKey(
259
>
tasks.NewImmediateKey(attr.GetInclusiveLowWatermark()),
260
>
),
261
>
ExclusiveMax: shard.ConvertToPersistenceTaskKey(
262
>
tasks.NewImmediateKey(math.MaxInt64),
263
>
),
264
>
},
265
>
Predicate: &persistencespb.Predicate{
266
>
PredicateType: enumsspb.PREDICATE_TYPE_UNIVERSAL,
267
>
Attributes: &persistencespb.Predicate_UniversalPredicateAttributes{},
268
>
},
269
>
},
270
>
// index 1 is for high priority
271
>
{
272
>
Range: &persistencespb.QueueSliceRange{
273
>
InclusiveMin: shard.ConvertToPersistenceTaskKey(
274
>
tasks.NewImmediateKey(attr.GetHighPriorityState().GetInclusiveLowWatermark()),
275
>
),
276
>
ExclusiveMax: shard.ConvertToPersistenceTaskKey(
277
>
tasks.NewImmediateKey(math.MaxInt64),
278
>
),
279
>
},
280
>
Predicate: &persistencespb.Predicate{
281
>
PredicateType: enumsspb.PREDICATE_TYPE_UNIVERSAL,
282
>
Attributes: &persistencespb.Predicate_UniversalPredicateAttributes{},
283
>
},
284
>
},
285
>
// index 2 is for low priority
286
>
{
287
>
Range: &persistencespb.QueueSliceRange{
288
>
InclusiveMin: shard.ConvertToPersistenceTaskKey(
289
>
tasks.NewImmediateKey(attr.GetLowPriorityState().GetInclusiveLowWatermark()),
290
>
),
291
>
ExclusiveMax: shard.ConvertToPersistenceTaskKey(
292
>
tasks.NewImmediateKey(math.MaxInt64),
293
>
),
294
>
},
295
>
Predicate: &persistencespb.Predicate{
296
>
PredicateType: enumsspb.PREDICATE_TYPE_UNIVERSAL,
297
>
Attributes: &persistencespb.Predicate_UniversalPredicateAttributes{},
298
>
},
299
>
},
300
>
},
301
>
}
302
case false:
303
if attr.HighPriorityState != nil || attr.LowPriorityState != nil {