Completely refactor project structure
parent: tbd commit: ae8ff44
1 | use Error; |
2 | |
3 | use crate:: |
4 | , | GitBackendError
5 | , |
6 | ; |
7 | use |
8 | RepositoryCreateRequest, RepositoryFileInspectRequest, RepositoryInfoRequest, |
9 | RepositoryIssueLabelsRequest, RepositoryIssuesCountRequest, RepositoryIssuesRequest, |
10 | ; |
11 | |
12 | use ConnectionState; |
13 | |
14 | pub async |
15 | message_type: &str, |
16 | message: &NetworkMessage, |
17 | state: &ConnectionState, |
18 | |
19 | match message_type |
20 | "&giterated_daemon::messages::repository::RepositoryCreateRequest" => |
21 | create_repository.handle_message .await?; |
22 | |
23 | Ok |
24 | |
25 | "&giterated_daemon::messages::repository::RepositoryFileInspectRequest" => |
26 | repository_file_inspect |
27 | .handle_message |
28 | .await?; |
29 | |
30 | Ok |
31 | |
32 | "&giterated_daemon::messages::repository::RepositoryInfoRequest" => |
33 | repository_info.handle_message .await?; |
34 | |
35 | Ok |
36 | |
37 | "&giterated_daemon::messages::repository::RepositoryIssuesCountRequest" => |
38 | issues_count.handle_message .await?; |
39 | |
40 | Ok |
41 | |
42 | "&giterated_daemon::messages::repository::RepositoryIssueLabelsRequest" => |
43 | issue_labels.handle_message .await?; |
44 | |
45 | Ok |
46 | |
47 | "&giterated_daemon::messages::repository::RepositoryIssuesRequest" => |
48 | issues.handle_message .await?; |
49 | |
50 | Ok |
51 | |
52 | _ => Ok, |
53 | |
54 | |
55 | |
56 | async |
57 | Message | : ,
58 | State | : ,
59 | AuthenticatedUser | : AuthenticatedUser,
60 | |
61 | let mut repository_backend = connection_state.repository_backend.lock .await; |
62 | let response = repository_backend |
63 | .create_repository |
64 | .await?; |
65 | |
66 | drop; |
67 | |
68 | connection_state.send .await?; |
69 | |
70 | Ok |
71 | |
72 | |
73 | async |
74 | Message | : ,
75 | State | : ,
76 | user: , |
77 | |
78 | let user = user.map; |
79 | |
80 | let mut repository_backend = connection_state.repository_backend.lock .await; |
81 | let response = repository_backend |
82 | .repository_file_inspect |
83 | .await?; |
84 | |
85 | drop; |
86 | |
87 | connection_state.send .await?; |
88 | |
89 | Ok |
90 | |
91 | |
92 | async |
93 | Message | : ,
94 | State | : ,
95 | user: , |
96 | |
97 | let user = user.map; |
98 | |
99 | let mut repository_backend = connection_state.repository_backend.lock .await; |
100 | let response = repository_backend |
101 | .repository_info |
102 | .await?; |
103 | |
104 | drop; |
105 | |
106 | connection_state.send .await?; |
107 | |
108 | Ok |
109 | |
110 | |
111 | async |
112 | Message | : ,
113 | State | : ,
114 | _user: , |
115 | |
116 | unimplemented!; |
117 | |
118 | |
119 | async |
120 | Message | : ,
121 | State | : ,
122 | _user: , |
123 | |
124 | unimplemented!; |
125 | |
126 | |
127 | async |
128 | Message | : ,
129 | State | : ,
130 | _user: , |
131 | |
132 | unimplemented!; |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | GitBackendError, |
139 | |
140 | Other, |
141 | |
142 |