|
|
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".
|
default |
|
inline |
|
inline |
Add another strategy to the end.
Will be last in the item/container FIFO.
|
inline |
Removes all strategies.
|
inlineoverridevirtual |
Checks if any strategy contains the container.
Implements MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Checks if any strategy contains the item.
Implements MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Implements MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Reimplemented from MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Reimplemented from MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Returns all containers over all strategies.
Duplicates are not treated.
Implements MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Returns all items over all strategies.
Duplicates are not treated.
Implements MemoryPersistenceStrategy.
|
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.
|
inlineoverridevirtual |
Retrieves the data of the item following the FIFO principle (if the item exists at any strategy).
Implements MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Retrieves the actual data but also appends the origin which is in this case the strategy identifier.
Reimplemented from MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Sets the export name for all strategies.
Reimplemented from MemoryPersistenceStrategy.
|
inlineoverridevirtual |
Stores the item to every strategy.
Implements MemoryPersistenceStrategy.