|
|
Persistence strategy that writes items (e.g. More...
#include <RobotAPI/libraries/armem/server/ltm/persistence/disk/DiskPersistence.h>
Inheritance diagram for DiskPersistence:Public Member Functions | |
| bool | containsContainer (const armarx::armem::MemoryID &id, std::string key) override |
| Checks if the container is available for the current memory id. | |
| bool | containsItem (const armarx::armem::MemoryID &id, std::string key) override |
| Checks if current container contains the item defined by its key. | |
| void | createPropertyDefinitions (PropertyDefinitionsPtr &defs, const std::string &prefix) override |
| DiskPersistence () | |
| DiskPersistence (const std::filesystem::path &memoryParentPath) | |
| DiskPersistence (const std::string &identifier, const std::string &exportName, const std::filesystem::path &memoryParentPath) | |
| void | flushBatch () |
| Explicitly flush all pending batch writes to disk. | |
| size_t | getBatchPendingCount () const |
| Get the current number of items pending in the batch buffer. | |
| const BatchWriteStatistics & | getBatchStatistics () const |
| Get batch write statistics. | |
| std::vector< std::string > | getContainerKeys (const armarx::armem::MemoryID &id) override |
| Returns all containers for the current id. | |
| std::vector< std::string > | getItemKeys (const armarx::armem::MemoryID &id) override |
| Returns all items for the current id. | |
| size_t | getStorageErrorCount () const |
| bool | isBatchWriteEnabled () const |
| Check if batch writing is enabled. | |
| void | resetBatchStatistics () |
| Reset batch write statistics. | |
| void | resetStorageErrorCount () |
| std::vector< unsigned char > | retrieveItem (const armarx::armem::MemoryID &id, std::string key) override |
| Reads the data of the file with name 'key' at the current location. | |
| void | setBatchSizeThreshold (size_t size) |
| Set the maximum number of items to accumulate before auto-flushing. | |
| void | setBatchTimeThresholdMs (size_t ms) |
| Set the maximum time to hold items before auto-flushing. | |
| void | setBatchWriteEnabled (bool enable) |
| Enable or disable batch writing. | |
| void | setMinAvailableDiskSpace (const int minDiskSpace) |
| void | storeItem (const armarx::armem::MemoryID &id, std::string key, std::vector< unsigned char > &data) override |
| Create a new file with name 'key' and stores the data inside it. | |
| void | validateStoragePermissions () |
| virtual | ~DiskPersistence () |
| Destructor - flushes pending batch and stops batch thread. | |
Public Member Functions inherited from MemoryPersistenceStrategy | |
| virtual void | disable () |
| virtual void | enable () |
| std::string | getExportName () |
| std::string | getIdentifier () |
| virtual bool | isEnabled () |
| MemoryPersistenceStrategy () | |
| MemoryPersistenceStrategy (const std::string &identifier, const std::string &exportName, bool enabled=true) | |
| std::vector< unsigned char > | retrieveItem (const armarx::armem::MemoryID &memoryId, ItemIdentifier itemIdentifier) |
| virtual ItemResult | retrieveItemWithOrigin (const armarx::armem::MemoryID &id, std::string &key) |
| Retrieves the actual data but also appends the origin which is in this case the strategy identifier. | |
| virtual void | setExportName (const std::string &exportName) |
| void | setIdentifier (const std::string &identifier) |
| void | storeItem (const armarx::armem::MemoryID &memoryId, ItemIdentifier itemIdentifer, std::vector< unsigned char > &data) |
| virtual | ~MemoryPersistenceStrategy ()=default |
Public Attributes | |
| int | minDiskSpace = 50 |
Additional Inherited Members | |
Static Public Attributes inherited from MemoryPersistenceStrategy | |
| static const constexpr char * | DATA_FILENAME = "data.aron" |
| static const int | DEPTH_TO_DATA_FILES = 7 |
| static const constexpr char * | MEMORY_EXPORT_SUFFIX = "_" |
| static const constexpr char * | METADATA_FILENAME = "metadata.aron" |
| static const constexpr char * | TYPE_FILENAME = "type.aron" |
Protected Attributes inherited from MemoryPersistenceStrategy | |
| bool | enabled_ = true |
| If false, the strategy is not writing or reading anything. | |
| std::string | exportName_ |
| Name of the specific memory export where our items should be stored. | |
| std::string | identifier_ |
| Name of the strategy. | |
Persistence strategy that writes items (e.g.
json files) to a specific container (a directory) Use it to write the data of a WM to disk.
Where are the items written (=:location)? /memoryParentPath/exportName/path(id)/
How is the file of an item named? -> Just they key (e.g. filename = key = "data.aron.json") If you might want a more sophisticated solution fell free to implement your custom ItemIdentifier today!
Definition at line 106 of file DiskPersistence.h.
|
inline |
Definition at line 109 of file DiskPersistence.h.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
|
inline |
| identifier | basically a unique name for the strategy (important if you use different strategies |
| exportName | identifier for the exported memory. A new directory with name is created beneath the memoryParentPath. Everything is stored inside it. |
| memoryParentPath | path where the memory should be exported to |
Definition at line 123 of file DiskPersistence.h.
Here is the call graph for this function:
|
inlinevirtual |
Destructor - flushes pending batch and stops batch thread.
Definition at line 133 of file DiskPersistence.h.
|
overridevirtual |
Checks if the container is available for the current memory id.
Implements MemoryPersistenceStrategy.
Definition at line 137 of file DiskPersistence.cpp.
Here is the call graph for this function:
|
overridevirtual |
Checks if current container contains the item defined by its key.
Implements MemoryPersistenceStrategy.
Definition at line 153 of file DiskPersistence.cpp.
|
inlineoverridevirtual |
Implements MemoryPersistenceStrategy.
Definition at line 177 of file DiskPersistence.h.
| void flushBatch | ( | ) |
Explicitly flush all pending batch writes to disk.
This is automatically called when batch thresholds are reached.
Definition at line 524 of file DiskPersistence.cpp.
Here is the caller graph for this function:| size_t getBatchPendingCount | ( | ) | const |
Get the current number of items pending in the batch buffer.
Definition at line 530 of file DiskPersistence.cpp.
|
inline |
Get batch write statistics.
Definition at line 237 of file DiskPersistence.h.
|
overridevirtual |
Returns all containers for the current id.
Implements MemoryPersistenceStrategy.
Definition at line 14 of file DiskPersistence.cpp.
Here is the call graph for this function:
|
overridevirtual |
Returns all items for the current id.
Implements MemoryPersistenceStrategy.
Definition at line 97 of file DiskPersistence.cpp.
|
inline |
Definition at line 246 of file DiskPersistence.h.
|
inline |
Check if batch writing is enabled.
Definition at line 209 of file DiskPersistence.h.
|
inline |
Reset batch write statistics.
Definition at line 242 of file DiskPersistence.h.
|
inline |
Definition at line 251 of file DiskPersistence.h.
|
overridevirtual |
Reads the data of the file with name 'key' at the current location.
Implements MemoryPersistenceStrategy.
Definition at line 261 of file DiskPersistence.cpp.
|
inline |
Set the maximum number of items to accumulate before auto-flushing.
| size | Maximum batch size (default: 100) |
Definition at line 215 of file DiskPersistence.h.
|
inline |
Set the maximum time to hold items before auto-flushing.
| ms | Maximum time in milliseconds (default: 100ms) |
Definition at line 221 of file DiskPersistence.h.
| void setBatchWriteEnabled | ( | bool | enable | ) |
Enable or disable batch writing.
When enabled, writes are accumulated and flushed in batches for better I/O performance.
| enable | True to enable batching, false for immediate writes (default behavior) |
Definition at line 466 of file DiskPersistence.cpp.
Here is the call graph for this function:
|
inline |
Definition at line 183 of file DiskPersistence.h.
|
overridevirtual |
Create a new file with name 'key' and stores the data inside it.
Implements MemoryPersistenceStrategy.
Definition at line 164 of file DiskPersistence.cpp.
Here is the call graph for this function:| void validateStoragePermissions | ( | ) |
| int minDiskSpace = 50 |
Definition at line 195 of file DiskPersistence.h.