#include <TDBStore.h>
Public Types | |
typedef struct mbed::KVStore::info | info_t |
Holds key information. More... | |
Public Member Functions | |
TDBStore (BlockDevice *bd) | |
Class constructor. More... | |
virtual | ~TDBStore () |
Class destructor. More... | |
virtual int | init () |
Initialize TDBStore. More... | |
virtual int | deinit () |
Deinitialize TDBStore, release and free resources. More... | |
virtual int | reset () |
Reset TDBStore contents (clear all keys) and reserved data. More... | |
virtual int | set (const char *key, const void *buffer, size_t size, uint32_t create_flags) |
Set one TDBStore item, given key and value. More... | |
virtual int | get (const char *key, void *buffer, size_t buffer_size, size_t *actual_size=NULL, size_t offset=0) |
Get one TDBStore item by given key. More... | |
virtual int | get_info (const char *key, info_t *info) |
Get information of a given key. More... | |
virtual int | remove (const char *key) |
Remove a TDBStore item by given key. More... | |
virtual int | set_start (set_handle_t *handle, const char *key, size_t final_data_size, uint32_t create_flags) |
Start an incremental TDBStore set sequence. More... | |
virtual int | set_add_data (set_handle_t handle, const void *value_data, size_t data_size) |
Add data to incremental TDBStore set sequence. More... | |
virtual int | set_finalize (set_handle_t handle) |
Finalize an incremental KVStore set sequence. More... | |
virtual int | iterator_open (iterator_t *it, const char *prefix=NULL) |
Start an iteration over KVStore keys. More... | |
virtual int | iterator_next (iterator_t it, char *key, size_t key_size) |
Get next key in iteration. More... | |
virtual int | iterator_close (iterator_t it) |
Close iteration. More... | |
virtual int | reserved_data_set (const void *reserved_data, size_t reserved_data_buf_size) |
Set data in reserved area, which is a special location for special data, such as ROT. More... | |
virtual int | reserved_data_get (void *reserved_data, size_t reserved_data_buf_size, size_t *actual_data_size=0) |
Get data from reserved area, which is a special location for special data, such as ROT. More... | |
bool | is_valid_key (const char *key) const |
Convenience function for checking key validity. More... | |
TDBStore class.
Lightweight Key Value storage over a block device
Definition at line 35 of file TDBStore.h.
|
inherited |
Holds key information.
TDBStore | ( | BlockDevice * | bd | ) |
Class constructor.
[in] | bd | Underlying block device. The BlockDevice can be any BlockDevice with flash characteristics. If using a BlockDevice without flash, such as SDBlockDevice, please add the FlashSimBlockDevice on top of it. |
|
virtual |
Class destructor.
|
virtual |
|
virtual |
Get one TDBStore item by given key.
[in] | key | Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. |
[in] | buffer | Value data buffer. |
[in] | buffer_size | Value data buffer size. |
[out] | actual_size | Actual read size. |
[in] | offset | Offset to read from in data. |
Implements KVStore.
|
virtual |
Get information of a given key.
The returned info contains size and flags
[in] | key | Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. |
[out] | info | Returned information structure. |
Implements KVStore.
|
virtual |
Initialize TDBStore.
If data exists, TDBStore will check the data integrity on initialize. If the integrity checks fails, the TDBStore will use GC to collect the available data and clean corrupted and erroneous records.
Implements KVStore.
|
inherited |
|
virtual |
Close iteration.
[in] | it | Iterator handle. |
Implements KVStore.
|
virtual |
Get next key in iteration.
There are no issues with any other operations while iterator is open.
[in] | it | Iterator handle. |
[in] | key | Buffer for returned key. |
[in] | key_size | Key buffer size. |
Implements KVStore.
|
virtual |
Start an iteration over KVStore keys.
There are no issues with any other operations while iterator is open.
[out] | it | Returned iterator handle. |
[in] | prefix | Key prefix (null for all keys). |
Implements KVStore.
|
virtual |
Remove a TDBStore item by given key.
[in] | key | Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. |
Implements KVStore.
|
virtual |
Get data from reserved area, which is a special location for special data, such as ROT.
[in] | reserved_data | Reserved data buffer. |
[in] | reserved_data_buf_size | Reserved data buffer size. |
[in] | actual_data_size | Return data size. |
|
virtual |
Set data in reserved area, which is a special location for special data, such as ROT.
The data written to reserved area can't be overwritten.
[in] | reserved_data | Reserved data buffer. |
[in] | reserved_data_buf_size | Reserved data buffer size. |
|
virtual |
|
virtual |
Set one TDBStore item, given key and value.
[in] | key | Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. |
[in] | buffer | Value data buffer. |
[in] | size | Value data size. |
[in] | create_flags | Flag mask. |
Implements KVStore.
|
virtual |
Add data to incremental TDBStore set sequence.
This operation is blocking other operations. Any get/set/remove operation will be blocked until set_finalize will be called.
[in] | handle | Incremental set handle. |
[in] | value_data | Value data to add. |
[in] | data_size | Value data size. |
Implements KVStore.
|
virtual |
Finalize an incremental KVStore set sequence.
[in] | handle | Incremental set handle. |
Implements KVStore.
|
virtual |
Start an incremental TDBStore set sequence.
This operation is blocking other operations. Any get/set/remove/iterator operation will be blocked until set_finalize is called.
[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. |
Implements KVStore.