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