@@ -400,7 +400,7 @@ async def aggregate(
400
400
"""
401
401
402
402
@abc .abstractmethod
403
- def values (self , filter : Optional [Filter ] = None , comparator : Optional [Comparator ] = None ) -> AsyncIterator [V ]:
403
+ def values (self , filter : Optional [Filter ] = None , comparator : Optional [Comparator ] = None , by_page : bool = False ) -> AsyncIterator [V ]:
404
404
"""
405
405
Return a Set of the values contained in this map that satisfy the criteria expressed by the filter.
406
406
If no filter or comparator is specified, it returns a Set view of the values contained in this map.The
@@ -411,22 +411,26 @@ def values(self, filter: Optional[Filter] = None, comparator: Optional[Comparato
411
411
:param filter: the Filter object representing the criteria that the entries of this map should satisfy
412
412
:param comparator: the Comparator object which imposes an ordering on entries in the resulting set; or null
413
413
if the entries' natural ordering should be used
414
+ :param by_page: returns the keys in pages (transparently to the caller). This option is only valid
415
+ if no filter or comparator is provided.
414
416
:return: an AsyncIterator of MapEntry instances resolving to the values that satisfy the specified criteria
415
417
"""
416
418
417
419
@abc .abstractmethod
418
- def keys (self , filter : Optional [Filter ] = None ) -> AsyncIterator [K ]:
420
+ def keys (self , filter : Optional [Filter ] = None , by_page : bool = False ) -> AsyncIterator [K ]:
419
421
"""
420
422
Return a set view of the keys contained in this map for entries that satisfy the criteria expressed by the
421
423
filter.
422
424
423
425
:param filter: the Filter object representing the criteria that the entries of this map should satisfy
426
+ :param by_page: returns the keys in pages (transparently to the caller). This option is only valid
427
+ if no filter is provided.
424
428
:return: an AsyncIterator of keys for entries that satisfy the specified criteria
425
429
"""
426
430
427
431
@abc .abstractmethod
428
432
def entries (
429
- self , filter : Optional [Filter ] = None , comparator : Optional [Comparator ] = None
433
+ self , filter : Optional [Filter ] = None , comparator : Optional [Comparator ] = None , by_page : bool = False
430
434
) -> AsyncIterator [MapEntry [K , V ]]:
431
435
"""
432
436
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.
@@ -435,6 +439,8 @@ def entries(
435
439
:param filter: the Filter object representing the criteria that the entries of this map should satisfy
436
440
:param comparator: the Comparator object which imposes an ordering on entries in the resulting set; or `None`
437
441
if the entries' values natural ordering should be used
442
+ :param by_page: returns the keys in pages (transparently to the caller). This option is only valid
443
+ if no filter or comparator is provided.
438
444
:return: an AsyncIterator of MapEntry instances that satisfy the specified criteria
439
445
"""
440
446
@@ -664,10 +670,8 @@ async def aggregate(
664
670
return cast (R , value )
665
671
666
672
@_pre_call_cache
667
- def values (self , filter : Optional [Filter ] = None , comparator : Optional [Comparator ] = None ) -> AsyncIterator [V ]:
668
- # if there is no filter or no co, or the filter is an AlwaysFilter,
669
- # obtain results by-page
670
- if (comparator is None and filter is None ) or (comparator is None and isinstance (filter , AlwaysFilter )):
673
+ def values (self , filter : Optional [Filter ] = None , comparator : Optional [Comparator ] = None , by_page : bool = False ) -> AsyncIterator [V ]:
674
+ if by_page and comparator is None and filter is None :
671
675
return _PagedStream (self , _scalar_deserializer )
672
676
else :
673
677
r = self ._request_factory .values_request (filter )
@@ -676,10 +680,8 @@ def values(self, filter: Optional[Filter] = None, comparator: Optional[Comparato
676
680
return _Stream (self ._request_factory .get_serializer (), stream , _scalar_producer )
677
681
678
682
@_pre_call_cache
679
- def keys (self , filter : Optional [Filter ] = None ) -> AsyncIterator [K ]:
680
- # if there is no filter, or the filter is an AlwaysFilter,
681
- # obtain results by-page
682
- if filter is None or isinstance (filter , AlwaysFilter ):
683
+ def keys (self , filter : Optional [Filter ] = None , by_page : bool = False ) -> AsyncIterator [K ]:
684
+ if by_page and filter is None :
683
685
return _PagedStream (self , _scalar_deserializer , True )
684
686
else :
685
687
r = self ._request_factory .keys_request (filter )
@@ -689,11 +691,9 @@ def keys(self, filter: Optional[Filter] = None) -> AsyncIterator[K]:
689
691
690
692
@_pre_call_cache
691
693
def entries (
692
- self , filter : Optional [Filter ] = None , comparator : Optional [Comparator ] = None
694
+ self , filter : Optional [Filter ] = None , comparator : Optional [Comparator ] = None , by_page : bool = False
693
695
) -> AsyncIterator [MapEntry [K , V ]]:
694
- # if there is no filter and no comparator, or the filter is an AlwaysFilter,
695
- # obtain results by-page
696
- if (comparator is None and filter is None ) or (comparator is None and isinstance (filter , AlwaysFilter )):
696
+ if by_page and comparator is None and filter is None :
697
697
return _PagedStream (self , _entry_deserializer )
698
698
else :
699
699
r = self ._request_factory .entries_request (filter , comparator )
0 commit comments