2019-08-01 19:12:11 +08:00
|
|
|
from abc import ABC, abstractmethod
|
2018-11-13 02:02:49 +08:00
|
|
|
|
2018-11-11 22:56:44 +08:00
|
|
|
|
|
|
|
class IRawConnection(ABC):
|
|
|
|
"""
|
|
|
|
A Raw Connection provides a Reader and a Writer
|
|
|
|
"""
|
2019-08-01 19:12:11 +08:00
|
|
|
|
2019-08-02 17:53:51 +08:00
|
|
|
initiator: bool
|
|
|
|
|
2019-08-01 19:12:11 +08:00
|
|
|
@abstractmethod
|
|
|
|
async def write(self, data: bytes) -> None:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
2019-08-20 18:09:36 +08:00
|
|
|
async def read(self, n: int = -1) -> bytes:
|
2019-08-01 19:12:11 +08:00
|
|
|
pass
|
2019-08-02 17:53:51 +08:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def close(self) -> None:
|
|
|
|
pass
|