mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-03-19 02:03:08 +00:00
24 lines
488 B
Python
24 lines
488 B
Python
import abc
|
|
import asyncio
|
|
|
|
|
|
class SimplexConnection(abc.ABC):
|
|
@abc.abstractmethod
|
|
async def send(self, data: bytes) -> None:
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
async def recv(self) -> bytes:
|
|
pass
|
|
|
|
|
|
class LocalSimplexConnection(SimplexConnection):
|
|
def __init__(self):
|
|
self.queue = asyncio.Queue()
|
|
|
|
async def send(self, data: bytes) -> None:
|
|
await self.queue.put(data)
|
|
|
|
async def recv(self) -> bytes:
|
|
return await self.queue.get()
|