How bandicm/asynco works
Main Components
• Library Core / Asynchronous Engine: Represent the heart of the library that initializes and runs the asynchronous engine (see _asynco_engine.run() in the examples). This core component will manage the overall asynchronous workflow.
• Timers / Scheduler: Identify components for periodic and delayed actions. This part is responsible for scheduling asynchronous timer-based callbacks and keeping track of ticks or expiration states.
• Asynchronous File I/O: Represent a module (or external subsystem) for asynchronous file read and write operations, which internally can leverage ASIO functionality.
• External Dependencies / ASIO: Note that the library is based on Boost ASIO; include a block or annotation that the asynchronous operations and the event loops rely on underlying ASIO services.
Relationships and Interactions
• How asynchronous timer requests pass to a Scheduler component, which, in turn, signals the designated Event Loop in a particular thread.
• For events, show callbacks being registered with Trigger objects, and then events (ticks) being emitted and delivered to those callbacks.
Architectural Patterns and Design Principles
• Modular, header-only design which means that while some logic lives in headers (lib folder), the core mechanics (implementation in src) can be thought of as a “behind the scenes” engine managing asynchronous operations.
• The design follows a decoupled pattern where different aspects (thread management, event scheduling, asynchronous operations) are separate yet interrelated – similar in spirit to microservice modules within a single library.
• Mention the use of callbacks/lambda functions, promises & futures (for await_), and the inheritance pattern for extending event triggers (as seen in the examples with custom classes).
Essential Elements to Capture
• That the client uses functions like async_ and await_ to interact with the engine.
• The engine’s output is the resulting asynchronous operations managing callbacks, timer executions, and file I/O events distributed across multiple parallel threads.
• The interplay between event triggers and their registered callbacks.
• Parameterization such as NUM_OF_RUNNERS as a configuration aspect for the thread pool.
• The Asynchronous Engine core that orchestrates the flow.
• A Thread Pool containing multiple Event Loops.
• A Scheduler for managing timer-based actions.
• An event-driven system (Triggers/Event Emitters) receiving and dispatching events.
• An Async File I/O component interfacing with the engine and ASIO.