Skip to content

azad.network.interfaces Module

azad.network.interfaces

Network protocol interfaces.

Attributes

T module-attribute

T = TypeVar('T')

TaskStartCallback module-attribute

TaskStartCallback = Callable[[str, TaskConfig, Optional[str]], Awaitable[DataResponse[TaskStatusResponse]]]

TaskExecuteCallback module-attribute

TaskExecuteCallback = Callable[[str], Awaitable[None]]

TaskAbortCallback module-attribute

TaskAbortCallback = Callable[[str, bool], Awaitable[MessageResponse]]

TaskStatusCallback module-attribute

TaskStatusCallback = Callable[[Optional[str]], Awaitable[DataResponse[TaskStatusResponse]]]

ShutdownCallback module-attribute

ShutdownCallback = Callable[[bool], Awaitable[MessageResponse]]

UpdateConfigCallback module-attribute

UpdateConfigCallback = Callable[[TaskConfig], Awaitable[MessageResponse]]

EnvironmentRegisterCallback module-attribute

EnvironmentRegisterCallback = Callable[[ProtocolHandler, bool], Awaitable[MessageResponse]]

EnvironmentUnregisterCallback module-attribute

EnvironmentUnregisterCallback = Callable[[ProtocolHandler], Awaitable[MessageResponse]]

LoopAdvanceCallback module-attribute

LoopAdvanceCallback = Callable[[str], Awaitable[MessageResponse]]

LoopResumeCallback module-attribute

LoopResumeCallback = Callable[[str, list[Any]], Awaitable[MessageResponse]]

HardPauseCallback module-attribute

HardPauseCallback = Callable[[], Awaitable[DataResponse[dict[str, Any]]]]

Classes

BaseResponse

Bases: BaseModel

Base response model.

SuccessResponse

Bases: BaseResponse

Base for successful responses.

DataResponse

Bases: SuccessResponse, Generic[T]

Response with generic data payload.

TaskStatusResponse

Bases: BaseModel

Task status response data.

PauseException

Bases: Exception

TaskStatus

Bases: Enum

Task execution status.

PENDING: Task is waiting to start RUNNING: Task is currently executing COMPLETED: Task completed successfully FAILED: Task failed with an error ABORTED: Task was forcefully aborted TERMINATED: Task ended normally (e.g. server shutdown)

EventData

Bases: BaseModel

Event data with type and payload.

LogData

Bases: BaseModel

Log event data.

TaskResult dataclass

TaskResult(task_id: str, status: TaskStatus, error: Optional[str] = None, forced: bool = False)

EventPublisher

Bases: ABC

Abstract base class for event publishing.

Functions
publish_event abstractmethod async
publish_event(event_type: str, payload: dict[str, Any]) -> None

Publish an event.

Source code in azad/network/interfaces.py
@abstractmethod
async def publish_event(self, event_type: str, payload: dict[str, Any]) -> None:
    """Publish an event."""
    pass
publish_log abstractmethod async
publish_log(level: str, message: str, logger_name: str, **kwargs) -> None

Publish a log message.

Source code in azad/network/interfaces.py
@abstractmethod
async def publish_log(self, level: str, message: str, logger_name: str, **kwargs) -> None:
    """Publish a log message."""
    pass

EventSubscriber

Bases: ABC

Abstract base class for event subscription.

Functions
subscribe_events abstractmethod async
subscribe_events(client_id: str) -> AsyncIterator[dict[str, Any]]

Subscribe to events.

Source code in azad/network/interfaces.py
@abstractmethod
async def subscribe_events(self, client_id: str) -> AsyncIterator[dict[str, Any]]:
    """Subscribe to events."""
    pass
subscribe_logs abstractmethod async
subscribe_logs(client_id: str) -> AsyncIterator[dict[str, Any]]

Subscribe to logs.

Source code in azad/network/interfaces.py
@abstractmethod
async def subscribe_logs(self, client_id: str) -> AsyncIterator[dict[str, Any]]:
    """Subscribe to logs."""
    pass