mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 07:30:55 +00:00
Restructure mplex and mplex_stream
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.security.secure_conn_interface import ISecureConn
|
||||
@ -51,20 +51,6 @@ class IMuxedConn(ABC):
|
||||
:return: true if successful
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def read_buffer(self, stream_id: StreamID) -> bytes:
|
||||
"""
|
||||
Read a message from stream_id's buffer, check raw connection for new messages
|
||||
:param stream_id: stream id of stream to read from
|
||||
:return: message read
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def read_buffer_nonblocking(self, stream_id: StreamID) -> Optional[bytes]:
|
||||
"""
|
||||
Read a message from `stream_id`'s buffer, non-blockingly.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def open_stream(self) -> "IMuxedStream":
|
||||
"""
|
||||
@ -73,7 +59,7 @@ class IMuxedConn(ABC):
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def accept_stream(self, name: str) -> None:
|
||||
async def accept_stream(self, stream_id: StreamID, name: str) -> None:
|
||||
"""
|
||||
accepts a muxed stream opened by the other end
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user