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

25 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-26 06:25 +0000

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 

18if typing.TYPE_CHECKING: # pragma: NO COVER 

19 from google.cloud.pubsub_v1.subscriber import futures 

20 

21 

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

23# items of work back to the policy. 

24class AckRequest(NamedTuple): 

25 ack_id: str 

26 byte_size: int 

27 time_to_ack: float 

28 ordering_key: Optional[str] 

29 future: Optional["futures.Future"] 

30 

31 

32class DropRequest(NamedTuple): 

33 ack_id: str 

34 byte_size: int 

35 ordering_key: Optional[str] 

36 

37 

38class LeaseRequest(NamedTuple): 

39 ack_id: str 

40 byte_size: int 

41 ordering_key: Optional[str] 

42 

43 

44class ModAckRequest(NamedTuple): 

45 ack_id: str 

46 seconds: float 

47 future: Optional["futures.Future"] 

48 

49 

50class NackRequest(NamedTuple): 

51 ack_id: str 

52 byte_size: int 

53 ordering_key: Optional[str] 

54 future: Optional["futures.Future"]