base_classes
frequenz.channels.base_classes
¤
Baseclasses for Channel Sender and Receiver.
Classes¤
frequenz.channels.base_classes.BufferedReceiver
¤
Bases: Receiver[T]
A channel receiver with a buffer.
Source code in frequenz/channels/base_classes.py
107 108 109 110 111 112 113 114 115 116 |
|
Functions¤
enqueue(msg)
abstractmethod
¤
Put a message into this buffered receiver's queue.
PARAMETER | DESCRIPTION |
---|---|
msg |
The message to be added to the queue.
TYPE:
|
Source code in frequenz/channels/base_classes.py
110 111 112 113 114 115 116 |
|
frequenz.channels.base_classes.Peekable
¤
A channel peekable.
A Peekable provides a peek() method that allows the user to get a peek at the latest value in the channel, without consuming anything.
Source code in frequenz/channels/base_classes.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
Functions¤
peek()
abstractmethod
¤
Return the latest value that was sent to the channel.
RETURNS | DESCRIPTION |
---|---|
Optional[T]
|
The latest value received by the channel, and |
Source code in frequenz/channels/base_classes.py
97 98 99 100 101 102 103 104 |
|
frequenz.channels.base_classes.Receiver
¤
A channel Receiver.
Source code in frequenz/channels/base_classes.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
Functions¤
__aiter__()
¤
Initialize the async iterator over received values.
RETURNS | DESCRIPTION |
---|---|
Receiver[T]
|
|
Source code in frequenz/channels/base_classes.py
42 43 44 45 46 47 48 |
|
__anext__()
async
¤
Await the next value in the async iteration over received values.
RETURNS | DESCRIPTION |
---|---|
T
|
The next value received. |
RAISES | DESCRIPTION |
---|---|
StopAsyncIteration
|
if we receive |
Source code in frequenz/channels/base_classes.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
into_peekable()
¤
Convert the Receiver
implementation into a Peekable
.
Once this function has been called, the receiver will no longer be
usable, and calling receive
on the receiver will raise an exception.
RAISES | DESCRIPTION |
---|---|
NotImplementedError
|
when a |
Source code in frequenz/channels/base_classes.py
76 77 78 79 80 81 82 83 84 85 86 |
|
map(call)
¤
Return a receiver with call
applied on incoming messages.
PARAMETER | DESCRIPTION |
---|---|
call |
function to apply on incoming messages.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Receiver[U]
|
A |
Source code in frequenz/channels/base_classes.py
65 66 67 68 69 70 71 72 73 74 |
|
receive()
abstractmethod
async
¤
Receive a message from the channel.
RETURNS | DESCRIPTION |
---|---|
Optional[T]
|
|
Source code in frequenz/channels/base_classes.py
34 35 36 37 38 39 40 |
|
frequenz.channels.base_classes.Sender
¤
A channel Sender.
Source code in frequenz/channels/base_classes.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
Functions¤
send(msg)
abstractmethod
async
¤
Send a message to the channel.
PARAMETER | DESCRIPTION |
---|---|
msg |
The message to be sent.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
Whether the message was sent, based on whether the channel is open or not. |
Source code in frequenz/channels/base_classes.py
18 19 20 21 22 23 24 25 26 27 28 |
|