mirror of
https://github.com/logos-co/nomos-specs.git
synced 2025-02-02 10:34:50 +00:00
39 lines
729 B
Python
39 lines
729 B
Python
from __future__ import annotations
|
|
|
|
import abc
|
|
from typing import Any, Awaitable, Coroutine, TypeVar
|
|
|
|
RT = TypeVar("RT")
|
|
|
|
|
|
class Framework(abc.ABC):
|
|
@abc.abstractmethod
|
|
def queue(self) -> Queue:
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
async def sleep(self, seconds: float) -> None:
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
def now(self) -> float:
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
def spawn(self, coroutine: Coroutine[Any, Any, RT]) -> Awaitable[RT]:
|
|
pass
|
|
|
|
|
|
class Queue(abc.ABC):
|
|
@abc.abstractmethod
|
|
async def put(self, data: bytes) -> None:
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
async def get(self) -> bytes:
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
def empty(self) -> bool:
|
|
pass
|