#pragma once #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" #include typedef bool(*FilterFunc)(const std::string& key); typedef void (*KeyValueProcessor)(void* arg, const std::string& key, const std::string& value); class KVStorageHandler { public: virtual ~KVStorageHandler() = default; virtual void init(const EventGroupHandle_t& system_event_group) = 0; // Store a key-value pair virtual void put(const std::string& key, const std::string& value) = 0; // Retrieve a value by key, returns empty string if key not found virtual std::string get(const std::string& key) const = 0; virtual esp_err_t process_all(KeyValueProcessor processor, void* arg) const = 0; virtual esp_err_t process_filtered(const std::string& key_prefix, KeyValueProcessor processor, void* arg) const = 0; virtual esp_err_t process_filtered(FilterFunc filter_func, KeyValueProcessor processor, void* arg) const = 0; // Delete a key-value pair virtual void remove(const std::string& key) = 0; };