RedundantPersistenceStrategy Class Reference

Basically the option to use multiple ltm sinks as source or target. More...

#include <RobotAPI/libraries/armem/server/ltm/persistence/RedundantPersistenceStrategy.h>

+ Inheritance diagram for RedundantPersistenceStrategy:

Public Member Functions

void addStrategy (std::shared_ptr< MemoryPersistenceStrategy > strategy)
 Add another strategy to the end. More...
 
void clearStrategies ()
 Removes all strategies. More...
 
bool containsContainer (const armarx::armem::MemoryID &id, std::string key) override
 Checks if any strategy contains the container. More...
 
bool containsItem (const armarx::armem::MemoryID &id, std::string key) override
 Checks if any strategy contains the item. More...
 
void createPropertyDefinitions (PropertyDefinitionsPtr &defs, const std::string &prefix) override
 
void disable () override
 
void enable () override
 
std::vector< std::string > getContainerKeys (const armarx::armem::MemoryID &id) override
 Returns all containers over all strategies. More...
 
std::vector< std::string > getItemKeys (const armarx::armem::MemoryID &id) override
 Returns all items over all strategies. More...
 
bool isEnabled () override
 
 RedundantPersistenceStrategy ()=default
 
 RedundantPersistenceStrategy (std::vector< std::shared_ptr< MemoryPersistenceStrategy >> &strategies)
 
std::vector< unsigned char > retrieveItem (const armarx::armem::MemoryID &id, std::string key) override
 Retrieves the data of the item following the FIFO principle (if the item exists at any strategy). More...
 
ItemResult retrieveItemWithOrigin (const armarx::armem::MemoryID &id, std::string &key) override
 Retrieves the actual data but also appends the origin which is in this case the strategy identifier. More...
 
void setExportName (const std::string &exportName) override
 Sets the export name for all strategies. More...
 
void storeItem (const armarx::armem::MemoryID &id, const std::string key, std::vector< unsigned char > &data) override
 Stores the item to every strategy. More...
 
- Public Member Functions inherited from MemoryPersistenceStrategy
std::string getExportName ()
 
std::string getIdentifier ()
 
 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)
 
void setIdentifier (const std::string &identifier)
 
void storeItem (const armarx::armem::MemoryID &memoryId, ItemIdentifier itemIdentifer, std::vector< unsigned char > &data)
 
virtual ~MemoryPersistenceStrategy ()=default
 

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. 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...
 

Detailed Description

Basically the option to use multiple ltm sinks as source or target.

Holds a list to different persistence strategies potentially also another redundant strategy resulting in tree structure.

Why the name 'redundant'? -> Comes from the possibility to search in multiple ltm sinks for an item or store item to different sinks that are potentially at different location/different implementations. But you won't find any more redundancies features.

What if an item key occurs multiple times? -> FIFO: Strategy that was added first is choosen. In case we have a tree, you go from "left to right through the graph".

Definition at line 22 of file RedundantPersistenceStrategy.h.

Constructor & Destructor Documentation

◆ RedundantPersistenceStrategy() [1/2]

◆ RedundantPersistenceStrategy() [2/2]

RedundantPersistenceStrategy ( std::vector< std::shared_ptr< MemoryPersistenceStrategy >> &  strategies)
inline

Definition at line 27 of file RedundantPersistenceStrategy.h.

Member Function Documentation

◆ addStrategy()

void addStrategy ( std::shared_ptr< MemoryPersistenceStrategy strategy)
inline

Add another strategy to the end.

Will be last in the item/container FIFO.

Definition at line 156 of file RedundantPersistenceStrategy.h.

◆ clearStrategies()

void clearStrategies ( )
inline

Removes all strategies.

Definition at line 164 of file RedundantPersistenceStrategy.h.

◆ containsContainer()

bool containsContainer ( const armarx::armem::MemoryID id,
std::string  key 
)
inlineoverridevirtual

Checks if any strategy contains the container.

Implements MemoryPersistenceStrategy.

Definition at line 69 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ containsItem()

bool containsItem ( const armarx::armem::MemoryID id,
std::string  key 
)
inlineoverridevirtual

Checks if any strategy contains the item.

Implements MemoryPersistenceStrategy.

Definition at line 85 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ createPropertyDefinitions()

void createPropertyDefinitions ( PropertyDefinitionsPtr defs,
const std::string &  prefix 
)
inlineoverridevirtual

Implements MemoryPersistenceStrategy.

Definition at line 169 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ disable()

void disable ( )
inlineoverridevirtual

Reimplemented from MemoryPersistenceStrategy.

Definition at line 189 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ enable()

void enable ( )
inlineoverridevirtual

Reimplemented from MemoryPersistenceStrategy.

Definition at line 197 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ getContainerKeys()

std::vector<std::string> getContainerKeys ( const armarx::armem::MemoryID id)
inlineoverridevirtual

Returns all containers over all strategies.

Duplicates are not treated.

Implements MemoryPersistenceStrategy.

Definition at line 36 of file RedundantPersistenceStrategy.h.

◆ getItemKeys()

std::vector<std::string> getItemKeys ( const armarx::armem::MemoryID id)
inlineoverridevirtual

Returns all items over all strategies.

Duplicates are not treated.

Implements MemoryPersistenceStrategy.

Definition at line 53 of file RedundantPersistenceStrategy.h.

◆ isEnabled()

bool isEnabled ( )
inlineoverridevirtual

Reimplemented from MemoryPersistenceStrategy.

Definition at line 177 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ retrieveItem()

std::vector<unsigned char> retrieveItem ( const armarx::armem::MemoryID id,
std::string  key 
)
inlineoverridevirtual

Retrieves the data of the item following the FIFO principle (if the item exists at any strategy).

Implements MemoryPersistenceStrategy.

Definition at line 112 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ retrieveItemWithOrigin()

ItemResult retrieveItemWithOrigin ( const armarx::armem::MemoryID id,
std::string &  key 
)
inlineoverridevirtual

Retrieves the actual data but also appends the origin which is in this case the strategy identifier.

Reimplemented from MemoryPersistenceStrategy.

Definition at line 125 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ setExportName()

void setExportName ( const std::string &  exportName)
inlineoverridevirtual

Sets the export name for all strategies.

Reimplemented from MemoryPersistenceStrategy.

Definition at line 142 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

◆ storeItem()

void storeItem ( const armarx::armem::MemoryID id,
const std::string  key,
std::vector< unsigned char > &  data 
)
inlineoverridevirtual

Stores the item to every strategy.

Implements MemoryPersistenceStrategy.

Definition at line 101 of file RedundantPersistenceStrategy.h.

+ Here is the call graph for this function:

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