mirror of
https://github.com/Ai-Thinker-Open/Ai-Thinker-Open_RTL8710BX_ALIOS_SDK.git
synced 2026-08-28 01:01:34 +00:00
rel_1.6.0 init
This commit is contained in:
commit
27b3e2883d
19359 changed files with 8093121 additions and 0 deletions
65
Living_SDK/include/aos/kv.h
Normal file
65
Living_SDK/include/aos/kv.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
|
||||
*/
|
||||
|
||||
#ifndef AOS_KV_H
|
||||
#define AOS_KV_H
|
||||
|
||||
#include <aos/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Add a new KV pair.
|
||||
*
|
||||
* @param[in] key the key of the KV pair.
|
||||
* @param[in] value the value of the KV pair.
|
||||
* @param[in] len the length of the value.
|
||||
* @param[in] sync save the KV pair to flash right now (should always be 1).
|
||||
*
|
||||
* @return 0 on success, negative error on failure.
|
||||
*/
|
||||
int aos_kv_set(const char *key, const void *value, int len, int sync);
|
||||
|
||||
/**
|
||||
* Get the KV pair's value stored in buffer by its key.
|
||||
*
|
||||
* @note: the buffer_len should be larger than the real length of the value,
|
||||
* otherwise buffer would be NULL.
|
||||
*
|
||||
* @param[in] key the key of the KV pair to get.
|
||||
* @param[out] buffer the memory to store the value.
|
||||
* @param[in-out] buffer_len in: the length of the input buffer.
|
||||
* out: the real length of the value.
|
||||
*
|
||||
* @return 0 on success, negative error on failure.
|
||||
*/
|
||||
int aos_kv_get(const char *key, void *buffer, int *buffer_len);
|
||||
|
||||
/**
|
||||
* Delete the KV pair by its key.
|
||||
*
|
||||
* @param[in] key the key of the KV pair to delete.
|
||||
*
|
||||
* @return 0 on success, negative error on failure.
|
||||
*/
|
||||
int aos_kv_del(const char *key);
|
||||
|
||||
/**
|
||||
* Delete the KV pair by key's prefix.
|
||||
*
|
||||
* @param[in] key the key's prefix of the KV pair to delete.
|
||||
*
|
||||
* @return 0 on success, negative error on failure.
|
||||
*/
|
||||
int aos_kv_del_by_prefix(const char *prefix);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AOS_KV_H */
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue