mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
add typing to mplex
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
@ -6,6 +7,13 @@ class IRawConnection(ABC):
|
||||
A Raw Connection provides a Reader and a Writer
|
||||
"""
|
||||
|
||||
initiator: bool
|
||||
|
||||
# TODO: reader and writer shouldn't be exposed.
|
||||
# Need better API for the consumers
|
||||
reader: asyncio.StreamReader
|
||||
writer: asyncio.StreamWriter
|
||||
|
||||
@abstractmethod
|
||||
async def write(self, data: bytes) -> None:
|
||||
pass
|
||||
@ -13,3 +21,11 @@ class IRawConnection(ABC):
|
||||
@abstractmethod
|
||||
async def read(self) -> bytes:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def close(self) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def next_stream_id(self) -> int:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user