Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::reload::ReloadController Class Reference

#include <reload_controller.hpp>

Classes

struct  Baseline
 The version the controller compares against: the watched file's mtime and content hash it last acted on (or was seeded with). More...

Public Member Functions

 ReloadController (ReloadSession &session, std::filesystem::path logic_path, std::filesystem::path stage_dir={}, ReloadTrustPolicy trust_policy={})
std::optional< ReloadOutcome > poll ()
 Poll once.
ReloadOutcome reload_now ()
 Force a reload regardless of mtime (e.g.
const std::filesystem::path & path () const
std::uint64_t reload_attempts () const
std::optional< Baseline > baseline () const
void set_baseline (const Baseline &b)
 Seed the baseline with the version that is actually live, so the first poll() compares against it instead of adopting whatever the file holds by then.

Static Public Member Functions

static std::optional< std::uint64_t > content_hash (const std::filesystem::path &p)
 Content fingerprint used for change detection (see hash_file).

Constructor & Destructor Documentation

◆ ReloadController()

pulp::format::reload::ReloadController::ReloadController ( ReloadSession & session,
std::filesystem::path logic_path,
std::filesystem::path stage_dir = {},
ReloadTrustPolicy trust_policy = {} )
inline
Parameters
stage_dirwhere versioned copies are staged before loading; must be dlopen-safe. Defaults to the watched file's directory.

Member Function Documentation

◆ baseline()

std::optional< Baseline > pulp::format::reload::ReloadController::baseline ( ) const
inline

◆ content_hash()

std::optional< std::uint64_t > pulp::format::reload::ReloadController::content_hash ( const std::filesystem::path & p)
inlinestatic

Content fingerprint used for change detection (see hash_file).

◆ path()

const std::filesystem::path & pulp::format::reload::ReloadController::path ( ) const
inline

◆ poll()

std::optional< ReloadOutcome > pulp::format::reload::ReloadController::poll ( )
inline

Poll once.

Returns the reload outcome if the file changed since the last poll (and exists), otherwise std::nullopt (no change / missing file / baseline-establishing first call).

◆ reload_attempts()

std::uint64_t pulp::format::reload::ReloadController::reload_attempts ( ) const
inline

◆ reload_now()

ReloadOutcome pulp::format::reload::ReloadController::reload_now ( )
inline

Force a reload regardless of mtime (e.g.

a manual "reload now" command), and resync the baseline so the next poll() doesn't double-fire.

◆ set_baseline()

void pulp::format::reload::ReloadController::set_baseline ( const Baseline & b)
inline

Seed the baseline with the version that is actually live, so the first poll() compares against it instead of adopting whatever the file holds by then.

The shell loads its initial logic at construction and starts polling only after prepare(); without a seed, a build that lands in that gap becomes the baseline and is never reloaded.


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