key-value数据库:IonDB

c8yy 8年前

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() {}

项目主页:http://www.open-open.com/lib/view/home/1448415429251