Merge pull request #277 from ralexstokes/add-io-abstractions

Introduces IO abstractions and classes for `msgio` IO
This commit is contained in:
Alex Stokes
2019-09-04 19:11:50 +02:00
committed by GitHub
7 changed files with 156 additions and 32 deletions

View File

@ -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