class documentation

class GoalSink:

Constructor: GoalSink(depth)

View In Hierarchy

The write side of a Goal; every method runs on the Runtime's event loop.

Method __init__ Open a sink buffering at most depth feedback messages, affine to the running loop.
Async Method await_outcome Await how the goal ended.
Method deliver Accept one decoded feedback message, dropping the oldest if the buffer is full.
Method require_own_loop Refuse an operation running on an event loop other than the one this sink opened on.
Method settle End the goal, waking everything waiting on it. The first settlement wins.
Async Method take_feedback Await the next buffered feedback message.
Property outcome Return how the goal ended, or None while it is still running.
Property settled Return whether the goal has ended, however it ended.
Instance Variable _arrival Undocumented
Instance Variable _feedback Undocumented
Instance Variable _loop Undocumented
Instance Variable _outcome Undocumented
Instance Variable _settled Undocumented
def __init__(self, *, depth: int):

Open a sink buffering at most depth feedback messages, affine to the running loop.

Parameters
depth:intHow many feedback messages may wait for a consumer. When the buffer is full the oldest is dropped.
Raises
ValueErrorWhen the depth is less than one.
RuntimeErrorWhen constructed with no running event loop.
async def await_outcome(self) -> GoalOutcome:

Await how the goal ended.

Raises
LoopAffinityErrorWhen awaited on a loop other than this sink's.
def deliver(self, feedback: Message):

Accept one decoded feedback message, dropping the oldest if the buffer is full.

def require_own_loop(self):

Refuse an operation running on an event loop other than the one this sink opened on.

Raises
LoopAffinityErrorWhen the running loop is not this sink's.
def settle(self, outcome: GoalOutcome):

End the goal, waking everything waiting on it. The first settlement wins.

async def take_feedback(self) -> Message:

Await the next buffered feedback message.

Raises
GoalClosedErrorWhen the goal has ended and no feedback is left buffered.
LoopAffinityErrorWhen awaited on a loop other than this sink's.
@property
outcome: GoalOutcome | None =

Return how the goal ended, or None while it is still running.

@property
settled: bool =

Return whether the goal has ended, however it ended.

_arrival =

Undocumented

_feedback: deque[Message] =

Undocumented

_loop =

Undocumented

_outcome: GoalOutcome | None =

Undocumented

_settled =

Undocumented