4个版本 (2个重大变更)
0.3.0 | 2022年1月9日 |
---|---|
0.2.1 | 2021年8月11日 |
0.2.0 | 2021年8月10日 |
0.1.0 | 2021年6月7日 |
#1342 in 网络编程
255KB
6K SLoC
Actyx SDK
Actyx 是一个去中心化事件数据库,流式处理和引擎,允许您轻松构建 本地优先协作 应用。它使您能够在多个节点上运行分布式应用变得容易。这是一款软件,允许您在边缘设备上运行自己的应用,并使这些应用能够无缝地相互通信和共享数据。
此crate定义了与Actyx通信所需的数据类型,并为Actyx API提供了Rust绑定。它还提供了在 "dataflow"
功能标志 下使用 differential-dataflow
处理事件的序列化实例。
示例
下面是一个使用 EventService
客户端检索事件的完整示例。请根据您存储的事件调整查询的标签,以查看输出。
注意:此示例需要
client
功能才能编译。
use actyx_sdk::{
app_id, AppManifest, HttpClient,
service::{EventService, Order, QueryRequest, QueryResponse},
};
use futures::stream::StreamExt;
use url::Url;
#[tokio::main]
pub async fn main() -> anyhow::Result<()> {
// add your app manifest, for brevity we will use one in trial mode
let app_manifest = AppManifest::new(
app_id!("com.example.my-awesome-app"),
"display name".into(),
"0.1.0".into(),
None,
);
// Url of the locally running Actyx node
let url = Url::parse("https://127.0.0.1:4454")?;
// create client for it
let service = HttpClient::new(url, app_manifest).await?;
// all events matching the given subscription
// sorted backwards, i.e. youngest to oldest
let mut events = service
.query(QueryRequest {
lower_bound: None,
upper_bound: None,
query: "FROM 'MyFish'".parse()?,
order: Order::Desc,
})
.await?;
// print out the payload of each event
// (cf. Payload::extract for more options)
while let Some(QueryResponse::Event(event)) = events.next().await {
println!("{}", event.payload.json_value());
}
Ok(())
}
功能标志
默认情况下,仅提供支持序列化和反序列化的数据类型。以下功能可以启用
client
:包括使用reqwest
crate 的HTTP客户端绑定dataflow
:提供用于与工具(如Abomonation
)一起使用的Differential Dataflow
实例arb
:为常见数据类型提供quickcheck::Arbitrary
实例。这对于测试很有用。
依赖项
约11–30MB
约518K SLoC