Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorFsLoader::IDirectoryLoaderSink Class Referenceabstract

Consumer-supplied strategy for a DirectoryLoader. More...

#include <phosphor-fsloader/include/PhosphorFsLoader/IDirectoryLoaderSink.h>

Public Member Functions

virtual ~IDirectoryLoaderSink ()=default
 
virtual std::optional< ParsedEntryparseFile (const QString &filePath)=0
 Parse one file.
 
virtual void commitBatch (const QStringList &removedKeys, const QList< ParsedEntry > &currentEntries)=0
 Apply the result of a full rescan to the sink's registry.
 

Detailed Description

Consumer-supplied strategy for a DirectoryLoader.

The loader handles directory walking, file watching, debouncing, and user-wins-collision bookkeeping; the sink handles per-schema concerns:

parseFile() — turn one file into a ParsedEntry (or skip it). Pure parse; MUST NOT register anything with the target registry. • commitBatch() — apply the full rescan batch (removed + current). This is the one place the sink touches its registry, so bulk signals (e.g. reloadAll) coalesce naturally to one emit per scan.

Implementations are typically per-schema (e.g. CurveLoaderSink, ProfileLoaderSink) and stateless aside from a registry back-reference.

Constructor & Destructor Documentation

◆ ~IDirectoryLoaderSink()

virtual PhosphorFsLoader::IDirectoryLoaderSink::~IDirectoryLoaderSink ( )
virtualdefault

Member Function Documentation

◆ commitBatch()

virtual void PhosphorFsLoader::IDirectoryLoaderSink::commitBatch ( const QStringList &  removedKeys,
const QList< ParsedEntry > &  currentEntries 
)
pure virtual

Apply the result of a full rescan to the sink's registry.

Parameters
removedKeysKeys that were previously in the registry but are no longer present on disk. The sink must unregister each from its target registry.
currentEntriesEvery entry currently on disk (after user-wins collision resolution). The sink registers / replaces each. Entries whose payload is byte-identical to the already- registered value should produce no signal — the target registry's equality guard handles this; the sink just calls registerXxx.

Called exactly once per rescan, after the full directory walk is complete. Sinks are free to batch-replace via a bulk registry call (e.g. PhosphorProfileRegistry::reloadAll) or iterate the list — the loader imposes no shape.

◆ parseFile()

virtual std::optional< ParsedEntry > PhosphorFsLoader::IDirectoryLoaderSink::parseFile ( const QString &  filePath)
pure virtual

Parse one file.

Pure — no registry side effects.

Return an engaged optional with the parsed key + payload on success; return std::nullopt to silently skip the file (the sink is responsible for logging the reason at its own category).

ParsedEntry::systemSourcePath is ignored on return — the loader fills it if this entry overrides an earlier-scanned one.


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