| 266 | |
| 267 | |
| 268 | class ContinuousPagingOptions(object): |
| 269 | |
| 270 | class PagingUnit(object): |
| 271 | BYTES = 1 |
| 272 | ROWS = 2 |
| 273 | |
| 274 | page_unit = None |
| 275 | """ |
| 276 | Value of PagingUnit. Default is PagingUnit.ROWS. |
| 277 | |
| 278 | Units refer to the :attr:`~.Statement.fetch_size` or :attr:`~.Session.default_fetch_size`. |
| 279 | """ |
| 280 | |
| 281 | max_pages = None |
| 282 | """ |
| 283 | Max number of pages to send |
| 284 | """ |
| 285 | |
| 286 | max_pages_per_second = None |
| 287 | """ |
| 288 | Max rate at which to send pages |
| 289 | """ |
| 290 | |
| 291 | max_queue_size = None |
| 292 | """ |
| 293 | The maximum queue size for caching pages, only honored for protocol version DSE_V2 and higher, |
| 294 | by default it is 4 and it must be at least 2. |
| 295 | """ |
| 296 | |
| 297 | def __init__(self, page_unit=PagingUnit.ROWS, max_pages=0, max_pages_per_second=0, max_queue_size=4): |
| 298 | self.page_unit = page_unit |
| 299 | self.max_pages = max_pages |
| 300 | self.max_pages_per_second = max_pages_per_second |
| 301 | if max_queue_size < 2: |
| 302 | raise ValueError('ContinuousPagingOptions.max_queue_size must be 2 or greater') |
| 303 | self.max_queue_size = max_queue_size |
| 304 | |
| 305 | def page_unit_bytes(self): |
| 306 | return self.page_unit == ContinuousPagingOptions.PagingUnit.BYTES |
| 307 | |
| 308 | |
| 309 | def _addrinfo_or_none(contact_point, port): |
no outgoing calls