kv

函数

int aos_kv_init (void)
 
void aos_kv_deinit (void)
 
int aos_kv_set (const char *key, const void *value, int len, int sync)
 
int aos_kv_get (const char *key, void *buffer, int *buffer_len)
 
int aos_kv_del (const char *key)
 
int aos_kv_del_by_prefix (const char *prefix)
 
int aos_kv_secure_set (const char *key, const void *value, int len, int sync)
 
int aos_kv_secure_get (const char *key, void *buffer, int *buffer_len)
 

详细描述

函数说明

◆ aos_kv_deinit()

void aos_kv_deinit ( void  )

Deinit the kv module.

@retrun none

◆ aos_kv_del()

int aos_kv_del ( const char *  key)

Delete the KV pair by its key.

参数
[in]keythe key of the KV pair to delete.
返回
0 on success, negative error on failure.

◆ aos_kv_del_by_prefix()

int aos_kv_del_by_prefix ( const char *  prefix)

Delete the KV pair by its prefix.

参数
[in]prefixthe prefix of the kv pair which is need to delete.
返回
0 on success, negative error on failure.

◆ aos_kv_get()

int aos_kv_get ( const char *  key,
void *  buffer,
int *  buffer_len 
)

Get the KV pair's value stored in buffer by its key.

注解
: the buffer_len should be larger than the real length of the value, otherwise buffer would be NULL.
参数
[in]keythe key of the KV pair to get.
[out]bufferthe memory to store the value.
[in-out]buffer_len in: the length of the input buffer. out: the real length of the value.
返回
0 on success, negative error on failure.

◆ aos_kv_init()

int aos_kv_init ( void  )

Init the kv module.

@retrun 0 on success, otherwise will be failed.

◆ aos_kv_secure_get()

int aos_kv_secure_get ( const char *  key,
void *  buffer,
int *  buffer_len 
)

Get the KV pair's value stored in buffer by its key with decrypt.

注解
: the buffer_len should be larger than the real length of the value, otherwise buffer would be NULL.
参数
[in]keythe key of the KV pair to get.
[out]bufferthe memory to store the value.
[in-out]buffer_len in: the length of the input buffer. out: the real length of the value.
返回
0 on success, negative error on failure.

◆ aos_kv_secure_set()

int aos_kv_secure_set ( const char *  key,
const void *  value,
int  len,
int  sync 
)

Add a new KV pair with encryption.

参数
[in]keythe key of the KV pair.
[in]valuethe value of the KV pair.
[in]lenthe length of the value.
[in]syncsave the KV pair to flash right now (should always be 1).
返回
0 on success, negative error on failure.

◆ aos_kv_set()

int aos_kv_set ( const char *  key,
const void *  value,
int  len,
int  sync 
)

Add a new KV pair.

参数
[in]keythe key of the KV pair.
[in]valuethe value of the KV pair.
[in]lenthe length of the value.
[in]syncsave the KV pair to flash right now (should always be 1).
返回
0 on success, negative error on failure.