IonDB鍵值數(shù)據(jù)庫
IonDB 專為 Arduino 和 IoT 提供開箱即用的,基于磁盤的快速存儲(chǔ)功能,為受限系統(tǒng)提供鍵值存儲(chǔ)功能,速度非???,可以充分提升 Arduino 的性能。
這個(gè)項(xiàng)目是英國哥倫比亞的奧肯那根大學(xué) Ramon Lawrence 博士指導(dǎo)項(xiàng)目的一部分,由 Lawrence 博士的分布式數(shù)據(jù)實(shí)驗(yàn)室支持。還有另外一個(gè)類似的項(xiàng)目,也是專為嵌入式設(shè)備和傳感器節(jié)點(diǎn)設(shè)計(jì)的關(guān)系型數(shù)據(jù)庫 LittleD。
一般情況下,IonDB 支持:
存儲(chǔ)一個(gè)鍵的任意值
重復(fù)鍵支持
范圍和等值查詢
基于硬盤的持久化數(shù)據(jù)存儲(chǔ)
示例:
#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() {}評論
圖片
表情
