Rust.cc

Rust.cc -

【Rust日报】2023-08-16 Neon -- 基于 rust 的 AWS Aurora Postgres 的无服务器开源替代品

Neon -- AWS Aurora Postgres 的无服务器开源替代品 简介 Neon 是 AWS Aurora Postgres 的无服务器开源替代品。它将存储和计算分开,并通过跨节点集群重新分布数据来替代 PostgreSQL 存储层。 尝试使用 Neon 免费套餐创建无服务器 Postgres 实例。然后使用您首选的 Postgres 客户端(psql、dbeaver 等)连接到它或使用在线 SQL 编辑器。有关连接说明,请参阅从任何应用程序连接。或者,在本地编译并运行该项目。 架构概述 Neon 由计算节点和 Neon 存储引擎组成。计算节点是由 Neon 存储引擎支持的无状态 PostgreSQL 节点。 Neon 存储引擎由两个主要组件组成: Pageserver - 计算节点的可扩展存储后端。 Safekeepers - Safekeepers 形成一个冗余的 WAL 服务,从计算节点接收 WAL,并将其持久存储,直到它被 Pageserver 处理并上传到云存储。 https://github.com/neondatabase/neon Rusqlite 使用 Rust 的 SQLite 包装器 Rusqlite 是一个使用 Rust 的 SQLite 的符合人体工程学的包装器。从历史上看,该 API 是基于 rust-postgres. 然而,两者在很多方面存在分歧,并且两者之间不存在兼容性。 使用 在您的 Cargo.toml 中: [dependencies] # `bundled` causes us to automatically compile and link in an up to date # version of SQLite for you. This avoids many common build issues, and # avoids depending on the version of SQLite on the users system (or your # system), which may be old or missing. It's the right choice for most # programs that control their own SQLite databases. # # That said, it's not ideal for all scenarios and in particular, generic # libraries built around `rusqlite` should probably not enable it, which # is why it is not a default feature -- it could become hard to disable. rusqlite = { version = "0.29.0", features = ["bundled"] } 简单示例用法: use rusqlite::{Connection, Result}; #[derive(Debug)] struct Person { id: i32, name: String, data: Option<Vec<u8>>, } fn main() -> Result<()> { let conn = Connection::open_in_memory()?; conn.execute( "CREATE TABLE person ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, data BLOB )", (), // empty list of parameters. )?; let me = Person { id: 0, name: "Steven".to_string(), data: None, }; conn.execute( "INSERT INTO person (name, data) VALUES (?1, ?2)", (&me.name, &me.data), )?; let mut stmt = conn.prepare("SELECT id, name, data FROM person")?; let person_iter = stmt.query_map([], |row| { Ok(Person { id: row.get(0)?, name: row.get(1)?, data: row.get(2)?, }) })?; for person in person_iter { println!("Found person {:?}", person.unwrap()); } Ok(()) } 支持的 SQLite 版本 基础 rusqlite 包支持 SQLite 版本 3.14.0 或更高版本。如果您需要旧版本的支持,请提出问题。一些货物功能需要更新的 SQLite 版本;请参阅下面的详细信息。 https://github.com/rusqlite/rusqlite From 日报小组 侯盛鑫 社区学习交流平台订阅: Rustcc论坛: 支持rss 微信公众号:Rust语言中文社区

Neon是AWS Aurora Postgres的无服务器开源替代品,通过分离存储和计算,并重新分布数据来替代PostgreSQL存储层。Rusqlite是一个使用Rust的SQLite包装器,支持SQLite版本3.14.0或更高版本。

AWS Aurora Postgres Neon Rusqlite aurora postgres rust 开源 开源替代品 无服务器

相关推荐 去reddit讨论

热榜 Top10

观测云
观测云
LigaAI
LigaAI
Dify.AI
Dify.AI
eolink
eolink

推荐或自荐