Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
KVStore Class Reference
#include <KVStore.h>
Inherited by FileSystemStore, SecureStore, and TDBStore.
Data Structures | |
| struct | info |
| Holds key information. More... | |
Public Types | |
| typedef struct mbed::KVStore::info | info_t |
| Holds key information. | |
Public Member Functions | |
| virtual int | init ()=0 |
| Initialize KVStore. | |
| virtual int | deinit ()=0 |
| Deinitialize KVStore. | |
| virtual int | reset ()=0 |
| Reset KVStore contents (clear all keys) | |
| virtual int | set (const char *key, const void *buffer, size_t size, uint32_t create_flags)=0 |
| Set one KVStore item, given key and value. | |
| virtual int | get (const char *key, void *buffer, size_t buffer_size, size_t *actual_size=NULL, size_t offset=0)=0 |
| Get one KVStore item, given key. | |
| virtual int | get_info (const char *key, info_t *info=NULL)=0 |
| Get information of a given key. | |
| virtual int | remove (const char *key)=0 |
| Remove a KVStore item, given key. | |
| virtual int | set_start (set_handle_t *handle, const char *key, size_t final_data_size, uint32_t create_flags)=0 |
| Start an incremental KVStore set sequence. | |
| virtual int | set_add_data (set_handle_t handle, const void *value_data, size_t data_size)=0 |
| Add data to incremental KVStore set sequence. | |
| virtual int | set_finalize (set_handle_t handle)=0 |
| Finalize an incremental KVStore set sequence. | |
| virtual int | iterator_open (iterator_t *it, const char *prefix=NULL)=0 |
| Start an iteration over KVStore keys. | |
| virtual int | iterator_next (iterator_t it, char *key, size_t key_size)=0 |
| Get next key in iteration. | |
| virtual int | iterator_close (iterator_t it)=0 |
| Close iteration. | |
| bool | is_valid_key (const char *key) const |
| Convenience function for checking key validity. | |
Detailed Description
KVStore class.
Interface class for Key Value Storage
Definition at line 30 of file KVStore.h.
Member Typedef Documentation
| typedef struct mbed::KVStore::info info_t |
Holds key information.
Member Function Documentation
| virtual int deinit | ( | ) | [pure virtual] |
Deinitialize KVStore.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int get | ( | const char * | key, |
| void * | buffer, | ||
| size_t | buffer_size, | ||
| size_t * | actual_size = NULL, |
||
| size_t | offset = 0 |
||
| ) | [pure virtual] |
Get one KVStore item, given key.
- Parameters:
-
[in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. [in] buffer Value data buffer. [in] buffer_size Value data buffer size. [out] actual_size Actual read size (NULL to pass nothing). [in] offset Offset to read from in data.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int get_info | ( | const char * | key, |
| info_t * | info = NULL |
||
| ) | [pure virtual] |
Get information of a given key.
- Parameters:
-
[in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. [out] info Returned information structure (NULL to pass nothing).
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int init | ( | ) | [pure virtual] |
Initialize KVStore.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| bool is_valid_key | ( | const char * | key ) | const |
| virtual int iterator_close | ( | iterator_t | it ) | [pure virtual] |
Close iteration.
- Parameters:
-
[in] it Iterator handle.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int iterator_next | ( | iterator_t | it, |
| char * | key, | ||
| size_t | key_size | ||
| ) | [pure virtual] |
Get next key in iteration.
- Parameters:
-
[in] it Iterator handle. [in] key Buffer for returned key. [in] key_size Key buffer size.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int iterator_open | ( | iterator_t * | it, |
| const char * | prefix = NULL |
||
| ) | [pure virtual] |
Start an iteration over KVStore keys.
- Parameters:
-
[out] it Returned iterator handle. [in] prefix Key prefix (null for all keys).
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int remove | ( | const char * | key ) | [pure virtual] |
Remove a KVStore item, given key.
- Parameters:
-
[in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int reset | ( | ) | [pure virtual] |
Reset KVStore contents (clear all keys)
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int set | ( | const char * | key, |
| const void * | buffer, | ||
| size_t | size, | ||
| uint32_t | create_flags | ||
| ) | [pure virtual] |
Set one KVStore item, given key and value.
- Parameters:
-
[in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. [in] buffer Value data buffer. [in] size Value data size. [in] create_flags Flag mask.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in FileSystemStore, SecureStore, and TDBStore.
| virtual int set_add_data | ( | set_handle_t | handle, |
| const void * | value_data, | ||
| size_t | data_size | ||
| ) | [pure virtual] |
Add data to incremental KVStore set sequence.
- Parameters:
-
[in] handle Incremental set handle. [in] value_data Value data to add. [in] data_size Value data size.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in SecureStore, and TDBStore.
| virtual int set_finalize | ( | set_handle_t | handle ) | [pure virtual] |
Finalize an incremental KVStore set sequence.
- Parameters:
-
[in] handle Incremental set handle.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in SecureStore, and TDBStore.
| virtual int set_start | ( | set_handle_t * | handle, |
| const char * | key, | ||
| size_t | final_data_size, | ||
| uint32_t | create_flags | ||
| ) | [pure virtual] |
Start an incremental KVStore set sequence.
- Parameters:
-
[out] handle Returned incremental set handle. [in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. [in] final_data_size Final value data size. [in] create_flags Flag mask.
- Returns:
- MBED_SUCCESS on success or an error code on failure
Implemented in SecureStore, and TDBStore.
Generated on Tue Jul 12 2022 13:55:43 by
1.7.2