key-value數據庫:IonDB
IonDB 專為 Arduino 和 IoT 提供開箱即用的,基于磁盤的快速存儲功能,為受限系統提供鍵值存儲功能,速度非常快,可以充分提升 Arduino 的性能。
這個項目是英國哥倫比亞的奧肯那根大學 Ramon Lawrence 博士指導項目的一部分,由 Lawrence 博士的分布式數據實驗室支持。還有另外一個類似的項目,也是專為嵌入式設備和傳感器節點設計的關系型數據庫 LittleD。
一般情況下,IonDB 支持:
-
存儲一個鍵的任意值
-
重復鍵支持
-
范圍和等值查詢
-
基于硬盤的持久化數據存儲
示例:
#include <SD.h>
#include "dictionary.h"
#include "slhandler.h"
void setup() {
//Declare the dictionary and handler structs
dictionary_handler_t handler;
dictionary_t dictionary;
//Initialize handler
sldict_init(&handler);
//Create dictionary: Given handler, dictionary, key type, key size, value size, dict size
dictionary_create(&handler, &dictionary, key_type_numeric_signed, sizeof(int), 60, 10);
ion_key_t key = IONIZE(42);
ion_value_t value = (ion_value_t) "Hello IonDB";
dictionary_insert(&dictionary, key, value);
ion_value_t returned_value = (ion_value_t) malloc(60); //from value_size
dictionary_get(&dictionary, key, returned_value);
printf("Returned %s\n", returned_value);
free(returned_value);
}
void loop() {}
本文由用戶 c8yy 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!