Set up the daemon for the plugin architecture
parent: tbd commit: d046615
1 | use Error; |
2 | use ; |
3 | |
4 | use Instance; |
5 | |
6 | use Runtime; |
7 | use ; |
8 | use ; |
9 | use |
10 | , | File
11 | , |
12 | , |
13 | , |
14 | ; |
15 | use ; |
16 | use LocalPoolHandle; |
17 | use Table; |
18 | |
19 | |
20 | extern crate tracing; |
21 | |
22 | |
23 | async |
24 | ; | init
25 | let config: Table = |
26 | let mut file = open .await?; |
27 | let mut text = String new; |
28 | file.read_to_string .await?; |
29 | text.parse? |
30 | ; |
31 | let mut listener = bind .await?; |
32 | let db_conn_options = new |
33 | .host |
34 | .port |
35 | .database |
36 | .username |
37 | .password |
38 | .log_statements; |
39 | let db_pool = connect_with .await?; |
40 | |
41 | debug!; |
42 | ! .run .await?; | migrate
43 | info!; |
44 | |
45 | let token_granter = new |
46 | config: config.clone, |
47 | instance: from_str .unwrap, |
48 | ; |
49 | |
50 | info!; |
51 | |
52 | let mut runtime = default; |
53 | |
54 | let runtime = new; |
55 | |
56 | let pool = new; |
57 | |
58 | loop |
59 | let stream = accept_stream .await; |
60 | info!; |
61 | |
62 | let = match stream |
63 | Ok => stream, |
64 | Err => |
65 | error!; |
66 | continue; |
67 | |
68 | ; |
69 | |
70 | info!; |
71 | |
72 | let connection = accept_websocket_connection .await; |
73 | |
74 | let connection = match connection |
75 | Ok => connection, |
76 | Err => |
77 | error! |
78 | "Failed to initiate Websocket connection from {}. {:?}", |
79 | address, err |
80 | ; |
81 | continue; |
82 | |
83 | ; |
84 | |
85 | info!; |
86 | |
87 | let our_instance = |
88 | unwrap; | from_str .
89 | let runtime = runtime.clone; |
90 | |
91 | pool.spawn_pinned; |
92 | |
93 | |
94 | |
95 | async |
96 | let stream = listener.accept .await?; |
97 | |
98 | Ok |
99 | |
100 | |
101 | async |
102 | stream: S, |
103 | |
104 | let connection = accept_async .await?; |
105 | |
106 | Ok |
107 | |
108 |