Skip to content

feat(bootstrap): implement SystemBootstrapper for runtime binding #176

Description

@kcenon

Summary

Implement a Bootstrapper to handle system initialization at the application level.

Tasks

1. SystemBootstrapper Class

  • Create include/kcenon/common/bootstrap/system_bootstrapper.h
class SystemBootstrapper {
public:
    SystemBootstrapper& with_default_logger(LoggerFactory factory);
    SystemBootstrapper& with_logger(std::string name, LoggerFactory factory);
    SystemBootstrapper& on_initialize(std::function<void()> callback);
    SystemBootstrapper& on_shutdown(std::function<void()> callback);

    VoidResult initialize();
    void shutdown();
};

2. Fluent API Design

  • Support method chaining
  • Factory-based lazy initialization
  • Support initialization/shutdown hooks

3. RAII Support

  • Automatic shutdown() call in destructor
  • Prevent duplicate initialization

Usage Example

SystemBootstrapper bootstrapper;
bootstrapper
    .with_default_logger([] { return create_logger(); })
    .with_logger("database", [] { return create_db_logger(); })
    .on_initialize([] { LOG_INFO("System started"); })
    .on_shutdown([] { LOG_INFO("System stopped"); });

auto result = bootstrapper.initialize();

Test Requirements

  • Normal initialization/shutdown tests
  • Callback execution order tests
  • Exception handling tests

Related Milestone

Metadata

Metadata

Assignees

Labels

ci-cdCI/CD and build automationenhancementNew feature or requestloggingLogging related changes

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions