mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Introduces IO abstractions apart from asyncio or those attached to IRawConnection
Also adds `msgio` utilities to mirror the Go implementation
This commit is contained in:
@ -1,21 +1,9 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from libp2p.io.abc import ReadWriteCloser
|
||||
|
||||
|
||||
class IRawConnection(ABC):
|
||||
class IRawConnection(ReadWriteCloser):
|
||||
"""
|
||||
A Raw Connection provides a Reader and a Writer
|
||||
"""
|
||||
|
||||
initiator: bool
|
||||
|
||||
@abstractmethod
|
||||
async def write(self, data: bytes) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def read(self, n: int = -1) -> bytes:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def close(self) -> None:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user