tea_actor_utility/lib.rs
1//! Tea Project WaSCC Actor Utility Supporting Binary and Sorted Vector Key-Value Pair and Macros
2//! to Build Nats Message Actor Handler
3//!
4//!WaSCC Actors are supposed to be stateless. Global variable and any kind of storage across handler
5//! calls are not recommended (although technically doable). Host provided key-value pair is one of
6//! the handy storage shared across handler functions. WaSCC provided Redis provider and a sample
7//! key-value pair provider.
8//!
9//! There are a few reasons I cannot use them:
10//!
11//! - Redis is over kill.
12//! - Existing key-value pair provider use `String`, I prefer to use `Vec<u8>`
13//! - I need a `Sorted Vec` value type besides the 4 existing types.
14//! - Writing the code direct call from actor is kind of cumbersome. Need an additional actor utility
15//! layer in between.
16//!
17//! There is one more important reason for this later: To use macro to make Nats message actor handler
18//! code clean. See README.md for code sample.
19//!
20//!The actor handler code will look like this
21//! ```
22//! actor_handlers!{
23//! codec::messaging::OP_DELIVER_MESSAGE => handle_nats_message,
24//! codec::core::OP_HEALTH_REQUEST => health
25//! }
26//! actor_messaging_handlers!{
27//! ("http", _, "bootstrap", "sync_from_other_actor",..) => sync_from_other_actor,
28//! ("http", _, "api", "request_active_nodes",..) => request_active_nodes,
29//! //code snipet...
30//! }
31//! ```
32//! Please note the "`_`" act as the "`*`" in the Nats subscription wildcard as well as the "`..`" act
33//! as "`>`" in Nats subject. Think about writing code to handle those `*` and `>` wildcard without the macro.
34//! So I made this library to scrach on my own itch. It can probably help you as well.
35//!
36//! # About the Tea Project
37//!
38//! Tea Project (Trusted Execution & Attestation) is a Wasm runtime build on top of RoT(Root of Trust)
39//! from both trusted hardware environment and blockchain technologies. Developer, Host and Consumer
40//! do not have to trust any others to not only protecting privacy but also preventing cyber attacks.
41//! The execution environment under remoted attestation can be verified by blockchain consensys.
42//! Crypto economy is used as motivation that hosts are willing run trusted computing nodes. This
43//! platform can be used by CDN providers, IPFS Nodes or existing cloud providers to enhance existing
44//! infrastructure to be more secure and trustless.
45//!
46//! Introduction [blog post](https://medium.com/@pushbar/0-of-n-cover-letter-of-the-trusted-webassembly-runtime-on-ipfs-12a4fd8c4338)
47//!
48//! Project [repo](http://github.com/tearust). More and more repo will be exposed soon.
49//!
50//! Yet to come //! project site [( not completed yet) http://www.t-rust.com/](http://www.t-rust.com/)
51//!
52//! Contact: kevin.zhang.canada_at_gmail_dot_com.
53//!
54//! We are just started, all kinds of help are welcome!
55//!
56
57pub extern crate wascc_actor;
58
59// pub use wascc_actor::prelude::{
60// codec, HandlerResult,
61// };
62
63#[macro_use]
64mod macros;
65
66pub mod actor_kvp;
67
68#[cfg(test)]
69mod test {
70 #[macro_use]
71 use super::{actor_messaging_handlers};
72
73
74}