How captainwc/cyberrt works
Main Components
• Core Runtime (cyber): This is the heart of the system. Include its entry points (e.g., cyber.cc, cyber/init.cc) and the overall management for initializing the framework.
• Communication and Data Transport Layer: Represent the “transport”, “message”, “io”, and “data” directories. These contain modules for inter-process communication (IPC), data dispatching, and message construction.
• Scheduling and Task Management: Include the “scheduler” (with its classic and choreography contexts), “task”, “timer”, and “croutine” modules. These ensure that tasks (or periodic events) are efficiently scheduled and executed.
• Discovery and Dynamic Loading: Display the “service_discovery” and “class_loader” modules, which handle runtime service discovery and dynamic module loading.
• Logging and Record: Represent both “logger” and “record” modules that provide asynchronous logging and record/playback functionality.
• Configuration: Represent the “conf” directory that holds configuration files for scheduling (control, compute, etc.) and system-wide flag settings.
• Third Party Dependencies and Build System: Although not an architectural part per se, include a side note that third_party libraries (e.g., fastrtps, absl, gflags) are vital for low-level functionalities.
Relationships and Interactions
• How nodes communicate with each other via the transport layer.
• How the scheduler dispatches tasks to thread pools or croutines, integrating with timers.
• How the service discovery mechanism interacts with node and channel management.
• How the logging system collects runtime data, while the record subsystem captures message streams for playback.
• Python wrapper (cyber_py3) as an abstraction that calls down into the C++ core.
Architectural Patterns and Design Principles
• Modularity: Emphasize that each subsystem (communication, scheduler, data handling) is independent and plug-and-play.
• Concurrency/Parallelism: Indicate usage of thread pools, locks (such as reentrant and atomic locks in “cyber/base”), and asynchronous handling (via croutines and timers).
• Dynamic Loading: Note how class_loader and shared_library components enable runtime extensibility.
• Abstraction Layers: Separate the low-level transport/message components from higher-level node/service interfaces.
• Messaging Paradigm: From the “message” and “transport” directories, it’s clear the system relies on efficient serialization, publish-subscribe, and possibly RTPS protocols.
Relevant Technologies and Frameworks
• Bazel for build automation and dependency management.
• Fast RTPS (fastrtps) for low-latency messaging.
• Protobuf for message definitions and serialization.
• The use of additional third party libraries (absl, glog, gtest) that support core functionalities.
• Side annotations for external dependencies (fastrtps, third_party libraries) that cross-cut certain functionalities.