mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 08:00:54 +00:00
Migrate to new project structure.
This commit is contained in:
40
libp2p/stream_muxer/muxed_stream_interface.py
Normal file
40
libp2p/stream_muxer/muxed_stream_interface.py
Normal file
@ -0,0 +1,40 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class IMuxedStream(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def read(self):
|
||||
"""
|
||||
reads from the underlying muxed_conn
|
||||
:return: bytes of input
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def write(self, _bytes):
|
||||
"""
|
||||
writes to the underlying muxed_conn
|
||||
:return: number of bytes written
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def close(self):
|
||||
"""
|
||||
close the underlying muxed_conn
|
||||
:return: true if successful
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def reset(self):
|
||||
"""
|
||||
closes both ends of the stream
|
||||
tells this remote side to hang up
|
||||
:return: error/exception
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def set_deadline(self, ttl):
|
||||
"""
|
||||
set deadline for muxed stream
|
||||
:return: a new stream
|
||||
"""
|
||||
Reference in New Issue
Block a user