Add docs
parent: tbd commit: 51aad53
1 | use Error; |
2 | use ; |
3 | use |
4 | , | AuthenticationTokenGranter
5 | , |
6 | connection, listener, |
7 | , | Instance
8 | ; |
9 | use Listeners; |
10 | use ; |
11 | use ; |
12 | use |
13 | , | File
14 | , |
15 | , |
16 | , | Mutex
17 | ; |
18 | use ; |
19 | use Table; |
20 | |
21 | |
22 | extern crate tracing; |
23 | |
24 | |
25 | async |
26 | ; | init
27 | let mut listener = bind .await?; |
28 | let connections: = default; |
29 | let listeners: = default; |
30 | let config: Table = |
31 | let mut file = open .await?; |
32 | let mut text = String new; |
33 | file.read_to_string .await?; |
34 | text.parse? |
35 | ; |
36 | let db_conn_options = new |
37 | .host |
38 | .port |
39 | .database |
40 | .username |
41 | .password |
42 | .log_statements; |
43 | let db_pool = connect_with .await?; |
44 | |
45 | debug!; |
46 | ! .run .await?; | migrate
47 | info!; |
48 | |
49 | let repository_backend: = new |
50 | let foo: GitBackend = GitBackend |
51 | pg_pool: db_pool.clone, |
52 | repository_folder: String from |
53 | config |
54 | .as_str |
55 | .unwrap, |
56 | , |
57 | ; |
58 | foo |
59 | ; |
60 | |
61 | let token_granter = new |
62 | config: config.clone, |
63 | ; |
64 | |
65 | let user_backend: = new |
66 | db_pool, |
67 | & from_str .unwrap, |
68 | token_granter.clone, |
69 | ; |
70 | |
71 | info!; |
72 | |
73 | loop |
74 | let stream = accept_stream .await; |
75 | info!; |
76 | |
77 | let = match stream |
78 | Ok => stream, |
79 | Err => |
80 | error!; |
81 | continue; |
82 | |
83 | ; |
84 | |
85 | info!; |
86 | |
87 | let connection = accept_websocket_connection .await; |
88 | |
89 | let connection = match connection |
90 | Ok => connection, |
91 | Err => |
92 | error! |
93 | "Failed to initiate Websocket connection from {}. {:?}", |
94 | address, err |
95 | ; |
96 | continue; |
97 | |
98 | ; |
99 | |
100 | info!; |
101 | |
102 | let connection = RawConnection |
103 | task: spawn |
104 | connection, |
105 | listeners.clone, |
106 | connections.clone, |
107 | repository_backend.clone, |
108 | user_backend.clone, |
109 | token_granter.clone, |
110 | address, |
111 | , |
112 | ; |
113 | |
114 | connections.lock .await.connections.push; |
115 | |
116 | |
117 | |
118 | async |
119 | let stream = listener.accept .await?; |
120 | |
121 | Ok |
122 | |
123 | |
124 | async |
125 | stream: S, |
126 | |
127 | let connection = accept_async .await?; |
128 | |
129 | Ok |
130 | |
131 |