Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
kv_store.h File Reference

Typed key-value store for Infuse-IoT. More...

#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
#include <zephyr/sys/slist.h>

Go to the source code of this file.

Data Structures

struct  kv_store_cb
 KV store callback structure. More...
 

Macros

#define KV_STORE_WRITE(key, data)
 Write a key to the KV store.
 
#define KV_STORE_READ(key, data)
 Read a key from the KV store.
 
#define KV_STORE_READ_FALLBACK(key, data, fallback)
 Read a key from the KV store, with a fallback if it doesn't exist.
 

Functions

void * kv_store_fs (void)
 Get filesystem used by KV store.
 
int kv_store_reset (void)
 Reset key-value storage.
 
void kv_store_register_callback (struct kv_store_cb *cb)
 Register to be notified of KV store events.
 
uint32_t kv_store_reflect_crc (void)
 Get the current KV store reflect CRC.
 
bool kv_store_key_enabled (uint16_t key)
 Check whether a given key is valid for reading/writing.
 
bool kv_store_key_exists (uint16_t key)
 Check whether a given key exists in the store.
 
int kv_store_external_write_only (uint16_t key)
 Check whether a given keys data is valid to return externally.
 
int kv_store_external_read_only (uint16_t key)
 Check whether a given keys data is valid to update externally.
 
ssize_t kv_store_delete (uint16_t key)
 Delete a value from the KV store.
 
ssize_t kv_store_write (uint16_t key, const void *data, size_t data_len)
 Write a value to the KV store.
 
ssize_t kv_store_read (uint16_t key, void *data, size_t max_data_len)
 Read a value from the KV store.
 
ssize_t kv_store_read_fallback (uint16_t key, void *data, size_t max_data_len, const void *fallback, size_t fallback_len)
 Read a key from the KV store, with a fallback if it doesn't exist.
 

Detailed Description

Typed key-value store for Infuse-IoT.

Author
Jordan Yates jorda.nosp@m.n@em.nosp@m.beint.nosp@m..com

SPDX-License-Identifier: FSL-1.1-ALv2

Built on top of Zephyr NVS with the addition of defined types per key