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