mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-27 03:21:57 -06:00
Scaffold Engine application interfaces
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .http import register_http_interfaces
|
||||
from .ws import create_socket_server
|
||||
from .ws import create_socket_server, register_ws_interfaces
|
||||
|
||||
__all__ = [
|
||||
"register_http_interfaces",
|
||||
"create_socket_server",
|
||||
"register_ws_interfaces",
|
||||
]
|
||||
|
||||
@@ -4,6 +4,16 @@ from __future__ import annotations
|
||||
|
||||
from flask import Flask
|
||||
|
||||
from . import admin, agents, enrollment, health, tokens
|
||||
|
||||
_REGISTRARS = (
|
||||
health.register,
|
||||
agents.register,
|
||||
enrollment.register,
|
||||
tokens.register,
|
||||
admin.register,
|
||||
)
|
||||
|
||||
|
||||
def register_http_interfaces(app: Flask) -> None:
|
||||
"""Attach HTTP blueprints to *app*.
|
||||
@@ -11,8 +21,8 @@ def register_http_interfaces(app: Flask) -> None:
|
||||
The implementation is intentionally minimal for the initial scaffolding.
|
||||
"""
|
||||
|
||||
# Future phases will import and register blueprints here.
|
||||
return None
|
||||
for registrar in _REGISTRARS:
|
||||
registrar(app)
|
||||
|
||||
|
||||
__all__ = ["register_http_interfaces"]
|
||||
|
||||
21
Data/Engine/interfaces/http/admin.py
Normal file
21
Data/Engine/interfaces/http/admin.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Administrative HTTP interface placeholders for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from flask import Blueprint, Flask
|
||||
|
||||
|
||||
blueprint = Blueprint("engine_admin", __name__, url_prefix="/api/admin")
|
||||
|
||||
|
||||
def register(app: Flask) -> None:
|
||||
"""Attach administrative routes to *app*.
|
||||
|
||||
Concrete endpoints will be migrated in subsequent phases.
|
||||
"""
|
||||
|
||||
if "engine_admin" not in app.blueprints:
|
||||
app.register_blueprint(blueprint)
|
||||
|
||||
|
||||
__all__ = ["register", "blueprint"]
|
||||
21
Data/Engine/interfaces/http/agents.py
Normal file
21
Data/Engine/interfaces/http/agents.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Agent HTTP interface placeholders for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from flask import Blueprint, Flask
|
||||
|
||||
|
||||
blueprint = Blueprint("engine_agents", __name__, url_prefix="/api/agents")
|
||||
|
||||
|
||||
def register(app: Flask) -> None:
|
||||
"""Attach agent management routes to *app*.
|
||||
|
||||
Implementation will be populated as services migrate from the legacy server.
|
||||
"""
|
||||
|
||||
if "engine_agents" not in app.blueprints:
|
||||
app.register_blueprint(blueprint)
|
||||
|
||||
|
||||
__all__ = ["register", "blueprint"]
|
||||
21
Data/Engine/interfaces/http/enrollment.py
Normal file
21
Data/Engine/interfaces/http/enrollment.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Enrollment HTTP interface placeholders for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from flask import Blueprint, Flask
|
||||
|
||||
|
||||
blueprint = Blueprint("engine_enrollment", __name__, url_prefix="/api/enrollment")
|
||||
|
||||
|
||||
def register(app: Flask) -> None:
|
||||
"""Attach enrollment routes to *app*.
|
||||
|
||||
Implementation will be ported during later migration phases.
|
||||
"""
|
||||
|
||||
if "engine_enrollment" not in app.blueprints:
|
||||
app.register_blueprint(blueprint)
|
||||
|
||||
|
||||
__all__ = ["register", "blueprint"]
|
||||
21
Data/Engine/interfaces/http/health.py
Normal file
21
Data/Engine/interfaces/http/health.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Health check HTTP interface placeholders for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from flask import Blueprint, Flask
|
||||
|
||||
|
||||
blueprint = Blueprint("engine_health", __name__)
|
||||
|
||||
|
||||
def register(app: Flask) -> None:
|
||||
"""Attach health-related routes to *app*.
|
||||
|
||||
Routes will be populated in later migration phases.
|
||||
"""
|
||||
|
||||
if "engine_health" not in app.blueprints:
|
||||
app.register_blueprint(blueprint)
|
||||
|
||||
|
||||
__all__ = ["register", "blueprint"]
|
||||
21
Data/Engine/interfaces/http/tokens.py
Normal file
21
Data/Engine/interfaces/http/tokens.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Token management HTTP interface placeholders for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from flask import Blueprint, Flask
|
||||
|
||||
|
||||
blueprint = Blueprint("engine_tokens", __name__, url_prefix="/api/tokens")
|
||||
|
||||
|
||||
def register(app: Flask) -> None:
|
||||
"""Attach token management routes to *app*.
|
||||
|
||||
Implementation will be introduced as authentication services are migrated.
|
||||
"""
|
||||
|
||||
if "engine_tokens" not in app.blueprints:
|
||||
app.register_blueprint(blueprint)
|
||||
|
||||
|
||||
__all__ = ["register", "blueprint"]
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from flask import Flask
|
||||
|
||||
from ...config import SocketIOSettings
|
||||
from .agents import register as register_agent_events
|
||||
from .job_management import register as register_job_events
|
||||
|
||||
try: # pragma: no cover - import guard
|
||||
from flask_socketio import SocketIO
|
||||
@@ -31,4 +33,14 @@ def create_socket_server(app: Flask, settings: SocketIOSettings) -> Optional[Soc
|
||||
return socketio
|
||||
|
||||
|
||||
__all__ = ["create_socket_server"]
|
||||
def register_ws_interfaces(socketio: Any) -> None:
|
||||
"""Attach placeholder namespaces for the Engine Socket.IO server."""
|
||||
|
||||
if socketio is None: # pragma: no cover - guard
|
||||
return
|
||||
|
||||
for registrar in (register_agent_events, register_job_events):
|
||||
registrar(socketio)
|
||||
|
||||
|
||||
__all__ = ["create_socket_server", "register_ws_interfaces"]
|
||||
|
||||
16
Data/Engine/interfaces/ws/agents/__init__.py
Normal file
16
Data/Engine/interfaces/ws/agents/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""Agent WebSocket namespace wiring for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from . import events
|
||||
|
||||
|
||||
def register(socketio: Any) -> None:
|
||||
"""Register agent namespaces on the given Socket.IO *socketio* instance."""
|
||||
|
||||
events.register(socketio)
|
||||
|
||||
|
||||
__all__ = ["register"]
|
||||
20
Data/Engine/interfaces/ws/agents/events.py
Normal file
20
Data/Engine/interfaces/ws/agents/events.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""Agent WebSocket event placeholders for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
def register(socketio: Any) -> None:
|
||||
"""Register agent-related namespaces on *socketio*.
|
||||
|
||||
The concrete event handlers will be migrated in later phases.
|
||||
"""
|
||||
|
||||
if socketio is None: # pragma: no cover - guard
|
||||
return
|
||||
# Placeholder for namespace registration, e.g. ``socketio.on_namespace(...)``.
|
||||
return
|
||||
|
||||
|
||||
__all__ = ["register"]
|
||||
16
Data/Engine/interfaces/ws/job_management/__init__.py
Normal file
16
Data/Engine/interfaces/ws/job_management/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""Job management WebSocket namespace wiring for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from . import events
|
||||
|
||||
|
||||
def register(socketio: Any) -> None:
|
||||
"""Register job management namespaces on the given Socket.IO *socketio*."""
|
||||
|
||||
events.register(socketio)
|
||||
|
||||
|
||||
__all__ = ["register"]
|
||||
19
Data/Engine/interfaces/ws/job_management/events.py
Normal file
19
Data/Engine/interfaces/ws/job_management/events.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""Job management WebSocket event placeholders for the Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
def register(socketio: Any) -> None:
|
||||
"""Register job management namespaces on *socketio*.
|
||||
|
||||
Concrete handlers will be migrated in later phases.
|
||||
"""
|
||||
|
||||
if socketio is None: # pragma: no cover - guard
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
__all__ = ["register"]
|
||||
Reference in New Issue
Block a user