
    6                     `    S SK JrJr  S SKJrJrJr  S SKJr   " S S\5      r	 " S S\	5      r
g)	    )ABCabstractmethod)SetOptional	Awaitable)	Partitionc                   J    \ rS rSrSr\S\\   S\\   S\\	   4S j5       r
Srg)	ReassignmentHandler   a  
A ReassignmentHandler is called any time a new partition assignment is received from the server.
It will be called with both the previous and new assignments as decided by the backend.

The client library will not acknowledge the assignment until handleReassignment returns. The
assigning backend will not assign any of the partitions in `before` to another server unless the
assignment is acknowledged, or a client takes too long to acknowledged (currently 30 seconds from
the time the assignment is sent from server's point of view).

Because of the above, as long as reassignment handling is processed quickly, it can be used to
abort outstanding operations on partitions which are being assigned away from this client.
beforeafterreturnc                     g)aa  
Called with the previous and new assignment delivered to this client on an assignment change.
The assignment will not be acknowledged until this method returns, so it should complete
quickly, or the backend will assume it is non-responsive and assign all partitions away without
waiting for acknowledgement.

handle_reassignment will only be called after no new message deliveries will be started for the partition.
There may still be messages in flight on executors or in async callbacks.

Acks or nacks on messages from partitions being assigned away will have no effect.

This method will be called on an event loop and should not block.

Args:
  before: The previous assignment.
  after: The new assignment.

Returns:
  Either None or an Awaitable to be waited on before acknowledging reassignment.

Raises:
  GoogleAPICallError: To fail the client if raised.
N selfr   r   s      Klib/third_party/google/cloud/pubsublite/cloudpubsub/reassignment_handler.pyhandle_reassignment'ReassignmentHandler.handle_reassignment#   s    6 	    r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   r   __static_attributes__r   r   r   r
   r
      s@     )n-0^	)	 r   r
   c                   <    \ rS rSrS\\   S\\   S\\   4S jrSr	g)DefaultReassignmentHandlerA   r   r   r   c                     g )Nr   r   s      r   r   .DefaultReassignmentHandler.handle_reassignmentB   s     r   r   N)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   A   s,    )n-0^	)	r   r   N)abcr   r   typingr   r   r   google.cloud.pubsublite.typesr   r
   r   r   r   r   <module>r%      s-    $ + + 3)# )X!4 r   