Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/requests.py: 97%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

31 statements  

1# Copyright 2017, Google LLC All rights reserved. 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15import typing 

16from typing import NamedTuple, Optional 

17 

18from google.cloud.pubsub_v1.open_telemetry.subscribe_opentelemetry import ( 

19 SubscribeOpenTelemetry, 

20) 

21 

22if typing.TYPE_CHECKING: # pragma: NO COVER 

23 from google.cloud.pubsub_v1.subscriber import futures 

24 

25 

26# Namedtuples for management requests. Used by the Message class to communicate 

27# items of work back to the policy. 

28class AckRequest(NamedTuple): 

29 ack_id: str 

30 byte_size: int 

31 time_to_ack: float 

32 ordering_key: Optional[str] 

33 future: Optional["futures.Future"] 

34 opentelemetry_data: Optional[SubscribeOpenTelemetry] = None 

35 

36 

37class DropRequest(NamedTuple): 

38 ack_id: str 

39 byte_size: int 

40 ordering_key: Optional[str] 

41 

42 

43class LeaseRequest(NamedTuple): 

44 ack_id: str 

45 byte_size: int 

46 ordering_key: Optional[str] 

47 opentelemetry_data: Optional[SubscribeOpenTelemetry] = None 

48 

49 

50class ModAckRequest(NamedTuple): 

51 ack_id: str 

52 seconds: float 

53 future: Optional["futures.Future"] 

54 opentelemetry_data: Optional[SubscribeOpenTelemetry] = None 

55 

56 

57class NackRequest(NamedTuple): 

58 ack_id: str 

59 byte_size: int 

60 ordering_key: Optional[str] 

61 future: Optional["futures.Future"] 

62 opentelemetry_data: Optional[SubscribeOpenTelemetry] = None