1use std::path::Path;
2
3use chrono::{DateTime, Utc};
4use crate_meta::CrateMeta;
5use kellnr_common::crate_data::CrateData;
6use kellnr_common::crate_overview::CrateOverview;
7use kellnr_common::cratesio_prefetch_msg::CratesioPrefetchMsg;
8use kellnr_common::index_metadata::IndexMetadata;
9use kellnr_common::normalized_name::NormalizedName;
10use kellnr_common::original_name::OriginalName;
11use kellnr_common::prefetch::Prefetch;
12use kellnr_common::publish_metadata::PublishMetadata;
13use kellnr_common::version::Version;
14use kellnr_common::webhook::{Webhook, WebhookEvent, WebhookQueue};
15use sea_orm::prelude::async_trait::async_trait;
16use serde::{Deserialize, Serialize};
17
18use crate::error::DbError;
19use crate::{AuthToken, CrateSummary, DocQueueEntry, Group, User, crate_meta};
20
21pub type DbResult<T> = Result<T, DbError>;
22
23#[derive(Debug, PartialEq, Eq)]
24pub enum PrefetchState {
25 UpToDate,
26 NeedsUpdate(Prefetch),
27 NotFound,
28}
29
30#[derive(Debug, Clone, PartialEq, Eq)]
32pub struct OAuth2StateData {
33 pub state: String,
34 pub pkce_verifier: String,
35 pub nonce: String,
36}
37
38#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
40pub struct ToolchainComponentInfo {
41 pub name: String,
43 pub storage_path: String,
45 pub hash: String,
47 pub size: i64,
49}
50
51impl From<kellnr_entity::toolchain_component::Model> for ToolchainComponentInfo {
52 fn from(c: kellnr_entity::toolchain_component::Model) -> Self {
53 Self {
54 name: c.name,
55 storage_path: c.storage_path,
56 hash: c.hash,
57 size: c.size,
58 }
59 }
60}
61
62#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
64pub struct ToolchainTargetInfo {
65 pub id: i64,
67 pub target: String,
69 pub storage_path: String,
71 pub hash: String,
73 pub size: i64,
75 pub status: String,
77 pub components: Vec<ToolchainComponentInfo>,
79}
80
81#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
83pub struct ToolchainWithTargets {
84 pub id: i64,
86 pub name: String,
88 pub version: String,
90 pub date: String,
92 pub channel: Option<String>,
94 pub created: String,
96 pub targets: Vec<ToolchainTargetInfo>,
98}
99
100#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
102pub struct ChannelInfo {
103 pub name: String,
105 pub version: String,
107 pub date: String,
109}
110
111#[async_trait]
112pub trait DbProvider: Send + Sync {
113 async fn get_last_updated_crate(&self) -> DbResult<Option<(OriginalName, Version)>>;
114 async fn authenticate_user(&self, name: &str, pwd: &str) -> DbResult<User>;
115 async fn increase_download_counter(
116 &self,
117 crate_name: &NormalizedName,
118 crate_version: &Version,
119 ) -> DbResult<()>;
120 async fn increase_cached_download_counter(
121 &self,
122 crate_name: &NormalizedName,
123 crate_version: &Version,
124 ) -> DbResult<()>;
125 async fn increase_download_counter_by(
126 &self,
127 crate_name: &NormalizedName,
128 crate_version: &Version,
129 count: u64,
130 ) -> DbResult<()>;
131 async fn increase_cached_download_counter_by(
132 &self,
133 crate_name: &NormalizedName,
134 crate_version: &Version,
135 count: u64,
136 ) -> DbResult<()>;
137 async fn validate_session(&self, session_token: &str) -> DbResult<(String, bool)>;
138 async fn add_session_token(&self, name: &str, session_token: &str) -> DbResult<()>;
139 async fn add_crate_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<()>;
140 async fn add_owner(&self, crate_name: &NormalizedName, owner: &str) -> DbResult<()>;
141 async fn is_download_restricted(&self, crate_name: &NormalizedName) -> DbResult<bool>;
142 async fn change_download_restricted(
143 &self,
144 crate_name: &NormalizedName,
145 restricted: bool,
146 ) -> DbResult<()>;
147 async fn is_crate_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<bool>;
148 async fn is_owner(&self, crate_name: &NormalizedName, user: &str) -> DbResult<bool>;
149 async fn get_crate_id(&self, crate_name: &NormalizedName) -> DbResult<Option<i64>>;
150 async fn get_crate_owners(&self, crate_name: &NormalizedName) -> DbResult<Vec<User>>;
151 async fn get_crate_users(&self, crate_name: &NormalizedName) -> DbResult<Vec<User>>;
152 async fn get_crate_versions(&self, crate_name: &NormalizedName) -> DbResult<Vec<Version>>;
153 async fn delete_session_token(&self, session_token: &str) -> DbResult<()>;
154 async fn delete_user(&self, user_name: &str) -> DbResult<()>;
155 async fn change_pwd(&self, user_name: &str, new_pwd: &str) -> DbResult<()>;
156 async fn change_read_only_state(&self, user_name: &str, state: bool) -> DbResult<()>;
157 async fn change_admin_state(&self, user_name: &str, state: bool) -> DbResult<()>;
158 async fn crate_version_exists(&self, crate_id: i64, version: &str) -> DbResult<bool>;
159 async fn get_max_version_from_id(&self, crate_id: i64) -> DbResult<Version>;
160 async fn get_max_version_from_name(&self, crate_name: &NormalizedName) -> DbResult<Version>;
161 async fn update_max_version(&self, crate_id: i64, version: &Version) -> DbResult<()>;
162 async fn add_auth_token(&self, name: &str, token: &str, user: &str) -> DbResult<()>;
163 async fn get_user_from_token(&self, token: &str) -> DbResult<User>;
164 async fn get_user(&self, name: &str) -> DbResult<User>;
165 async fn get_auth_tokens(&self, user_name: &str) -> DbResult<Vec<AuthToken>>;
166 async fn delete_auth_token(&self, id: i32) -> DbResult<()>;
167 async fn delete_owner(&self, crate_name: &str, owner: &str) -> DbResult<()>;
168 async fn delete_crate_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<()>;
169 async fn add_user(
170 &self,
171 name: &str,
172 pwd: &str,
173 salt: &str,
174 is_admin: bool,
175 is_read_only: bool,
176 ) -> DbResult<()>;
177 async fn get_users(&self) -> DbResult<Vec<User>>;
178 async fn add_group(&self, name: &str) -> DbResult<()>;
179 async fn get_group(&self, name: &str) -> DbResult<Group>;
180 async fn get_groups(&self) -> DbResult<Vec<Group>>;
181 async fn delete_group(&self, name: &str) -> DbResult<()>;
182 async fn add_group_user(&self, group_name: &str, user: &str) -> DbResult<()>;
183 async fn delete_group_user(&self, group_name: &str, user: &str) -> DbResult<()>;
184 async fn get_group_users(&self, group_name: &str) -> DbResult<Vec<User>>;
185 async fn is_group_user(&self, group_name: &str, group: &str) -> DbResult<bool>;
186 async fn add_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<()>;
187 async fn delete_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<()>;
188 async fn get_crate_groups(&self, crate_name: &NormalizedName) -> DbResult<Vec<Group>>;
189 async fn is_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<bool>;
190 async fn is_crate_group_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<bool>;
191 async fn get_total_unique_crates(&self) -> DbResult<u64>;
192 async fn get_total_crate_versions(&self) -> DbResult<u64>;
193 async fn get_total_downloads(&self) -> DbResult<u64>;
194 async fn get_top_crates_downloads(&self, top: u64) -> DbResult<Vec<(String, u64)>>;
195 async fn get_total_unique_cached_crates(&self) -> DbResult<u64>;
196 async fn get_total_cached_crate_versions(&self) -> DbResult<u64>;
197 async fn get_total_cached_downloads(&self) -> DbResult<u64>;
198 async fn get_crate_summaries(&self) -> DbResult<Vec<CrateSummary>>;
199 async fn add_doc_queue(
200 &self,
201 krate: &NormalizedName,
202 version: &Version,
203 path: &Path,
204 ) -> DbResult<()>;
205 async fn delete_doc_queue(&self, id: i64) -> DbResult<()>;
206 async fn get_doc_queue(&self) -> DbResult<Vec<DocQueueEntry>>;
207 async fn delete_crate(&self, krate: &NormalizedName, version: &Version) -> DbResult<()>;
208 async fn get_crate_meta_list(&self, crate_name: &NormalizedName) -> DbResult<Vec<CrateMeta>>;
209 async fn update_last_updated(&self, id: i64, last_updated: &DateTime<Utc>) -> DbResult<()>;
210 async fn search_in_crate_name(
211 &self,
212 contains: &str,
213 cache: bool,
214 ) -> DbResult<Vec<CrateOverview>>;
215 async fn get_crate_overview_list(
216 &self,
217 limit: u64,
218 offset: u64,
219 cache: bool,
220 ) -> DbResult<Vec<CrateOverview>>;
221 async fn get_crate_data(&self, crate_name: &NormalizedName) -> DbResult<CrateData>;
222 async fn add_empty_crate(&self, name: &str, created: &DateTime<Utc>) -> DbResult<i64>;
223 async fn add_crate(
224 &self,
225 pub_metadata: &PublishMetadata,
226 cksum: &str,
227 created: &DateTime<Utc>,
228 owner: &str,
229 ) -> DbResult<i64>;
230 async fn update_docs_link(
231 &self,
232 crate_name: &NormalizedName,
233 version: &Version,
234 docs_link: &str,
235 ) -> DbResult<()>;
236 async fn add_crate_metadata(
237 &self,
238 pub_metadata: &PublishMetadata,
239 created: &str,
240 crate_id: i64,
241 ) -> DbResult<()>;
242 async fn get_prefetch_data(&self, crate_name: &str) -> DbResult<Prefetch>;
243 async fn is_cratesio_cache_up_to_date(
244 &self,
245 crate_name: &NormalizedName,
246 if_none_match: Option<String>,
247 if_modified_since: Option<String>,
248 ) -> DbResult<PrefetchState>;
249 async fn add_cratesio_prefetch_data(
250 &self,
251 crate_name: &OriginalName,
252 etag: &str,
253 last_modified: &str,
254 description: Option<String>,
255 indices: &[IndexMetadata],
256 ) -> DbResult<Prefetch>;
257 async fn get_cratesio_index_update_list(&self) -> DbResult<Vec<CratesioPrefetchMsg>>;
258 async fn unyank_crate(&self, crate_name: &NormalizedName, version: &Version) -> DbResult<()>;
259 async fn yank_crate(&self, crate_name: &NormalizedName, version: &Version) -> DbResult<()>;
260 async fn register_webhook(&self, webhook: Webhook) -> DbResult<String>;
261 async fn delete_webhook(&self, id: &str) -> DbResult<()>;
262 async fn get_webhook(&self, id: &str) -> DbResult<Webhook>;
263 async fn get_all_webhooks(&self) -> DbResult<Vec<Webhook>>;
264 async fn add_webhook_queue(
268 &self,
269 event: WebhookEvent,
270 payload: serde_json::Value,
271 ) -> DbResult<()>;
272 async fn get_pending_webhook_queue_entries(
274 &self,
275 timestamp: DateTime<Utc>,
276 ) -> DbResult<Vec<WebhookQueue>>;
277 async fn update_webhook_queue(
278 &self,
279 id: &str,
280 last_attempt: DateTime<Utc>,
281 next_attempt: DateTime<Utc>,
282 ) -> DbResult<()>;
283 async fn delete_webhook_queue(&self, id: &str) -> DbResult<()>;
284
285 async fn get_user_by_oauth2_identity(
288 &self,
289 issuer: &str,
290 subject: &str,
291 ) -> DbResult<Option<User>>;
292
293 async fn create_oauth2_user(
295 &self,
296 username: &str,
297 issuer: &str,
298 subject: &str,
299 email: Option<String>,
300 is_admin: bool,
301 is_read_only: bool,
302 ) -> DbResult<User>;
303
304 async fn link_oauth2_identity(
306 &self,
307 user_id: i64,
308 issuer: &str,
309 subject: &str,
310 email: Option<String>,
311 ) -> DbResult<()>;
312
313 async fn store_oauth2_state(
316 &self,
317 state: &str,
318 pkce_verifier: &str,
319 nonce: &str,
320 ) -> DbResult<()>;
321
322 async fn get_and_delete_oauth2_state(&self, state: &str) -> DbResult<Option<OAuth2StateData>>;
324
325 async fn cleanup_expired_oauth2_states(&self) -> DbResult<u64>;
327
328 async fn is_username_available(&self, username: &str) -> DbResult<bool>;
330
331 async fn add_toolchain(
334 &self,
335 name: &str,
336 version: &str,
337 date: &str,
338 channel: Option<String>,
339 ) -> DbResult<i64>;
340
341 async fn add_toolchain_target(
343 &self,
344 toolchain_id: i64,
345 target: &str,
346 storage_path: &str,
347 hash: &str,
348 size: i64,
349 ) -> DbResult<i64>;
350
351 async fn add_toolchain_component(
353 &self,
354 target_id: i64,
355 name: &str,
356 storage_path: &str,
357 hash: &str,
358 size: i64,
359 ) -> DbResult<()>;
360
361 async fn set_target_status(&self, target_id: i64, status: &str) -> DbResult<()>;
363
364 async fn get_toolchain_by_channel(
366 &self,
367 channel: &str,
368 ) -> DbResult<Option<ToolchainWithTargets>>;
369
370 async fn get_toolchain_by_version(
372 &self,
373 name: &str,
374 version: &str,
375 ) -> DbResult<Option<ToolchainWithTargets>>;
376
377 async fn list_toolchains(&self) -> DbResult<Vec<ToolchainWithTargets>>;
379
380 async fn delete_toolchain(&self, name: &str, version: &str) -> DbResult<()>;
382
383 async fn delete_toolchain_target(
385 &self,
386 name: &str,
387 version: &str,
388 target: &str,
389 ) -> DbResult<()>;
390
391 async fn set_channel(&self, channel: &str, name: &str, version: &str) -> DbResult<()>;
393
394 async fn get_channels(&self) -> DbResult<Vec<ChannelInfo>>;
396}
397
398pub mod mock {
399 use chrono::DateTime;
400 use mockall::predicate::*;
401 use mockall::*;
402
403 use super::*;
404
405 mock! {
406 pub Db {}
407
408 #[async_trait]
409 impl DbProvider for Db {
410
411 async fn get_last_updated_crate(&self) -> DbResult<Option<(OriginalName, Version)>> {
412 unimplemented!()
413 }
414
415 async fn authenticate_user(&self, _name: &str, _pwd: &str) -> DbResult<User> {
416 unimplemented!()
417 }
418
419 async fn increase_download_counter(
420 &self,
421 _crate_name: &NormalizedName,
422 _crate_version: &Version,
423 ) -> DbResult<()> {
424 unimplemented!()
425 }
426
427 async fn increase_cached_download_counter(
428 &self,
429 _crate_name: &NormalizedName,
430 _crate_version: &Version,
431 ) -> DbResult<()> {
432 unimplemented!()
433 }
434
435 async fn increase_download_counter_by(
436 &self,
437 _crate_name: &NormalizedName,
438 _crate_version: &Version,
439 _count: u64,
440 ) -> DbResult<()> {
441 unimplemented!()
442 }
443
444 async fn increase_cached_download_counter_by(
445 &self,
446 _crate_name: &NormalizedName,
447 _crate_version: &Version,
448 _count: u64,
449 ) -> DbResult<()> {
450 unimplemented!()
451 }
452
453 async fn validate_session(&self, _session_token: &str) -> DbResult<(String, bool)> {
454 unimplemented!()
455 }
456
457 async fn add_session_token(&self, _name: &str, _session_token: &str) -> DbResult<()> {
458 unimplemented!()
459 }
460
461 async fn add_crate_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<()> {
462 unimplemented!()
463 }
464
465 async fn add_owner(&self, _crate_name: &NormalizedName, _owner: &str) -> DbResult<()> {
466 unimplemented!()
467 }
468
469 async fn is_download_restricted(&self, crate_name: &NormalizedName) -> DbResult<bool> {
470 unimplemented!()
471 }
472
473 async fn change_download_restricted(
474 &self,
475 crate_name: &NormalizedName,
476 restricted: bool,
477 ) -> DbResult<()> {
478 unimplemented!()
479 }
480
481 async fn is_crate_user(&self, _crate_name: &NormalizedName, _user: &str) -> DbResult<bool> {
482 unimplemented!()
483 }
484
485 async fn is_owner(&self, _crate_name: &NormalizedName, _user: &str) -> DbResult<bool> {
486 unimplemented!()
487 }
488
489 async fn get_crate_id(&self, _crate_name: &NormalizedName) -> DbResult<Option<i64>> {
490 unimplemented!()
491 }
492
493 async fn get_crate_owners(&self, _crate_name: &NormalizedName) -> DbResult<Vec<User>> {
494 unimplemented!()
495 }
496
497 async fn get_crate_users(&self, _crate_name: &NormalizedName) -> DbResult<Vec<User>> {
498 unimplemented!()
499 }
500
501 async fn get_crate_versions(&self, _crate_name: &NormalizedName) -> DbResult<Vec<Version>> {
502 unimplemented!()
503 }
504
505 async fn delete_session_token(&self, _session_token: &str) -> DbResult<()> {
506 unimplemented!()
507 }
508
509 async fn delete_user(&self, _user_name: &str) -> DbResult<()> {
510 unimplemented!()
511 }
512
513 async fn change_pwd(&self, _user_name: &str, _new_pwd: &str) -> DbResult<()> {
514 unimplemented!()
515 }
516
517 async fn change_read_only_state(&self, _user_name: &str, _state: bool) -> DbResult<()> {
518 unimplemented!()
519 }
520
521 async fn change_admin_state(&self, _user_name: &str, _state: bool) -> DbResult<()> {
522 unimplemented!()
523 }
524
525 async fn crate_version_exists(&self, _crate_id: i64, _version: &str) -> DbResult<bool> {
526 unimplemented!()
527 }
528
529 async fn get_max_version_from_id(&self, crate_id: i64) -> DbResult<Version> {
530 unimplemented!()
531 }
532
533 async fn get_max_version_from_name(&self, crate_name: &NormalizedName) -> DbResult<Version> {
534 unimplemented!()
535 }
536
537 async fn update_max_version(&self, crate_id: i64, version: &Version) -> DbResult<()> {
538 unimplemented!()
539 }
540
541 async fn add_auth_token(&self, _name: &str, _token: &str, _user: &str) -> DbResult<()> {
542 unimplemented!()
543 }
544
545 async fn get_user_from_token(&self, _token: &str) -> DbResult<User> {
546 unimplemented!()
547 }
548
549 async fn get_user(&self, _name: &str) -> DbResult<User> {
550 unimplemented!()
551 }
552
553 async fn get_auth_tokens(&self, _user_name: &str) -> DbResult<Vec<AuthToken>> {
554 unimplemented!()
555 }
556
557 async fn delete_auth_token(&self, _id: i32) -> DbResult<()> {
558 unimplemented!()
559 }
560
561 async fn delete_owner(&self, _crate_name: &str, _owner: &str) -> DbResult<()> {
562 unimplemented!()
563 }
564
565 async fn delete_crate_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<()>{
566 unimplemented!()
567 }
568
569 async fn add_user(&self, _name: &str, _pwd: &str, _salt: &str, _is_admin: bool, _is_read_only: bool) -> DbResult<()> {
570 unimplemented!()
571 }
572
573 async fn get_users(&self) -> DbResult<Vec<User>> {
574 unimplemented!()
575 }
576
577 async fn get_total_unique_crates(&self) -> DbResult<u64> {
578 unimplemented!()
579 }
580
581 async fn get_total_crate_versions(&self) -> DbResult<u64> {
582 unimplemented!()
583 }
584
585 async fn get_top_crates_downloads(&self, _top: u64) -> DbResult<Vec<(String, u64)>> {
586 unimplemented!()
587 }
588
589 async fn get_total_unique_cached_crates(&self) -> DbResult<u64> {
590 unimplemented!()
591 }
592
593 async fn get_total_cached_crate_versions(&self) -> DbResult<u64> {
594 unimplemented!()
595 }
596
597 async fn get_total_cached_downloads(&self) -> DbResult<u64> {
598 unimplemented!()
599 }
600
601 async fn get_crate_summaries(&self) -> DbResult<Vec<CrateSummary >> {
602 unimplemented!()
603 }
604
605 async fn add_doc_queue(&self, krate: &NormalizedName, version: &Version, path: &Path) -> DbResult<()>{
606 unimplemented!()
607 }
608
609 async fn delete_doc_queue(&self, id: i64) -> DbResult<()>{
610 unimplemented!()
611 }
612
613 async fn get_doc_queue(&self) -> DbResult<Vec<DocQueueEntry>> {
614 unimplemented!()
615 }
616
617 async fn delete_crate(&self, krate: &NormalizedName, version: &Version) -> DbResult<()> {
618 unimplemented!()
619 }
620
621 async fn get_total_downloads(&self) -> DbResult<u64>{
622 unimplemented!()
623 }
624
625 async fn get_crate_meta_list(&self, crate_name: &NormalizedName) -> DbResult<Vec<CrateMeta>>{
626 unimplemented!()
627 }
628
629 async fn update_last_updated(&self, id: i64, last_updated: &DateTime<Utc>) -> DbResult<()>{
630 unimplemented!()
631 }
632
633 async fn search_in_crate_name(&self, contains: &str, cache: bool) -> DbResult<Vec<CrateOverview>> {
634 unimplemented!()
635 }
636
637 async fn get_crate_overview_list(&self, limit: u64, offset: u64, cache: bool) -> DbResult<Vec<CrateOverview >> {
638 unimplemented!()
639 }
640
641 async fn get_crate_data(&self, crate_name: &NormalizedName) -> DbResult<CrateData> {
642 unimplemented!()
643 }
644
645 async fn add_empty_crate(&self, name: &str, created: &DateTime<Utc>) -> DbResult<i64> {
646 unimplemented!()
647 }
648
649 async fn add_crate(&self, pub_metadata: &PublishMetadata, sha256: &str, created: &DateTime<Utc>, owner: &str) -> DbResult<i64> {
650 unimplemented!()
651 }
652
653 async fn update_docs_link(&self, crate_name: &NormalizedName, version: &Version, docs_link: &str) -> DbResult<()> {
654 unimplemented!()
655 }
656
657 async fn add_crate_metadata(&self, pub_metadata: &PublishMetadata, created: &str, crate_id: i64,) -> DbResult<()> {
658 unimplemented!()
659 }
660
661 async fn get_prefetch_data(&self, crate_name: &str) -> DbResult<Prefetch> {
662 unimplemented!()
663 }
664
665 async fn is_cratesio_cache_up_to_date(&self, crate_name: &NormalizedName, etag: Option<String>, last_modified: Option<String>) -> DbResult<PrefetchState> {
666 unimplemented!()
667 }
668
669 async fn add_cratesio_prefetch_data(
670 &self,
671 crate_name: &OriginalName,
672 etag: &str,
673 last_modified: &str,
674 description: Option<String>,
675 indices: &[IndexMetadata],
676 ) -> DbResult<Prefetch> {
677 unimplemented!()
678 }
679
680 async fn get_cratesio_index_update_list(&self) -> DbResult<Vec<CratesioPrefetchMsg>> {
681 unimplemented!()
682 }
683
684 async fn unyank_crate(&self, crate_name: &NormalizedName, version: &Version) -> DbResult<()> {
685 unimplemented!()
686 }
687
688 async fn yank_crate(&self, crate_name: &NormalizedName, version: &Version) -> DbResult<()> {
689 unimplemented!()
690 }
691
692 async fn add_group(&self, name: &str) -> DbResult<()> {
693 unimplemented!()
694 }
695 async fn get_group(&self, name: &str) -> DbResult<Group>{
696 unimplemented!()
697 }
698 async fn get_groups(&self) -> DbResult<Vec<Group>>{
699 unimplemented!()
700 }
701 async fn delete_group(&self, name: &str) -> DbResult<()>{
702 unimplemented!()
703 }
704 async fn add_group_user(&self, group_name: &str, user: &str) -> DbResult<()>{
705 unimplemented!()
706 }
707 async fn delete_group_user(&self, group_name: &str, user: &str) -> DbResult<()>{
708 unimplemented!()
709 }
710 async fn get_group_users(&self, group_name: &str) -> DbResult<Vec<User>> {
711 unimplemented!()
712 }
713 async fn is_group_user(&self, group_name: &str, user: &str) -> DbResult<bool> {
714 unimplemented!()
715 }
716
717 async fn add_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<()>{
718 unimplemented!()
719 }
720 async fn delete_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<()>{
721 unimplemented!()
722 }
723 async fn get_crate_groups(&self, crate_name: &NormalizedName) -> DbResult<Vec<Group>>{
724 unimplemented!()
725 }
726 async fn is_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<bool>{
727 unimplemented!()
728 }
729
730 async fn is_crate_group_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<bool>{
731 unimplemented!()
732 }
733
734 async fn register_webhook(
735 &self,
736 webhook: Webhook
737 ) -> DbResult<String> {
738 unimplemented!()
739 }
740 async fn delete_webhook(&self, id: &str) -> DbResult<()> {
741 unimplemented!()
742 }
743 async fn get_webhook(&self, id: &str) -> DbResult<Webhook> {
744 unimplemented!()
745 }
746 async fn get_all_webhooks(&self) -> DbResult<Vec<Webhook>> {
747 unimplemented!()
748 }
749 async fn add_webhook_queue(&self, event: WebhookEvent, payload: serde_json::Value) -> DbResult<()> {
750 unimplemented!()
751 }
752 async fn get_pending_webhook_queue_entries(&self, timestamp: DateTime<Utc>) -> DbResult<Vec<WebhookQueue>> {
753 unimplemented!()
754 }
755 async fn update_webhook_queue(&self, id: &str, last_attempt: DateTime<Utc>, next_attempt: DateTime<Utc>) -> DbResult<()> {
756 unimplemented!()
757 }
758 async fn delete_webhook_queue(&self, id: &str) -> DbResult<()> {
759 unimplemented!()
760 }
761
762 async fn get_user_by_oauth2_identity(
763 &self,
764 issuer: &str,
765 subject: &str,
766 ) -> DbResult<Option<User>> {
767 unimplemented!()
768 }
769
770 async fn create_oauth2_user(
771 &self,
772 username: &str,
773 issuer: &str,
774 subject: &str,
775 email: Option<String>,
776 is_admin: bool,
777 is_read_only: bool,
778 ) -> DbResult<User> {
779 unimplemented!()
780 }
781
782 async fn link_oauth2_identity(
783 &self,
784 user_id: i64,
785 issuer: &str,
786 subject: &str,
787 email: Option<String>,
788 ) -> DbResult<()> {
789 unimplemented!()
790 }
791
792 async fn store_oauth2_state(
793 &self,
794 state: &str,
795 pkce_verifier: &str,
796 nonce: &str,
797 ) -> DbResult<()> {
798 unimplemented!()
799 }
800
801 async fn get_and_delete_oauth2_state(
802 &self,
803 state: &str,
804 ) -> DbResult<Option<OAuth2StateData>> {
805 unimplemented!()
806 }
807
808 async fn cleanup_expired_oauth2_states(&self) -> DbResult<u64> {
809 unimplemented!()
810 }
811
812 async fn is_username_available(&self, username: &str) -> DbResult<bool> {
813 unimplemented!()
814 }
815
816 async fn add_toolchain(
817 &self,
818 name: &str,
819 version: &str,
820 date: &str,
821 channel: Option<String>,
822 ) -> DbResult<i64> {
823 unimplemented!()
824 }
825
826 async fn add_toolchain_target(
827 &self,
828 toolchain_id: i64,
829 target: &str,
830 storage_path: &str,
831 hash: &str,
832 size: i64,
833 ) -> DbResult<i64> {
834 unimplemented!()
835 }
836
837 async fn add_toolchain_component(
838 &self,
839 target_id: i64,
840 name: &str,
841 storage_path: &str,
842 hash: &str,
843 size: i64,
844 ) -> DbResult<()> {
845 unimplemented!()
846 }
847
848 async fn set_target_status(&self, target_id: i64, status: &str) -> DbResult<()> {
849 unimplemented!()
850 }
851
852 async fn get_toolchain_by_channel(&self, channel: &str) -> DbResult<Option<ToolchainWithTargets>> {
853 unimplemented!()
854 }
855
856 async fn get_toolchain_by_version(
857 &self,
858 name: &str,
859 version: &str,
860 ) -> DbResult<Option<ToolchainWithTargets>> {
861 unimplemented!()
862 }
863
864 async fn list_toolchains(&self) -> DbResult<Vec<ToolchainWithTargets>> {
865 unimplemented!()
866 }
867
868 async fn delete_toolchain(&self, name: &str, version: &str) -> DbResult<()> {
869 unimplemented!()
870 }
871
872 async fn delete_toolchain_target(
873 &self,
874 name: &str,
875 version: &str,
876 target: &str,
877 ) -> DbResult<()> {
878 unimplemented!()
879 }
880
881 async fn set_channel(&self, channel: &str, name: &str, version: &str) -> DbResult<()> {
882 unimplemented!()
883 }
884
885 async fn get_channels(&self) -> DbResult<Vec<ChannelInfo>> {
886 unimplemented!()
887 }
888 }
889 }
890}