FOSSredder 0.5.0
Loading...
Searching...
No Matches
core::storage::StorageManager Class Reference

Persists workspace session state through atomic store callbacks and latest-path registry access. More...

#include <StorageManager.h>

Inheritance diagram for core::storage::StorageManager:
Collaboration diagram for core::storage::StorageManager:

Public Types

using AtomicStoreSave = core::ports::storage::IStorageManager::AtomicStoreSave
using AtomicStoreLoad = core::ports::storage::IStorageManager::AtomicStoreLoad
using DeletionImpactCallback = core::ports::storage::IStorageManager::DeletionImpactCallback
Public Types inherited from core::ports::storage::IStorageManager
using AtomicStoreSave = std::function<core::domain::DeletionImpact(const std::string& dbPath, const core::application::workspace::WorkspaceSessionState& document)>
 Destroy the storage manager port.
using AtomicStoreLoad = std::function<core::application::workspace::WorkspaceSessionState(const std::string& dbPath)>
using DeletionImpactCallback = std::function<void(const core::domain::DeletionImpact&)>

Public Member Functions

 StorageManager (std::shared_ptr< core::ports::storage::IRegistry > registry=nullptr)
 Creates a storage manager with an optional latest-path registry backend.
void setAtomicStoreSave (AtomicStoreSave saveFn) override
 Configure the atomic save callback.
void setAtomicStoreLoad (AtomicStoreLoad loadFn) override
 Configure the atomic load callback.
void setDeletionImpactCallback (DeletionImpactCallback cb) override
 Configure the deletion impact callback.
std::optional< std::string > loadLatestPath () const override
 Load the latest known path.
core::application::workspace::WorkspaceSessionState loadFrom (const std::string &filePath) override
 Load an application state from a file path.
void save (const core::application::workspace::WorkspaceSessionState &document) override
 Save the current application state.
void saveAs (const std::string &filePath, const core::application::workspace::WorkspaceSessionState &document) override
 Save the current application state to a specific file path.
void createNew (const std::string &filePath) override
 Create a new storage target.
const std::string & currentPath () const noexcept override
 Get the current storage path.
Public Member Functions inherited from core::ports::storage::IStorageManager
virtual ~IStorageManager ()=default

Detailed Description

Persists workspace session state through atomic store callbacks and latest-path registry access.

Definition at line 24 of file StorageManager.h.

Member Typedef Documentation

◆ AtomicStoreLoad

◆ AtomicStoreSave

◆ DeletionImpactCallback

Constructor & Destructor Documentation

◆ StorageManager()

core::storage::StorageManager::StorageManager ( std::shared_ptr< core::ports::storage::IRegistry > registry = nullptr)
explicit

Creates a storage manager with an optional latest-path registry backend.

Definition at line 15 of file StorageManager.cpp.

Member Function Documentation

◆ createNew()

void core::storage::StorageManager::createNew ( const std::string & filePath)
overridevirtual

Create a new storage target.

Parameters
filePathFile path to create.

Implements core::ports::storage::IStorageManager.

Definition at line 92 of file StorageManager.cpp.

◆ currentPath()

const std::string & core::storage::StorageManager::currentPath ( ) const
inlineoverridevirtualnoexcept

Get the current storage path.

Returns
Current storage path.

Implements core::ports::storage::IStorageManager.

Definition at line 41 of file StorageManager.h.

◆ loadFrom()

core::application::workspace::WorkspaceSessionState core::storage::StorageManager::loadFrom ( const std::string & filePath)
overridevirtual

Load an application state from a file path.

Parameters
filePathFile path to load.
Returns
Loaded application state.

Implements core::ports::storage::IStorageManager.

Definition at line 46 of file StorageManager.cpp.

◆ loadLatestPath()

std::optional< std::string > core::storage::StorageManager::loadLatestPath ( ) const
overridevirtual

Load the latest known path.

Returns
Latest path, if one is stored.

Implements core::ports::storage::IStorageManager.

Definition at line 32 of file StorageManager.cpp.

◆ save()

void core::storage::StorageManager::save ( const core::application::workspace::WorkspaceSessionState & document)
overridevirtual

Save the current application state.

Parameters
stateState to save.

Implements core::ports::storage::IStorageManager.

Definition at line 64 of file StorageManager.cpp.

Here is the call graph for this function:

◆ saveAs()

void core::storage::StorageManager::saveAs ( const std::string & filePath,
const core::application::workspace::WorkspaceSessionState & document )
overridevirtual

Save the current application state to a specific file path.

Parameters
filePathTarget file path.
stateState to save.

Implements core::ports::storage::IStorageManager.

Definition at line 72 of file StorageManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAtomicStoreLoad()

void core::storage::StorageManager::setAtomicStoreLoad ( AtomicStoreLoad loadFn)
overridevirtual

Configure the atomic load callback.

Parameters
loadFnLoad callback.

Implements core::ports::storage::IStorageManager.

Definition at line 24 of file StorageManager.cpp.

◆ setAtomicStoreSave()

void core::storage::StorageManager::setAtomicStoreSave ( AtomicStoreSave saveFn)
overridevirtual

Configure the atomic save callback.

Parameters
saveFnSave callback.

Implements core::ports::storage::IStorageManager.

Definition at line 20 of file StorageManager.cpp.

◆ setDeletionImpactCallback()

void core::storage::StorageManager::setDeletionImpactCallback ( DeletionImpactCallback cb)
overridevirtual

Configure the deletion impact callback.

Parameters
cbCallback invoked after save operations.

Implements core::ports::storage::IStorageManager.

Definition at line 28 of file StorageManager.cpp.


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