Whitebox Architecture¶
Whitebox is built on a modular, event-driven architecture designed for extensibility and real-time operations.
System Overview¶
- Django Channels Server: Provides the foundation for real-time communication via WebSockets.
- Plugin System: Allows for easy extension of functionality through self-contained modules.
- Event System: Facilitates communication between components and enables reactive architecture.
- Database Integration: Offers persistent storage for flight data with revision history.
- Task Queue & State Synchronization: Ensures reliable task execution and state management across distributed components.
Key Components¶
Django Channels Server¶
- Handles asynchronous requests for improved performance
- Manages WebSocket consumers for real-time, bidirectional communication
- Utilizes channel layers for inter-instance communication
Explore the whitebox codebase to learn more about the server implementation.
Plugin System¶
- Supports dynamic loading and unloading of plugins at runtime from the environment
- Provides isolated environments for each plugin
- Offers standardized APIs for data persistence, event handling and event emission
Explore the plugin codebase to learn more about the plugin implementation.
Event System¶
- Implements an event-driven architecture for decoupled communication
- Allows plugins to register their own events, as well as add callbacks for other plugins' events
- Implements asynchronous event handling for improved responsiveness
Database Integration¶
- Supports PostgreSQL
- Uses Django's ORM for database interactions
- Provides migration support for managing schema changes
Task Queue & State Synchronization¶
This component is a work-in-progress, with the proposed implementation available here: WIP-0005.
- Utilizes RQ and Redis for background task processing
- Ensures state updates & consistency across multi-process workers and distributed components
Real-Time Communication Flow¶
- Clients connect to the server via WebSockets
- Server accepts connections and adds clients to the
flight
group - Clients send commands or requests to the server
- Server processes commands, potentially triggering plugin actions
- Plugins emit events in response to actions or internal processes
- Server broadcasts relevant events to connected clients and other plugins that have subscribed to those events
- Clients update their state based on received events
Next Steps¶
- Check out the Development Guide
- Explore the Plugin Guide for creating custom plugins