|
| 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.
|
| |
| int | getCompressionLevel () const |
| |
| std::size_t | getCompressionMinBytes () const |
| |
| 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.
|
| |
| bool | isCompressionEnabled () const |
| |
| 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 | setCompressionEnabled (bool enable) |
| | Enable transparent gzip compression of exported JSON files.
|
| |
| void | setCompressionLevel (int level) |
| | zlib level, 1 (fastest) to 9 (smallest). Default 1 - see gzipCompress().
|
| |
| void | setCompressionMinBytes (std::size_t bytes) |
| | Only compress payloads of at least this many bytes.
|
| |
| 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.
|
| |
| 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 |
| |
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!
| void setCompressionEnabled |
( |
bool | enable | ) |
|
|
inline |
Enable transparent gzip compression of exported JSON files.
When enabled, items whose key ends in ".json" and whose payload is at least getCompressionMinBytes() large are gzipped and stored under "<key>.gz". Reading is unaffected: containsItem()/retrieveItem() accept the plain (logical) key and transparently fall back to the ".gz" variant, and getItemKeys() reports logical keys. Exports written before this feature existed therefore keep working, and an export may freely mix both.
The compressed file deliberately gets a ".gz" suffix rather than being compressed in place under the original name: a reader that does not know about compression then simply does not find the file, instead of choking on unparsable content.