|
Persistence strategy that writes items (e.g. More...
#include <RobotAPI/libraries/armem/server/ltm/persistence/disk/DiskPersistence.h>
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. More... | |
bool | containsItem (const armarx::armem::MemoryID &id, std::string key) override |
Checks if current container contains the item defined by its key. More... | |
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) | |
std::vector< std::string > | getContainerKeys (const armarx::armem::MemoryID &id) override |
Returns all containers for the current id. More... | |
std::vector< std::string > | getItemKeys (const armarx::armem::MemoryID &id) override |
Returns all items for the current id. More... | |
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. More... | |
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. More... | |
![]() | |
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. More... | |
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 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" |
![]() | |
bool | enabled_ = true |
If false, the strategy is not writing or reading anything. More... | |
std::string | exportName_ |
Name of the specific memory export where our items should be stored. More... | |
std::string | identifier_ |
Name of the strategy. More... | |
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 47 of file DiskPersistence.h.
|
inline |
Definition at line 50 of file DiskPersistence.h.
|
inline |
Definition at line 54 of file DiskPersistence.h.
|
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 64 of file DiskPersistence.h.
|
overridevirtual |
Checks if the container is available for the current memory id.
Implements MemoryPersistenceStrategy.
Definition at line 120 of file DiskPersistence.cpp.
|
overridevirtual |
Checks if current container contains the item defined by its key.
Implements MemoryPersistenceStrategy.
Definition at line 145 of file DiskPersistence.cpp.
|
inlineoverridevirtual |
Implements MemoryPersistenceStrategy.
Definition at line 110 of file DiskPersistence.h.
|
overridevirtual |
Returns all containers for the current id.
Implements MemoryPersistenceStrategy.
Definition at line 9 of file DiskPersistence.cpp.
|
overridevirtual |
Returns all items for the current id.
Implements MemoryPersistenceStrategy.
Definition at line 95 of file DiskPersistence.cpp.
|
overridevirtual |
Reads the data of the file with name 'key' at the current location.
Implements MemoryPersistenceStrategy.
Definition at line 180 of file DiskPersistence.cpp.
|
inline |
Definition at line 116 of file DiskPersistence.h.
|
overridevirtual |
Create a new file with name 'key' and stores the data inside it.
Implements MemoryPersistenceStrategy.
Definition at line 157 of file DiskPersistence.cpp.
int minDiskSpace = 50 |
Definition at line 128 of file DiskPersistence.h.