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

#include <scan_cache.hpp>

Public Member Functions

std::optional< PluginInfo > get (const std::string &path) const
 Return a cached entry if one exists whose (mtime, size) matches the file on disk today.
void put (const std::string &path, const PluginInfo &info)
 Overwrite (or insert) an entry for path.
void erase (const std::string &path)
 Remove the entry for path (noop if absent).
std::size_t size () const
 Total number of entries currently in memory.
void clear ()
 Drop every entry.
bool save_to (const std::string &file_path) const
 Serialize to a JSON file.
bool load_from (const std::string &file_path)
 Load a JSON file produced by save_to().
std::string to_json () const
bool from_json (const std::string &json)
const std::unordered_map< std::string, ScanCacheEntry > & entries () const

Static Public Attributes

static constexpr int kSchemaVersion = 1
 Schema version; entries loaded with a different version are discarded.

Member Function Documentation

◆ clear()

void pulp::host::HostScanCache::clear ( )
inline

Drop every entry.

◆ entries()

const std::unordered_map< std::string, ScanCacheEntry > & pulp::host::HostScanCache::entries ( ) const
inline

◆ erase()

void pulp::host::HostScanCache::erase ( const std::string & path)

Remove the entry for path (noop if absent).

◆ from_json()

bool pulp::host::HostScanCache::from_json ( const std::string & json)

◆ get()

std::optional< PluginInfo > pulp::host::HostScanCache::get ( const std::string & path) const

Return a cached entry if one exists whose (mtime, size) matches the file on disk today.

Returns std::nullopt on any mismatch or if the file is not readable.

◆ load_from()

bool pulp::host::HostScanCache::load_from ( const std::string & file_path)

Load a JSON file produced by save_to().

Returns false if the file is missing, unreadable, or has a different schema version (cache is then left in its current state — callers can rebuild). Does NOT validate per-entry mtime/size against the filesystem; that happens inside get().

◆ put()

void pulp::host::HostScanCache::put ( const std::string & path,
const PluginInfo & info )

Overwrite (or insert) an entry for path.

Records the current file mtime + size from the filesystem.

◆ save_to()

bool pulp::host::HostScanCache::save_to ( const std::string & file_path) const

Serialize to a JSON file.

Creates parent directories if needed. Returns false on I/O failure.

◆ size()

std::size_t pulp::host::HostScanCache::size ( ) const
inline

Total number of entries currently in memory.

◆ to_json()

std::string pulp::host::HostScanCache::to_json ( ) const

Member Data Documentation

◆ kSchemaVersion

int pulp::host::HostScanCache::kSchemaVersion = 1
staticconstexpr

Schema version; entries loaded with a different version are discarded.


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