tethys.core.streams.stream_zero¶
Module Contents¶
-
class
tethys.core.streams.stream_zero.ZeroStream(pipe: ZeroPipe, session: ZeroSession, transport: Union['ZeroTransport', Callable], **kwargs)[source]¶ Bases:
tethys.core.regobjs.regobj_zero.ZeroRegistrableObject,tethys.core.streams.stream_base.StreamBaseThe Stream entity class of the Zero generation. The ZeroStream is an entity that defines the physical path of the data.
- Parameters
pipe (ZeroPipe) – Pipe instance that defines the logical path between nodes.
session (ZeroSession) – The session allows getting the stream for the pipe.
transport –
-
CLASS_PATH= /streams/[source]¶ ZeroStreaminstances collection path in the repository
-
FIELDS_SCHEMA[source]¶ ZeroStreamfields validators
-
open(self, save=True, **kwargs) → 'ZeroStream'[source]¶ Open stream
- Parameters
save (bool) – to save the stream
- Returns
self instance
- Return type
-
close(self, save=True, **kwargs) → 'ZeroStream'[source]¶ Close stream
- Parameters
save (bool) – to save the stream
- Returns
self instance
- Return type
-
write(self, data_packet: Union[List[Any], Any], many: bool = False, **kwargs)[source]¶ Write the data_packet to the stream
- Parameters
data_packet – any data object or list of the data objects (with many=True)
many (bool) – if many=True then data_packet’s elements will be sent one-by-one.
-
read(self, count: int = None, wait_timeout: float = None, **kwargs) → Generator[Tuple[str, Any], None, None][source]¶ Read the data_packets from the stream. Return Generator.
-
ack(self, message_key: str, **kwargs)[source]¶ Acknowledge message
- Parameters
message_key (str) – message key for the acknowledgement
-
redirect_to(self, station: ZeroStation, **kwargs)[source]¶ Redirect stream processing to the station
- Parameters
station (ZeroStation) – Station where the stream can be processed in the near time