Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::integration::INetworkBridge Class Referenceabstract

Abstract interface for external system integration bridges. More...

#include <bridge_interface.h>

Inheritance diagram for kcenon::network::integration::INetworkBridge:
Inheritance graph
Collaboration diagram for kcenon::network::integration::INetworkBridge:
Collaboration graph

Public Member Functions

virtual ~INetworkBridge ()=default
 
virtual VoidResult initialize (const BridgeConfig &config)=0
 Initialize the bridge with configuration.
 
virtual VoidResult shutdown ()=0
 Shutdown the bridge and release resources.
 
virtual bool is_initialized () const =0
 Check if the bridge is initialized and ready for use.
 
virtual BridgeMetrics get_metrics () const =0
 Get current metrics and health information.
 

Detailed Description

Abstract interface for external system integration bridges.

This interface defines the contract for all integration bridges in network_system. Each bridge provides a consistent way to:

  • Initialize with configuration
  • Manage lifecycle (shutdown)
  • Report health and metrics
  • Check initialization status

Lifecycle:

  1. Construct bridge instance
  2. Call initialize() with configuration
  3. Use bridge functionality
  4. Call shutdown() before destruction

Thread Safety:

  • Implementations should be thread-safe for concurrent metric queries
  • initialize() and shutdown() need not be thread-safe (call from one thread)

Error Handling:

  • All operations return Result<T> for type-safe error propagation
  • Failed initialization should prevent bridge usage
  • Shutdown should always succeed or log errors internally

Definition at line 163 of file bridge_interface.h.

Constructor & Destructor Documentation

◆ ~INetworkBridge()

virtual kcenon::network::integration::INetworkBridge::~INetworkBridge ( )
virtualdefault

Member Function Documentation

◆ get_metrics()

virtual BridgeMetrics kcenon::network::integration::INetworkBridge::get_metrics ( ) const
pure virtual

Get current metrics and health information.

Returns
Current bridge metrics

This method returns health and performance metrics for the bridge. It should be lightweight and suitable for frequent polling.

Thread Safety: Must be safe to call concurrently from multiple threads

Example:

auto metrics = bridge->get_metrics();
if (!metrics.is_healthy) {
std::cerr << "Bridge unhealthy" << std::endl;
}
if (metrics.custom_metrics.count("pending_tasks") > 0) {
std::cout << "Pending tasks: " << metrics.custom_metrics["pending_tasks"] << std::endl;
}

Implemented in kcenon::network::integration::messaging_bridge, kcenon::network::integration::ObservabilityBridge, and kcenon::network::integration::ThreadPoolBridge.

◆ initialize()

virtual VoidResult kcenon::network::integration::INetworkBridge::initialize ( const BridgeConfig & config)
pure virtual

Initialize the bridge with configuration.

Parameters
configConfiguration parameters for the bridge
Returns
ok() on success, error_info on failure

This method must be called before using the bridge. Initialization sets up the external system integration according to the provided configuration.

Error Conditions:

  • Invalid configuration parameters
  • External system unavailable
  • Resource allocation failure
  • Already initialized

Example:

config.integration_name = "thread_system";
config.properties["pool_name"] = "network_pool";
auto result = bridge->initialize(config);
if (result.is_err()) {
std::cerr << "Failed to initialize: " << result.error().message << std::endl;
return;
}
tracing_config config
Definition exporters.cpp:29
Configuration for bridge initialization.

Implemented in kcenon::network::integration::messaging_bridge, kcenon::network::integration::ObservabilityBridge, and kcenon::network::integration::ThreadPoolBridge.

◆ is_initialized()

virtual bool kcenon::network::integration::INetworkBridge::is_initialized ( ) const
pure virtual

Check if the bridge is initialized and ready for use.

Returns
true if initialized, false otherwise

This method provides a quick way to check if the bridge has been successfully initialized and is ready for operation.

Returns false if:

Example:

if (!bridge->is_initialized()) {
std::cerr << "Bridge not initialized" << std::endl;
return;
}
// Use bridge functionality

Implemented in kcenon::network::integration::messaging_bridge, kcenon::network::integration::ObservabilityBridge, and kcenon::network::integration::ThreadPoolBridge.

◆ shutdown()

virtual VoidResult kcenon::network::integration::INetworkBridge::shutdown ( )
pure virtual

Shutdown the bridge and release resources.

Returns
ok() on success, error_info on failure

This method should be called before destroying the bridge. It gracefully shuts down the external system integration and releases any held resources.

Shutdown should be idempotent - calling shutdown() multiple times should not cause errors.

Error Conditions:

  • Resource cleanup failure (should log but not throw)
  • External system communication error

Example:

auto result = bridge->shutdown();
if (result.is_err()) {
std::cerr << "Shutdown error: " << result.error().message << std::endl;
}

Implemented in kcenon::network::integration::messaging_bridge, kcenon::network::integration::ObservabilityBridge, and kcenon::network::integration::ThreadPoolBridge.


The documentation for this class was generated from the following file: