1pub mod types;
10
11pub mod block_storage;
12
13pub mod block;
14
15pub mod object;
16
17pub mod file;
18
19pub mod commit;
20
21pub mod branch;
22
23pub mod repo;
24
25pub mod store;
26
27pub mod event;
28
29pub mod utils;
30
31pub mod errors;
32
33pub mod kcv_storage;
34
35pub mod os_info;
36
37pub use ng_threshold_crypto::PublicKeySet;
38
39#[macro_use]
40extern crate slice_as_array;
41
42pub mod log {
43
44 #[cfg(not(target_arch = "wasm32"))]
45 pub use debug_print::debug_println;
46 #[cfg(target_arch = "wasm32")]
47 pub use gloo_timers;
48 #[cfg(not(target_arch = "wasm32"))]
49 pub use log;
50
51 #[cfg(target_arch = "wasm32")]
52 use wasm_bindgen::prelude::*;
53
54 #[cfg(target_arch = "wasm32")]
55 #[wasm_bindgen]
56 extern "C" {
57 #[wasm_bindgen(js_namespace = console)]
60 pub fn log(s: &str);
61
62 #[wasm_bindgen(js_namespace = console)]
63 pub fn warn(s: &str);
64
65 #[wasm_bindgen(js_namespace = console)]
66 pub fn error(s: &str);
67
68 #[wasm_bindgen(js_namespace = console, js_name = log)]
72 fn log_u32(a: u32);
73
74 #[wasm_bindgen(js_namespace = console, js_name = log)]
76 fn log_many(a: &str, b: &str);
77 }
78
79 #[cfg(all(not(feature = "server_log_output"), not(target_arch = "wasm32")))]
80 #[macro_export]
81 macro_rules! log_info {
82 ($($t:tt)*) => (println!("INFO:{}",format!($($t)*)))
83}
84
85 #[cfg(all(not(feature = "server_log_output"), not(target_arch = "wasm32")))]
86 #[macro_export]
87 macro_rules! log_err {
88 ($($t:tt)*) => (println!("ERR:{}",format!($($t)*)))
89}
90
91 #[cfg(all(not(feature = "server_log_output"), not(target_arch = "wasm32")))]
92 #[macro_export]
93 macro_rules! log_warn {
94 ($($t:tt)*) => (println!("WARN:{}",format!($($t)*)))
95}
96
97 #[cfg(all(not(feature = "server_log_output"), not(target_arch = "wasm32")))]
98 #[macro_export]
99 macro_rules! log_debug {
100 ($($t:tt)*) => (debug_println!("DEBUG:{}",format!($($t)*)))
101}
102
103 #[cfg(all(not(feature = "server_log_output"), not(target_arch = "wasm32")))]
104 #[macro_export]
105 macro_rules! log_trace {
106 ($($t:tt)*) => (debug_println!("TRACE:{}",format!($($t)*)))
107}
108
109 #[cfg(all(feature = "server_log_output", not(target_arch = "wasm32")))]
110 #[macro_export]
111 macro_rules! log_info {
112 ($($t:tt)*) => (log::info!($($t)*))
113}
114
115 #[cfg(all(feature = "server_log_output", not(target_arch = "wasm32")))]
116 #[macro_export]
117 macro_rules! log_err {
118 ($($t:tt)*) => (log::error!($($t)*))
119}
120
121 #[cfg(all(feature = "server_log_output", not(target_arch = "wasm32")))]
122 #[macro_export]
123 macro_rules! log_warn {
124 ($($t:tt)*) => (log::warn!($($t)*))
125}
126
127 #[cfg(all(feature = "server_log_output", not(target_arch = "wasm32")))]
128 #[macro_export]
129 macro_rules! log_debug {
130 ($($t:tt)*) => (log::debug!($($t)*))
131}
132
133 #[cfg(all(feature = "server_log_output", not(target_arch = "wasm32")))]
134 #[macro_export]
135 macro_rules! log_trace {
136 ($($t:tt)*) => (log::trace!($($t)*))
137}
138
139 #[cfg(target_arch = "wasm32")]
140 #[macro_export]
141 macro_rules! log_info {
142 ($($t:tt)*) => (log(&format_args!($($t)*).to_string()))
143}
144
145 #[cfg(target_arch = "wasm32")]
146 #[macro_export]
147 macro_rules! log_err {
148 ($($t:tt)*) => (error(&format_args!($($t)*).to_string()))
149}
150
151 #[cfg(target_arch = "wasm32")]
152 #[macro_export]
153 macro_rules! log_warn {
154 ($($t:tt)*) => (warn(&format_args!($($t)*).to_string()))
155}
156
157 #[cfg(all(debug_assertions, target_arch = "wasm32"))]
158 #[macro_export]
159 macro_rules! log_debug {
160 ($($t:tt)*) => (log(&format!("DEBUG:{}",&format_args!($($t)*).to_string()).to_string()))
161}
162
163 #[cfg(all(debug_assertions, target_arch = "wasm32"))]
164 #[macro_export]
165 macro_rules! log_trace {
166 ($($t:tt)*) => (log(&format!("TRACE:{}",&format_args!($($t)*).to_string()).to_string()))
167}
168
169 #[cfg(all(not(debug_assertions), target_arch = "wasm32"))]
170 #[macro_export]
171 macro_rules! log_debug {
172 ($($t:tt)*) => {};
173 }
174
175 #[cfg(all(not(debug_assertions), target_arch = "wasm32"))]
176 #[macro_export]
177 macro_rules! log_trace {
178 ($($t:tt)*) => {};
179 }
180
181 #[cfg(target_arch = "wasm32")]
182 #[macro_export]
183 macro_rules! sleep {
184 ($($t:tt)*) => (gloo_timers::future::sleep($($t)*).await)
185}
186
187 #[cfg(not(target_arch = "wasm32"))]
188 #[macro_export]
189 macro_rules! sleep {
190 ($($t:tt)*) => (std::thread::sleep($($t)*))
191}
192
193 pub use log_debug;
194 pub use log_err;
195 pub use log_info;
196 pub use log_trace;
197 pub use log_warn;
198 pub use sleep;
199}