ITPub博客

首页 > 数据库 > 数据库开发技术 > 【Rust日报】2021-10-23 几个 Rust 实用工具

【Rust日报】2021-10-23 几个 Rust 实用工具

原创 数据库开发技术 作者:Rust语言中文社区 时间:2021-10-24 19:01:20 0 删除 编辑

Infinitree,嵌入式数据库

Infinitree,具有 3 层缓存的可扩展,加密嵌入式数据库。
use infinitree::{
Infinitree,
Index,
Key,
anyhow,
backends::Directory,
fields::{Serialized, VersionedMap, LocalField},
};
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize)]
pub struct PlantHealth {
id: usize,
air_humidity: usize,
soil_humidity: usize,
temperature: f32
}

#[derive(Index, Default, Clone)]
pub struct Measurements {
// rename the field when serializing
#[infinitree(name = "last_time")]
_old_last_time: Serialized<String>,

#[infinitree(name = "last_time2")]
last_time: Serialized<usize>,

// only store the keys in the index, not the values
#[infinitree(strategy = "infinitree::fields::SparseField")]
measurements: VersionedMap<usize, PlantHealth>,

// skip the next field when loading & serializing
#[infinitree(skip)]
current_time: usize,
}

fn main() -> anyhow::Result<()> {
let mut tree = Infinitree::<Measurements>::empty(
Directory::new("/storage")?,
Key::from_credentials("username", "password")?
);

tree.index().measurements.insert(1, PlantHealth {
id: 0,
air_humidity: 50,
soil_humidity: 60,
temperature: 23.3,
});

*tree.index().last_time.write() = 1;
tree.commit("first measurement! yay!");
Ok(())
}
Github 链接,https://github.com/symmetree-labs/infinitree

一个很酷的 Rust 优化故事

在 Quickwit,我们正在为大数据构建最具成本效益的搜索引擎。我们的整个搜索引擎是用 rust 开发的,搜索的核心是由一个名为tantivy的库提供的。
人们经常问为什么tantivy 在基准测试中的表现优于Lucene,这是一个复杂的问题。许多人认为这是 Rust 比 Java 更快的故事之一,真相要复杂得多。
博客文章 链接,https://quickwit.io/blog/search-a-sorted-block/

Rust 无 runtime 依赖的每日消息

rust-motd,用 Rust 开发的每日消息(MOTD,Message of the Day)实用程序。
Github 链接,https://github.com/rust-motd/rust-motd

Rust 批量重命名工具

SimpleRenamer,一个简单而智能的批量文件重命名工具。
Github 链接,https://github.com/Inspirateur/SimpleRenamer

Rust 开源气象站

weather-station,运行和监控自己的开源气象站所需的一切。
气象站将测量值发送到 API 服务器进行收集,然后 API 服务器将这些数据提供给用户加载到其计算机或移动设备上的 Web 应用程序 (PWA)。
Github 链接,https://github.com/codi-hacks/weather-station

From 日报小组 洋芋

社区学习交流平台订阅:
  • Rustcc论坛: 支持rss
  • 微信公众号:Rust语言中文社区

原文作者:Rust语言中文社区;如有侵权,请联系管理员删除。

请登录后发表评论 登录
全部评论

注册时间:2020-06-11

  • 博文量
    1769
  • 访问量
    718581