MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Registry::Service::NetworkService Struct Reference

Backend network transport service interface. More...

#include <NetworkService.hpp>

+ Collaboration diagram for MayaFlux::Registry::Service::NetworkService:

Public Attributes

std::function< void(uint64_t endpoint_id)> close_endpoint
 Close an endpoint.
 
std::function< std::vector< Core::EndpointInfo >()> get_all_endpoints
 List all open endpoints across all backends.
 
std::function< Core::EndpointState(uint64_t endpoint_id)> get_endpoint_state
 Query endpoint state.
 
std::function< uint64_t(const Core::EndpointInfo &info)> open_endpoint
 Open a network endpoint on the appropriate backend.
 
std::function< bool(uint64_t endpoint_id, const uint8_t *data, size_t size)> send
 Send data through an endpoint.
 
std::function< bool(uint64_t endpoint_id, const uint8_t *data, size_t size, const std::string &address, uint16_t port)> send_to
 Send data to a specific address through an endpoint.
 
std::function< void(uint64_t endpoint_id, std::function< void(uint64_t, const uint8_t *, size_t, std::string_view)> callback)> set_endpoint_receive_callback
 Register a per-endpoint receive callback.
 

Detailed Description

Backend network transport service interface.

Registered into BackendRegistry by NetworkSubsystem. Follows the same service pattern as BufferService, ComputeService, DisplayService, and InputService. Enables any component (nodes, buffer processors, InputManager) to send and receive data over the network without coupling to NetworkSubsystem internals.

Consumption model: callbacks. The receive callback fires on the backend's receive thread. Consumers that need to integrate with coroutine-based workflows can bridge via Kriya::ProcessingGate (poll a flag the callback sets) or, when implemented, via a dedicated Kriya::NetworkReceive awaiter modelled on EventAwaiter.

The coroutine surface is deliberately absent from this initial version. The pattern exists (EventAwaiter), the integration point is clear (set_endpoint_receive_callback resumes a suspended handle), but the awaiter should be added when a concrete use case demands it, not speculatively.

if (!svc) return;
auto ep = svc->open_endpoint({
.transport = NetworkTransport::UDP,
.role = EndpointRole::BIDIRECTIONAL,
.local_port = 8000,
.remote_address = "127.0.0.1",
.remote_port = 9000
});
svc->set_endpoint_receive_callback(ep,
[](uint64_t id, const uint8_t* d, size_t s, std::string_view addr) {
// fires on backend receive thread
});
svc->send(ep, payload.data(), payload.size());
svc->close_endpoint(ep);
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
std::function< uint64_t(const Core::EndpointInfo &info)> open_endpoint
Open a network endpoint on the appropriate backend.
Backend network transport service interface.

Definition at line 49 of file NetworkService.hpp.


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