项目作者: john-sharratt

项目描述 :
Distributed immutable data store with strong encryption and authentication
高级语言: Rust
项目地址: git://github.com/john-sharratt/ate.git
创建时间: 2019-03-22T15:47:49Z
项目社区:https://github.com/john-sharratt/ate

开源协议:Other

下载


ATE

Navigation

What is ATE?

…is it a NoSQL database?
…is it a distributed redo log?
…is it a event BUS?
…is it a API framework?
…is it a distributed queue?
…is it a distributed cache?
…is it a secure encrypted vault?
…is it a quantum resistant communication framework?
…is it a WORM archive solution?

ATE is all these things and none of them; it is unique way to work with distributed
data that can easily implement all of the above use cases - take a look at the examples
for how you can achieve them.

Why the name?

The origin of the word “mutate” is the latin word ‘-ate’:
https://www.dictionary.com/browse/mutate

Summary

ATE is a distributed immutable data store and built in memory based materialized
view with strong encryption and authentication.

What does that mean?

This library is a way of working with data in modern distributed computing.

  • …data is persisted to a distributed commit log.
  • …partitions are divided into chains that shard data into physical domains.
  • …streaming of data to the application occurs on demand as the app needs it.
  • …each chain is a crypto-graph with unique asymmetric keys at differentiating nodes.
  • …the root of the chain-of-trust validates the crypto-graph through various plugins.
  • …strong authentication and authorized is by design built into the data model.
  • …encryption is highly resistant to quantum attacks and uses fine-grained tenant keys.
  • …all this is integrated into a shared-nothing highly portable executable.

Examples

Projects

Typical Deployment Pattern

  1. .-------------. .- - - - - - -.
  2. | Server | Server
  3. | | .. .. .. | | .. .. ..
  4. | >atedb solo |
  5. '------|----\-' '- - - - - - -'
  6. | \
  7. ws://yourserver.com/db
  8. | \
  9. .------|------. \
  10. |Native Client| .-----Browser-----.
  11. | | |.---------------.|
  12. | >program | || >wasm32-wasi ||
  13. | \ate.so | || \ate.wasm ||
  14. '-------------' |'---------------'|
  15. '-----------------'
  16. The easiest way to get up and running is to just build your app and point the
  17. database URL at ws://wasmer.sh/db. You will need to register an account and verify
  18. your identity however after this you can use the free databases and/or paid option.
  19. Alternatively, if you wish to host your own ATE servers in infrastructure that you
  20. manage and run then follow these high-level steps.
  21. 1. Server runs the 'atedb' process on some network reachable location
  22. 2. Create several records for each IP address under the same A-record in your DNS
  23. 3. Either create your own authentication server as well using the auth-server binary
  24. or just use the authentication servers hosted at Wasmer by pointing to
  25. ws://wasmer.sh/auth.

Quick Start

Cargo.toml

  1. [dependencies]
  2. tokio = { version = "*", features = ["full", "signal", "process"] }
  3. serde = { version = "*", features = ["derive"] }
  4. ate = { version = "*" }
  5. wasmer-auth = { version = "*" }

main.rs

  1. use serde::{Serialize, Deserialize};
  2. use wasmer_auth::prelude::*;
  3. #[derive(Debug, Serialize, Deserialize, Clone)]
  4. struct MyData
  5. {
  6. pi: String,
  7. }
  8. #[tokio::main]
  9. async fn main() -> Result<(), Box<dyn std::error::Error>>
  10. {
  11. let dio = DioBuilder::default()
  12. .with_session_prompt().await?
  13. .build("mychain")
  14. .await?;
  15. dio.store(MyData {
  16. pi: "3.14159265359".to_string(),
  17. })?;
  18. dio.commit().await?;
  19. Ok(())
  20. }

Changelog

  1. 1.2.2 -= Code Refactoring =-
  2. + The crypto library has been split out from the main ATE library to reduce dependencies
  3. when using just cryptographic routines and to reduce build times.
  4. 1.2.1 -= Lazy Loading =-
  5. + Subscribing to chains can now load the data in the chain on demand as its needed
  6. which reduces the startup time considerably.
  7. + Temporal clients will default to lazy loading
  8. + Data loaded via the lazy loading mechanism will now be cached client side
  9. 1.1.1 -= Performance and Bug Fixes =-
  10. + Fixed an issue with the web sockets that caused sporadic disconnects
  11. + Improved the performance of web socket messages by reusing IV's
  12. + Reduced the message overhead with a new message encoding format
  13. 1.1.0 -= Comms Upgrade =-
  14. + Streaming websockets are now more stable as they use length headers to delimit messages.
  15. + Fixed a bug where disconnecting clients would drop neighbors on the same server.
  16. + Various changes to the interfaces for stability reasons
  17. (this upgrade is not backwards compatible with version 1.0.6)
  18. 1.0.6 -= Bug Fixes =-
  19. + Modified the interface slightly but most users should not be impacted
  20. + Fixed a bug around validators rejecting events during the subscribe
  21. process that re-reads them from disk - these validators should not be running
  22. + Added the ability to list all root objects
  23. + Added the ability to delete all root objects (and hence wipe a chain)
  24. + Fixed a serious deadlock situation when commiting transactions that was causing timeouts
  25. 1.0.2 -= WASM BUS =-
  26. + Integrated with the WASM bus (wasmer-bus) which allows for ATE to use
  27. the web sockets while running in a controlled sandbox.
  28. 1.0.0 -= Major Release =-
  29. + See [README.md](https://github.com/wasmerio/ate/blob/e0beedbbbd84f95cd6c7a9a45b8903058f65b6fd/README.md)
  30. <=0.8.0 See commit history

High Level Design

  1. .--[ atedb ]---. .--[ atedb ]---. .-[auth-server]-.
  2. | | | | | |
  3. |>local redo-log| |>local redo-log| |>local redo-log|
  4. |.-------------.| |.-------------.| |.-------------.|
  5. || Chain 1 || || || || user ||
  6. || || || Chain 2 || || account ||
  7. |*-------------*| |*------|------*| |*-----|-------*|
  8. | | subscribe login
  9. | \________|_____________________|____
  10. | | |
  11. | >local redo-log
  12. | >Crypto-Graph Materiaized View< (in memory)
  13. | .----------------------------------. session
  14. | | root(hash) | .-----------.
  15. | | | | | -token |
  16. | | dao----dao(aes) |---| -claims |
  17. | | \ | | -keys |
  18. | | dao | *-----------*
  19. | | |

Feature Flags

  • ‘client’ - Client functionality that allows one to connect to ATE datachains
    1. and/or host them locally
  • ‘server’ - Server functionality required to create and run ATE in distributed
    1. mode with the data replicated on server nodes.
  • ‘client_web’ - Client functionality designed for running within a browser sandbox
    1. (--target=wasm32-wasi)

WebAssembly

When compiling for WASM use the following command:

  1. cargo build --target wasm32-wasi --no-default-features --features client_web

Lower Level Example

Cargo.toml

  1. [dependencies]
  2. tokio = { version = "*", features = ["full", "signal", "process"] }
  3. serde = { version = "*", features = ["derive"] }
  4. ate = { version = "*" }

main.rs

  1. use serde::{Serialize, Deserialize};
  2. use ate::prelude::*;
  3. #[derive(Clone, Serialize, Deserialize)]
  4. struct World
  5. {
  6. commandment: String
  7. }
  8. #[tokio::main]
  9. async fn main() -> Result<(), AteError>
  10. {
  11. // The default configuration will store the redo log locally in the temporary folder
  12. let conf = AteConfig::default();
  13. let builder = ChainBuilder::new(&conf).await.build();
  14. // We create a chain with a specific key (this is used for the file name it creates)
  15. let chain = builder.open(&ChainKey::from("universe")).await?;
  16. // We interact with the data stored in the chain-of-trust using a DIO
  17. let session = AteSession::default();
  18. let mut dio = chain.dio(&session).await;
  19. // In this example we store some data in the "World" object
  20. let key = dio.store(World {
  21. commandment: "Hello".to_string(),
  22. })?.key().clone();
  23. dio.commit().await?;
  24. // Now we retreive the data and print it to console
  25. println!("{} world!", dio.load::<World>(&key).await?.commandment);
  26. // All errors in ATE will convert into the AteError
  27. Ok(())
  28. }

Contribution

If you would like to help setup a community to continue to develop this project
then please contact me at johnathan.sharratt@gmail.com"">johnathan.sharratt@gmail.com