holoscan::DistributedAppService

Beta
View as Markdown

Composite service interface for distributed fragment services.

DistributedAppService combines the FragmentService interface with distributed endpoint capabilities, allowing a single service implementation to:

  • Manage shared resources within a fragment (FragmentService)
  • Act as a driver coordinator in distributed applications (ServiceDriverEndpoint)
  • Act as a worker participant in distributed applications (ServiceWorkerEndpoint)

This composite interface is particularly useful for services that need to synchronize state or coordinate operations across multiple fragments in a distributed Holoscan application. When registered with the application using register_service(), the framework automatically calls the appropriate driver/worker methods based on each fragment’s role.

#include <holoscan/fragment_service.hpp>

In single-fragment applications, only the FragmentService interface is used. The distributed endpoint methods are only called in multi-fragment distributed applications.

Inherits from: holoscan::FragmentService (public), holoscan::distributed::ServiceDriverEndpoint (public), holoscan::distributed::ServiceWorkerEndpoint (public)


Methods

FragmentService

holoscan::FragmentService::FragmentService() = default

Inherit constructors from base classes.

This using declaration enables construction of DistributedAppService using the constructors of FragmentService, ServiceDriverEndpoint, and ServiceWorkerEndpoint, providing flexibility in how derived classes can be initialized.

resource

virtual void holoscan::DistributedAppService::resource(
const std::shared_ptr<Resource> &resource
)

Set the underlying resource managed by this service.

Parameters

resource
const std::shared_ptr<Resource> &

Shared pointer to the resource to be managed.

driver_start

virtual void holoscan::DistributedAppService::driver_start(
std::string_view driver_ip
)

Start the driver endpoint for distributed coordination.

This method is called by the framework on the driver fragment when the distributed application starts. Implementations should initialize any necessary resources for coordinating with worker fragments.

Parameters

driver_ip
std::string_view

The IP address of the driver fragment.

driver_shutdown

virtual void holoscan::DistributedAppService::driver_shutdown()

Shutdown the driver endpoint.

This method is called by the framework when the distributed application is shutting down. Implementations should clean up resources and notify any connected workers of the shutdown.

worker_connect

virtual void holoscan::DistributedAppService::worker_connect(
std::string_view driver_ip
)

Connect the worker endpoint to the driver.

This method is called by the framework on worker fragments to establish a connection with the driver fragment. Implementations should connect to the driver and prepare to participate in distributed operations.

Parameters

driver_ip
std::string_view

The IP address of the driver fragment to connect to.

worker_disconnect

virtual void holoscan::DistributedAppService::worker_disconnect()

Disconnect the worker endpoint from the driver.

This method is called by the framework when the worker needs to disconnect from the driver. Implementations should clean up the connection and any associated resources.