Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::inspect::InspectorSession Class Reference

Capability-enforcing dispatch facade. More...

#include <session.hpp>

Public Types

using RequestHandler
using ContextRequestHandler
using ControllerScopeEndHandler
using ClientDisconnectHandler

Public Member Functions

 InspectorSession (InspectorSessionInfo info, InspectorPolicyConfig policy, RequestHandler handler, std::chrono::milliseconds lease_ttl=std::chrono::seconds(15), InspectorControllerLease::Clock clock=[] { return std::chrono::steady_clock::now();})
 InspectorSession (InspectorSessionInfo info, InspectorPolicyConfig policy, ContextRequestHandler handler, std::chrono::milliseconds lease_ttl=std::chrono::seconds(15), InspectorControllerLease::Clock clock=[] { return std::chrono::steady_clock::now();})
 ~InspectorSession ()
InspectorMessage handle (std::string_view client_id, const InspectorMessage &request)
void set_main_thread_rpc (std::shared_ptr< InspectorMainThreadRpc > rpc)
 Install the generation-scoped main-thread handoff used for domain requests.
void set_concurrent_request_handler (std::string method, ContextRequestHandler handler)
 Route one exact authorized method through a handler that is safe to run concurrently on its transport thread.
void set_controller_scope_end_handler (ControllerScopeEndHandler handler)
 Install the host cleanup hook for controller-scoped test input.
void set_client_disconnect_handler (ClientDisconnectHandler handler)
 Install generation-scoped cleanup for per-client domain state.
void set_audit_log (std::shared_ptr< InspectorAuditLog > audit_log)
void disconnect (std::string_view client_id)
void close_dispatch_admission ()
 Refuse new work without waiting for already-admitted concurrent work.
void after_concurrent_dispatches (std::function< void()> completion)
 Run completion after every already-admitted concurrent dispatch has returned.
void suspend_dispatches ()
 Cancel queued domain handlers and reject new ones during server teardown.
void resume_dispatches ()
 Reopen domain-handler admission for a new authenticated server generation.
bool dispatches_accepting () const
 Snapshot whether new domain dispatches are currently admitted.
const InspectorSessionInfo & info () const
const InspectorAccessPolicy & policy () const

Detailed Description

Capability-enforcing dispatch facade.

Transport supplies an authenticated per-connection client identity; the session owns policy and the controller lease, then serializes authorized domain requests before delegating to the attached handler. Session control remains available while a handler runs.

Member Typedef Documentation

◆ ClientDisconnectHandler

Initial value:
std::function<void(std::string_view client_id)>

◆ ContextRequestHandler

Initial value:
std::function<InspectorMessage(
const InspectorRequestContext& context,
const InspectorMessage& request)>
A single inspector protocol message (request, response, or event).
Definition protocol.hpp:18
Authenticated transport identity attached to a domain request.
Definition inspector_delivery.hpp:11

◆ ControllerScopeEndHandler

◆ RequestHandler

Initial value:
std::function<InspectorMessage(const InspectorMessage& request)>

Constructor & Destructor Documentation

◆ InspectorSession() [1/2]

pulp::inspect::InspectorSession::InspectorSession ( InspectorSessionInfo info,
InspectorPolicyConfig policy,
RequestHandler handler,
std::chrono::milliseconds lease_ttl = std::chrono::seconds(15),
InspectorControllerLease::Clock clock = [] { return std::chrono::steady_clock::now();} )

◆ InspectorSession() [2/2]

pulp::inspect::InspectorSession::InspectorSession ( InspectorSessionInfo info,
InspectorPolicyConfig policy,
ContextRequestHandler handler,
std::chrono::milliseconds lease_ttl = std::chrono::seconds(15),
InspectorControllerLease::Clock clock = [] { return std::chrono::steady_clock::now();} )

◆ ~InspectorSession()

pulp::inspect::InspectorSession::~InspectorSession ( )

Member Function Documentation

◆ after_concurrent_dispatches()

void pulp::inspect::InspectorSession::after_concurrent_dispatches ( std::function< void()> completion)

Run completion after every already-admitted concurrent dispatch has returned.

Teardown uses this to break main-thread RPC wait cycles.

◆ close_dispatch_admission()

void pulp::inspect::InspectorSession::close_dispatch_admission ( )

Refuse new work without waiting for already-admitted concurrent work.

Reentrant teardown uses this before deferring the actual drain.

◆ disconnect()

void pulp::inspect::InspectorSession::disconnect ( std::string_view client_id)

◆ dispatches_accepting()

bool pulp::inspect::InspectorSession::dispatches_accepting ( ) const

Snapshot whether new domain dispatches are currently admitted.

◆ handle()

InspectorMessage pulp::inspect::InspectorSession::handle ( std::string_view client_id,
const InspectorMessage & request )

◆ info()

const InspectorSessionInfo & pulp::inspect::InspectorSession::info ( ) const
inline

◆ policy()

const InspectorAccessPolicy & pulp::inspect::InspectorSession::policy ( ) const
inline

◆ resume_dispatches()

void pulp::inspect::InspectorSession::resume_dispatches ( )

Reopen domain-handler admission for a new authenticated server generation.

◆ set_audit_log()

void pulp::inspect::InspectorSession::set_audit_log ( std::shared_ptr< InspectorAuditLog > audit_log)

◆ set_client_disconnect_handler()

void pulp::inspect::InspectorSession::set_client_disconnect_handler ( ClientDisconnectHandler handler)

Install generation-scoped cleanup for per-client domain state.

The callback runs outside session locks and may be called from a transport callback thread; it must hand off to its owner when necessary.

◆ set_concurrent_request_handler()

void pulp::inspect::InspectorSession::set_concurrent_request_handler ( std::string method,
ContextRequestHandler handler )

Route one exact authorized method through a handler that is safe to run concurrently on its transport thread.

This is reserved for operations, such as interruption, that must reach work currently occupying the serialized main-thread lane. Passing an empty handler removes the route.

◆ set_controller_scope_end_handler()

void pulp::inspect::InspectorSession::set_controller_scope_end_handler ( ControllerScopeEndHandler handler)

Install the host cleanup hook for controller-scoped test input.

The callback runs outside session locks and must transfer work to the host's owning thread when the caller is not already on it.

◆ set_main_thread_rpc()

void pulp::inspect::InspectorSession::set_main_thread_rpc ( std::shared_ptr< InspectorMainThreadRpc > rpc)

Install the generation-scoped main-thread handoff used for domain requests.

Session control methods remain synchronous on their caller.

◆ suspend_dispatches()

void pulp::inspect::InspectorSession::suspend_dispatches ( )

Cancel queued domain handlers and reject new ones during server teardown.

The handler already executing on the dispatch owner may finish.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/inspect/include/pulp/inspect/session.hpp