|
|
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. | |
| void | clearStrategies () |
| Removes all strategies. | |
| bool | containsContainer (const armarx::armem::MemoryID &id, std::string key) override |
| Checks if any strategy contains the container. | |
| bool | containsItem (const armarx::armem::MemoryID &id, std::string key) override |
| Checks if any strategy contains the item. | |
| 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. | |
| std::vector< std::string > | getItemKeys (const armarx::armem::MemoryID &id) override |
| Returns all items over all strategies. | |
| bool | isEnabled () override |
| Whether anything would actually be stored, i.e. | |
| 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). | |
| 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. | |
| void | setExportName (const std::string &exportName) override |
| Sets the export name for all strategies. | |
| void | storeItem (const armarx::armem::MemoryID &id, const std::string key, std::vector< unsigned char > &data) override |
| Stores the item to every strategy. | |
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. | |
| std::string | exportName_ |
| Name of the specific memory export where our items should be stored. | |
| std::string | identifier_ |
| Name of the strategy. | |
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 24 of file RedundantPersistenceStrategy.h.
|
default |
|
inline |
Definition at line 29 of file RedundantPersistenceStrategy.h.
|
inline |
Add another strategy to the end.
Will be last in the item/container FIFO.
Definition at line 169 of file RedundantPersistenceStrategy.h.
|
inline |
Removes all strategies.
Definition at line 178 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Checks if any strategy contains the container.
Implements MemoryPersistenceStrategy.
Definition at line 75 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Checks if any strategy contains the item.
Implements MemoryPersistenceStrategy.
Definition at line 92 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Implements MemoryPersistenceStrategy.
Definition at line 184 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Reimplemented from MemoryPersistenceStrategy.
Definition at line 212 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Reimplemented from MemoryPersistenceStrategy.
Definition at line 221 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Returns all containers over all strategies.
Duplicates are not treated.
Implements MemoryPersistenceStrategy.
Definition at line 40 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Returns all items over all strategies.
Duplicates are not treated.
Implements MemoryPersistenceStrategy.
Definition at line 58 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Whether anything would actually be stored, i.e.
whether at least one sink is enabled.
storeItem() fans out to every strategy and each skips the write when disabled, so the composite is still doing work as long as one of them is live. A composite holding no strategies stores nothing and is reported disabled, which falls out of this on its own.
This was seeded to false and combined with &=, so it could only ever return false – two mistakes in three lines, unnoticed because nothing calls it yet.
Reimplemented from MemoryPersistenceStrategy.
Definition at line 204 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Retrieves the data of the item following the FIFO principle (if the item exists at any strategy).
Implements MemoryPersistenceStrategy.
Definition at line 123 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Retrieves the actual data but also appends the origin which is in this case the strategy identifier.
Reimplemented from MemoryPersistenceStrategy.
Definition at line 137 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Sets the export name for all strategies.
Reimplemented from MemoryPersistenceStrategy.
Definition at line 154 of file RedundantPersistenceStrategy.h.
|
inlineoverridevirtual |
Stores the item to every strategy.
Implements MemoryPersistenceStrategy.
Definition at line 109 of file RedundantPersistenceStrategy.h.