py-libp2p/muxer/mplex/muxed_stream.py

35 lines
709 B
Python
Raw Normal View History

2018-11-01 05:31:00 +08:00
from .muxed_stream_interface import IMuxedStream
class MuxedStream(IMuxedStream):
2018-11-01 06:02:00 +08:00
"""
reference: https://github.com/libp2p/go-mplex/blob/master/stream.go
"""
def __init__(self, protocol_id, stream_name):
self.protocol_id = protocol_id
2018-11-01 05:31:00 +08:00
self.name = stream_name
def read(self):
pass
def write(self):
pass
def close(self):
2018-11-01 06:02:00 +08:00
pass
2018-11-01 05:31:00 +08:00
def reset(self):
"""
closes both ends of the stream
tells this remote side to hang up
:return: error/exception
"""
pass
def set_deadline(self, ttl):
"""
set deadline for muxed stream
:return: a new stream
"""
pass