hakuban 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,32 +17,35 @@ Some of Hakuban's features and properties:
17
17
  - Object identifiers are "rich" (json), not just strings. So, for example, complex user-defined search filter on a web page, expressed as json, can directly act as an identifier of the object holding results of that search.
18
18
  - Object can belong to zero or more tags, which function as wildcards for exposing or observing unknown objects.
19
19
  - Supports tree network topology, with leafs happily unaware of anything not relevant to them.
20
- - Nodes on all levels can observe and expose alike, unlike in most database/graphql-centric solutions.
20
+ - Exchanges on all levels can observe and expose alike, unlike in most database/graphql-centric solutions.
21
21
  - At most one exposer is selected for each object to keep it up to date. With load balancing.
22
- - Thread-safe core, works with async and sync code, delivers events as streams, iterators or callbacks.
22
+ - Thread-safe core, delivers data with streams, accepts data with sinks.
23
23
  - Core is not bound to any specific async-runtime. First implemented network transport uses websockets on tokio.
24
24
  - Allows use of custom de/serializers, uses serde by default.
25
- - Can be compiled to .so, has ruby binding (ffi), and wasm binding in the near future.
25
+ - Can be compiled to .so, has ruby binding (ffi), and wasm/js binding.
26
26
 
27
27
  It's **not** meant for and **won't** do: message passing, remote function calls, synchronous "calls" (request-response), allow explicit target addressing, be a work-queue, allow "consuming" objects, work directly with any database, modify objects in transit.
28
28
 
29
29
 
30
30
  ## Usage example
31
31
  ```rust
32
- let hakuban = hakuban::LocalNode::builder().build();
33
- let observe = hakuban.object((["some-tag"],"xxx")).observe::<String>();
34
-
35
- std::thread::spawn(move || {
36
- let expose = hakuban.object((["some-tag"],"xxx")).expose();
37
- expose.set_object_data(&"aaaaaa");
32
+ let exchange = LocalExchange::builder().build();
33
+ let mut observe_contract = exchange.object((["some-tag"],"xxx")).observe();
34
+ let mut expose_contract = exchange.object((["some-tag"],"xxx")).expose();
35
+
36
+ tokio::spawn(async move {
37
+ //ExposeContract emits ObjectStateSink when first observer appears
38
+ let mut object_state_sink = expose_contract.next().await.unwrap();
39
+ let object_state = ObjectState::new("my data").json_serialize();
40
+ object_state_sink.send(object_state).await;
38
41
  });
39
42
 
40
- for _event in observe.changes() {
41
- if let Some(data) = observe.object_data()? {
42
- println!("{}", data);
43
- break;
44
- }
45
- }
43
+ tokio::spawn(async move {
44
+ //ObserveContract emits ObjectStateStream when exposer uploads first ObjectState
45
+ let mut object_state_stream = observe_contract.next().await.unwrap();
46
+ let object_state = object_state_stream.next().await.unwrap().json_deserialize::<String>();
47
+ println!("{:?}", object_state.data);
48
+ });
46
49
  ```
47
50
 
48
51
  For more examples check out the `examples` directory, and [documentation](https://docs.rs/hakuban/).
@@ -63,7 +66,7 @@ Hakuban compiled to wasm, with JS interface to use in browser.
63
66
  Webapp router, with following properties:
64
67
  * Every link is open-in-new-tab compatible, and copy-link compatible
65
68
  * Short urls, optionally exposing selected state variables
66
- * All urls are shareable
69
+ * All urls (== application states) are shareable
67
70
  * State can be bigger than what fits in a url (as long as it's built progresively)
68
71
  * Works while offline/disconnected (no url shortening then)
69
72
 
@@ -83,10 +86,8 @@ Not ordered by priority:
83
86
  - avoid object flicker on short disconnections
84
87
  - message filter for auth* and auditing
85
88
  - immunity from broken/malicious diffs
86
- - make event pipeline elements destructible
87
89
  - expose introspection/statistics objects
88
- - simplify assignment API
89
-
90
+ - more efficient and simpler network protocol
90
91
 
91
92
  ## License
92
93
 
@@ -95,7 +96,7 @@ Distributed under the MIT License. See `LICENSE` for more information.
95
96
 
96
97
  ## Contact
97
98
 
98
- To get help, praise the author(s), laugh at problems of others, or just hang around observing progress - join hakuban's matrix channel [#hakuban:matrix.org](matrix:r/hakuban:example.org)
99
+ To get help, praise the author(s), laugh at problems of others, or just hang around observing progress - join hakuban's matrix channel [#hakuban:matrix.org](matrix:r/hakuban:matrix.org)
99
100
 
100
101
  If you're looking for more intimate contact, talk to `yunta` - on matrix [@yunta:mikoton.com](matrix:u/yunta:mikoton.com), or email yunta@mikoton.com.
101
102