@peerbit/native-backbone 0.1.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/LICENSE +202 -0
- package/README.md +27 -0
- package/dist/src/benchmark.d.ts +19 -0
- package/dist/src/benchmark.d.ts.map +1 -0
- package/dist/src/benchmark.js +12 -0
- package/dist/src/benchmark.js.map +1 -0
- package/dist/src/index.d.ts +1561 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +3406 -0
- package/dist/src/index.js.map +1 -0
- package/dist/wasm/README.md +27 -0
- package/dist/wasm/native_backbone.d.ts +1609 -0
- package/dist/wasm/native_backbone.js +10221 -0
- package/dist/wasm/native_backbone_bg.wasm +0 -0
- package/dist/wasm/native_backbone_bg.wasm.d.ts +625 -0
- package/package.json +64 -0
- package/src/append_tx/committed_latest.rs +2063 -0
- package/src/append_tx/committed_no_next.rs +1165 -0
- package/src/append_tx/facts.rs +791 -0
- package/src/append_tx/mod.rs +751 -0
- package/src/append_tx/storage.rs +599 -0
- package/src/benchmark.ts +58 -0
- package/src/coordinates.rs +422 -0
- package/src/documents.rs +1698 -0
- package/src/graph_blocks.rs +362 -0
- package/src/index.ts +9134 -0
- package/src/js_interop.rs +448 -0
- package/src/lib.rs +144 -0
- package/src/profile.rs +164 -0
- package/src/raw_receive.rs +1724 -0
- package/src/shared_log_plan.rs +1464 -0
- package/src/sync_send.rs +180 -0
- package/src/wire_sync.rs +727 -0
package/src/profile.rs
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
use js_sys::Array;
|
|
2
|
+
use peerbit_log_rust::{NativeLogAppendProfile, RawEntryV0PrepareProfile};
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[derive(Clone, Default)]
|
|
6
|
+
pub(crate) struct NativeBackboneAppendProfile {
|
|
7
|
+
pub(crate) storage_append_inner_ms: f64,
|
|
8
|
+
pub(crate) input_copy_ms: f64,
|
|
9
|
+
pub(crate) log_total_ms: f64,
|
|
10
|
+
pub(crate) log_next_clone_ms: f64,
|
|
11
|
+
pub(crate) log_entry_core_ms: f64,
|
|
12
|
+
pub(crate) log_encode_meta_ms: f64,
|
|
13
|
+
pub(crate) log_encode_payload_ms: f64,
|
|
14
|
+
pub(crate) log_encode_signable_ms: f64,
|
|
15
|
+
pub(crate) log_sign_ms: f64,
|
|
16
|
+
pub(crate) log_encode_signature_ms: f64,
|
|
17
|
+
pub(crate) log_encode_storage_ms: f64,
|
|
18
|
+
pub(crate) log_cid_ms: f64,
|
|
19
|
+
pub(crate) log_cid_hash_ms: f64,
|
|
20
|
+
pub(crate) log_cid_string_ms: f64,
|
|
21
|
+
pub(crate) log_index_entry_ms: f64,
|
|
22
|
+
pub(crate) log_facts_ms: f64,
|
|
23
|
+
pub(crate) log_block_put_ms: f64,
|
|
24
|
+
pub(crate) log_graph_put_ms: f64,
|
|
25
|
+
pub(crate) log_trim_ms: f64,
|
|
26
|
+
pub(crate) entry_row_ms: f64,
|
|
27
|
+
pub(crate) trim_rows_ms: f64,
|
|
28
|
+
pub(crate) hash_number_ms: f64,
|
|
29
|
+
pub(crate) coordinate_plan_ms: f64,
|
|
30
|
+
pub(crate) coordinate_core_ms: f64,
|
|
31
|
+
pub(crate) coordinate_fields_build_ms: f64,
|
|
32
|
+
pub(crate) coordinate_value_encode_ms: f64,
|
|
33
|
+
pub(crate) coordinate_journal_put_ms: f64,
|
|
34
|
+
pub(crate) coordinate_index_put_ms: f64,
|
|
35
|
+
pub(crate) coordinate_value_put_ms: f64,
|
|
36
|
+
pub(crate) coordinate_delete_ms: f64,
|
|
37
|
+
pub(crate) document_index_commit_ms: f64,
|
|
38
|
+
pub(crate) document_index_context_encode_ms: f64,
|
|
39
|
+
pub(crate) document_index_extract_ms: f64,
|
|
40
|
+
pub(crate) document_index_value_build_ms: f64,
|
|
41
|
+
pub(crate) document_index_put_ms: f64,
|
|
42
|
+
pub(crate) document_value_put_ms: f64,
|
|
43
|
+
pub(crate) document_index_trim_delete_ms: f64,
|
|
44
|
+
pub(crate) result_row_ms: f64,
|
|
45
|
+
pub(crate) raw_receive_input_copy_ms: f64,
|
|
46
|
+
pub(crate) raw_receive_prepare_ms: f64,
|
|
47
|
+
pub(crate) raw_receive_digest_ms: f64,
|
|
48
|
+
pub(crate) raw_receive_cid_string_ms: f64,
|
|
49
|
+
pub(crate) raw_receive_expected_cid_ms: f64,
|
|
50
|
+
pub(crate) raw_receive_storage_parse_ms: f64,
|
|
51
|
+
pub(crate) raw_receive_meta_parse_ms: f64,
|
|
52
|
+
pub(crate) raw_receive_payload_parse_ms: f64,
|
|
53
|
+
pub(crate) raw_receive_signature_parse_ms: f64,
|
|
54
|
+
pub(crate) raw_receive_signable_ms: f64,
|
|
55
|
+
pub(crate) raw_receive_verify_batch_ms: f64,
|
|
56
|
+
pub(crate) raw_receive_verify_fallback_ms: f64,
|
|
57
|
+
pub(crate) raw_receive_prepare_columns_ms: f64,
|
|
58
|
+
pub(crate) raw_receive_pending_check_ms: f64,
|
|
59
|
+
pub(crate) raw_receive_verify_ms: f64,
|
|
60
|
+
pub(crate) raw_receive_verify_status_ms: f64,
|
|
61
|
+
pub(crate) raw_receive_join_plan_ms: f64,
|
|
62
|
+
pub(crate) raw_receive_remove_ms: f64,
|
|
63
|
+
pub(crate) raw_receive_block_put_ms: f64,
|
|
64
|
+
pub(crate) raw_receive_graph_put_ms: f64,
|
|
65
|
+
pub(crate) raw_receive_coordinate_commit_ms: f64,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
impl NativeBackboneAppendProfile {
|
|
69
|
+
pub(crate) fn add_log_profile(&mut self, profile: &NativeLogAppendProfile) {
|
|
70
|
+
self.log_next_clone_ms += profile.next_clone_ms;
|
|
71
|
+
self.log_entry_core_ms += profile.entry_core_ms;
|
|
72
|
+
self.log_encode_meta_ms += profile.encode_meta_ms;
|
|
73
|
+
self.log_encode_payload_ms += profile.encode_payload_ms;
|
|
74
|
+
self.log_encode_signable_ms += profile.encode_signable_ms;
|
|
75
|
+
self.log_sign_ms += profile.sign_ms;
|
|
76
|
+
self.log_encode_signature_ms += profile.encode_signature_ms;
|
|
77
|
+
self.log_encode_storage_ms += profile.encode_storage_ms;
|
|
78
|
+
self.log_cid_ms += profile.cid_ms;
|
|
79
|
+
self.log_cid_hash_ms += profile.cid_hash_ms;
|
|
80
|
+
self.log_cid_string_ms += profile.cid_string_ms;
|
|
81
|
+
self.log_index_entry_ms += profile.index_entry_ms;
|
|
82
|
+
self.log_facts_ms += profile.facts_ms;
|
|
83
|
+
self.log_block_put_ms += profile.block_put_ms;
|
|
84
|
+
self.log_graph_put_ms += profile.graph_put_ms;
|
|
85
|
+
self.log_trim_ms += profile.trim_ms;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
pub(crate) fn add_raw_prepare_profile(&mut self, profile: &RawEntryV0PrepareProfile) {
|
|
89
|
+
self.raw_receive_digest_ms += profile.digest_ms;
|
|
90
|
+
self.raw_receive_cid_string_ms += profile.cid_string_ms;
|
|
91
|
+
self.raw_receive_expected_cid_ms += profile.expected_cid_ms;
|
|
92
|
+
self.raw_receive_storage_parse_ms += profile.storage_parse_ms;
|
|
93
|
+
self.raw_receive_meta_parse_ms += profile.meta_parse_ms;
|
|
94
|
+
self.raw_receive_payload_parse_ms += profile.payload_parse_ms;
|
|
95
|
+
self.raw_receive_signature_parse_ms += profile.signature_parse_ms;
|
|
96
|
+
self.raw_receive_signable_ms += profile.signable_ms;
|
|
97
|
+
self.raw_receive_verify_batch_ms += profile.verify_batch_ms;
|
|
98
|
+
self.raw_receive_verify_fallback_ms += profile.verify_fallback_ms;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
pub(crate) fn to_row(&self) -> Array {
|
|
102
|
+
let row = Array::new();
|
|
103
|
+
row.push(&JsValue::from_f64(self.storage_append_inner_ms));
|
|
104
|
+
row.push(&JsValue::from_f64(self.input_copy_ms));
|
|
105
|
+
row.push(&JsValue::from_f64(self.log_total_ms));
|
|
106
|
+
row.push(&JsValue::from_f64(self.log_next_clone_ms));
|
|
107
|
+
row.push(&JsValue::from_f64(self.log_entry_core_ms));
|
|
108
|
+
row.push(&JsValue::from_f64(self.log_encode_meta_ms));
|
|
109
|
+
row.push(&JsValue::from_f64(self.log_encode_payload_ms));
|
|
110
|
+
row.push(&JsValue::from_f64(self.log_encode_signable_ms));
|
|
111
|
+
row.push(&JsValue::from_f64(self.log_sign_ms));
|
|
112
|
+
row.push(&JsValue::from_f64(self.log_encode_signature_ms));
|
|
113
|
+
row.push(&JsValue::from_f64(self.log_encode_storage_ms));
|
|
114
|
+
row.push(&JsValue::from_f64(self.log_cid_ms));
|
|
115
|
+
row.push(&JsValue::from_f64(self.log_cid_hash_ms));
|
|
116
|
+
row.push(&JsValue::from_f64(self.log_cid_string_ms));
|
|
117
|
+
row.push(&JsValue::from_f64(self.log_index_entry_ms));
|
|
118
|
+
row.push(&JsValue::from_f64(self.log_facts_ms));
|
|
119
|
+
row.push(&JsValue::from_f64(self.log_block_put_ms));
|
|
120
|
+
row.push(&JsValue::from_f64(self.log_graph_put_ms));
|
|
121
|
+
row.push(&JsValue::from_f64(self.log_trim_ms));
|
|
122
|
+
row.push(&JsValue::from_f64(self.entry_row_ms));
|
|
123
|
+
row.push(&JsValue::from_f64(self.trim_rows_ms));
|
|
124
|
+
row.push(&JsValue::from_f64(self.hash_number_ms));
|
|
125
|
+
row.push(&JsValue::from_f64(self.coordinate_plan_ms));
|
|
126
|
+
row.push(&JsValue::from_f64(self.coordinate_core_ms));
|
|
127
|
+
row.push(&JsValue::from_f64(self.coordinate_fields_build_ms));
|
|
128
|
+
row.push(&JsValue::from_f64(self.coordinate_value_encode_ms));
|
|
129
|
+
row.push(&JsValue::from_f64(self.coordinate_journal_put_ms));
|
|
130
|
+
row.push(&JsValue::from_f64(self.coordinate_index_put_ms));
|
|
131
|
+
row.push(&JsValue::from_f64(self.coordinate_value_put_ms));
|
|
132
|
+
row.push(&JsValue::from_f64(self.coordinate_delete_ms));
|
|
133
|
+
row.push(&JsValue::from_f64(self.document_index_commit_ms));
|
|
134
|
+
row.push(&JsValue::from_f64(self.document_index_context_encode_ms));
|
|
135
|
+
row.push(&JsValue::from_f64(self.document_index_extract_ms));
|
|
136
|
+
row.push(&JsValue::from_f64(self.document_index_value_build_ms));
|
|
137
|
+
row.push(&JsValue::from_f64(self.document_index_put_ms));
|
|
138
|
+
row.push(&JsValue::from_f64(self.document_value_put_ms));
|
|
139
|
+
row.push(&JsValue::from_f64(self.document_index_trim_delete_ms));
|
|
140
|
+
row.push(&JsValue::from_f64(self.result_row_ms));
|
|
141
|
+
row.push(&JsValue::from_f64(self.raw_receive_input_copy_ms));
|
|
142
|
+
row.push(&JsValue::from_f64(self.raw_receive_prepare_ms));
|
|
143
|
+
row.push(&JsValue::from_f64(self.raw_receive_digest_ms));
|
|
144
|
+
row.push(&JsValue::from_f64(self.raw_receive_cid_string_ms));
|
|
145
|
+
row.push(&JsValue::from_f64(self.raw_receive_expected_cid_ms));
|
|
146
|
+
row.push(&JsValue::from_f64(self.raw_receive_storage_parse_ms));
|
|
147
|
+
row.push(&JsValue::from_f64(self.raw_receive_meta_parse_ms));
|
|
148
|
+
row.push(&JsValue::from_f64(self.raw_receive_payload_parse_ms));
|
|
149
|
+
row.push(&JsValue::from_f64(self.raw_receive_signature_parse_ms));
|
|
150
|
+
row.push(&JsValue::from_f64(self.raw_receive_signable_ms));
|
|
151
|
+
row.push(&JsValue::from_f64(self.raw_receive_verify_batch_ms));
|
|
152
|
+
row.push(&JsValue::from_f64(self.raw_receive_verify_fallback_ms));
|
|
153
|
+
row.push(&JsValue::from_f64(self.raw_receive_prepare_columns_ms));
|
|
154
|
+
row.push(&JsValue::from_f64(self.raw_receive_pending_check_ms));
|
|
155
|
+
row.push(&JsValue::from_f64(self.raw_receive_verify_ms));
|
|
156
|
+
row.push(&JsValue::from_f64(self.raw_receive_verify_status_ms));
|
|
157
|
+
row.push(&JsValue::from_f64(self.raw_receive_join_plan_ms));
|
|
158
|
+
row.push(&JsValue::from_f64(self.raw_receive_remove_ms));
|
|
159
|
+
row.push(&JsValue::from_f64(self.raw_receive_block_put_ms));
|
|
160
|
+
row.push(&JsValue::from_f64(self.raw_receive_graph_put_ms));
|
|
161
|
+
row.push(&JsValue::from_f64(self.raw_receive_coordinate_commit_ms));
|
|
162
|
+
row
|
|
163
|
+
}
|
|
164
|
+
}
|