Skip to main content

kellnr_db/
provider.rs

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/// Authenticated user and privileges resolved from a valid session cookie.
31#[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/// Data stored during `OAuth2` authentication flow for CSRF/PKCE verification
39#[derive(Debug, Clone, PartialEq, Eq)]
40pub struct OAuth2StateData {
41    pub state: String,
42    pub pkce_verifier: String,
43    pub nonce: String,
44}
45
46/// Information about an individual toolchain component (e.g., rustc, cargo)
47#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
48pub struct ToolchainComponentInfo {
49    /// Component name (e.g., "rustc", "cargo", "rust-std-x86_64-unknown-linux-gnu")
50    pub name: String,
51    /// Path to the stored component archive
52    pub storage_path: String,
53    /// SHA256 hash of the component archive
54    pub hash: String,
55    /// Component archive size in bytes
56    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/// Toolchain target information (e.g., a specific archive for a target triple)
71#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
72pub struct ToolchainTargetInfo {
73    /// Target ID
74    pub id: i64,
75    /// Target triple (e.g., "x86_64-unknown-linux-gnu")
76    pub target: String,
77    /// Path to the stored archive
78    pub storage_path: String,
79    /// SHA256 hash of the archive
80    pub hash: String,
81    /// Archive size in bytes
82    pub size: i64,
83    /// Processing status: "processing", "ready", or "failed"
84    pub status: String,
85    /// Individual components extracted from the combined archive
86    pub components: Vec<ToolchainComponentInfo>,
87}
88
89/// Toolchain with all its targets
90#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
91pub struct ToolchainWithTargets {
92    /// Toolchain ID
93    pub id: i64,
94    /// Toolchain name (e.g., "rust")
95    pub name: String,
96    /// Toolchain version (e.g., "1.75.0")
97    pub version: String,
98    /// Release date
99    pub date: String,
100    /// Channel (e.g., "stable", "beta", "nightly")
101    pub channel: Option<String>,
102    /// Creation timestamp
103    pub created: String,
104    /// Available targets for this toolchain
105    pub targets: Vec<ToolchainTargetInfo>,
106}
107
108/// Channel information (e.g., "stable" -> "1.75.0")
109#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
110pub struct ChannelInfo {
111    /// Channel name (e.g., "stable", "beta", "nightly")
112    pub name: String,
113    /// Toolchain version pointed to by this channel
114    pub version: String,
115    /// Release date
116    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    /// Delete all sessions that have outlived the configured session age.
147    /// Returns the number of rows removed.
148    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(
222        &self,
223        contains: &str,
224        cache: bool,
225    ) -> DbResult<Vec<CrateOverview>>;
226    async fn get_crate_overview_list(
227        &self,
228        limit: u64,
229        offset: u64,
230        cache: bool,
231    ) -> DbResult<Vec<CrateOverview>>;
232    async fn get_crate_data(&self, crate_name: &NormalizedName) -> DbResult<CrateData>;
233    async fn add_empty_crate(&self, name: &str, created: &DateTime<Utc>) -> DbResult<i64>;
234    async fn add_crate(
235        &self,
236        pub_metadata: &PublishMetadata,
237        cksum: &str,
238        created: &DateTime<Utc>,
239        owner: &str,
240    ) -> DbResult<i64>;
241    async fn update_docs_link(
242        &self,
243        crate_name: &NormalizedName,
244        version: &Version,
245        docs_link: &str,
246    ) -> DbResult<()>;
247    async fn add_crate_metadata(
248        &self,
249        pub_metadata: &PublishMetadata,
250        created: &str,
251        crate_id: i64,
252    ) -> DbResult<()>;
253    async fn get_prefetch_data(&self, crate_name: &str) -> DbResult<Prefetch>;
254    async fn is_cratesio_cache_up_to_date(
255        &self,
256        crate_name: &NormalizedName,
257        if_none_match: Option<String>,
258        if_modified_since: Option<String>,
259    ) -> DbResult<PrefetchState>;
260    async fn add_cratesio_prefetch_data(
261        &self,
262        crate_name: &OriginalName,
263        etag: &str,
264        last_modified: &str,
265        description: Option<String>,
266        indices: &[IndexMetadata],
267    ) -> DbResult<Prefetch>;
268    async fn get_cratesio_index_update_list(&self) -> DbResult<Vec<CratesioPrefetchMsg>>;
269    async fn unyank_crate(&self, crate_name: &NormalizedName, version: &Version) -> DbResult<()>;
270    async fn yank_crate(&self, crate_name: &NormalizedName, version: &Version) -> DbResult<()>;
271    async fn register_webhook(&self, webhook: Webhook) -> DbResult<String>;
272    async fn delete_webhook(&self, id: &str) -> DbResult<()>;
273    async fn get_webhook(&self, id: &str) -> DbResult<Webhook>;
274    async fn get_all_webhooks(&self) -> DbResult<Vec<Webhook>>;
275    /// Creates a new webhook queue entry for each register webhook
276    /// matching the given event. `Next_attempt` is set to current time,
277    ///  in order to trigger immediate dispatch.
278    async fn add_webhook_queue(
279        &self,
280        event: WebhookEvent,
281        payload: serde_json::Value,
282    ) -> DbResult<()>;
283    /// Extracts webhook queue entries with `next_attempt` at or earlier than provided timestamp.
284    async fn get_pending_webhook_queue_entries(
285        &self,
286        timestamp: DateTime<Utc>,
287    ) -> DbResult<Vec<WebhookQueue>>;
288    async fn update_webhook_queue(
289        &self,
290        id: &str,
291        last_attempt: DateTime<Utc>,
292        next_attempt: DateTime<Utc>,
293    ) -> DbResult<()>;
294    async fn delete_webhook_queue(&self, id: &str) -> DbResult<()>;
295
296    // `OAuth2` identity methods
297    /// Look up a user by their `OAuth2` identity (issuer + subject)
298    async fn get_user_by_oauth2_identity(
299        &self,
300        issuer: &str,
301        subject: &str,
302    ) -> DbResult<Option<User>>;
303
304    /// Create a new user from `OAuth2` authentication and link their identity
305    async fn create_oauth2_user(
306        &self,
307        username: &str,
308        issuer: &str,
309        subject: &str,
310        email: Option<String>,
311        is_admin: bool,
312        is_read_only: bool,
313    ) -> DbResult<User>;
314
315    /// Link an `OAuth2` identity to an existing user
316    async fn link_oauth2_identity(
317        &self,
318        user_id: i64,
319        issuer: &str,
320        subject: &str,
321        email: Option<String>,
322    ) -> DbResult<()>;
323
324    // `OAuth2` state methods (CSRF/PKCE during auth flow)
325    /// Store `OAuth2` state for CSRF/PKCE verification during auth flow
326    async fn store_oauth2_state(
327        &self,
328        state: &str,
329        pkce_verifier: &str,
330        nonce: &str,
331    ) -> DbResult<()>;
332
333    /// Retrieve and delete `OAuth2` state (single use)
334    async fn get_and_delete_oauth2_state(&self, state: &str) -> DbResult<Option<OAuth2StateData>>;
335
336    /// Clean up expired `OAuth2` states (older than 10 minutes)
337    async fn cleanup_expired_oauth2_states(&self) -> DbResult<u64>;
338
339    /// Check if username is available (for `OAuth2` auto-provisioning)
340    async fn is_username_available(&self, username: &str) -> DbResult<bool>;
341
342    // Toolchain distribution methods
343    /// Add a new toolchain release
344    async fn add_toolchain(
345        &self,
346        name: &str,
347        version: &str,
348        date: &str,
349        channel: Option<String>,
350    ) -> DbResult<i64>;
351
352    /// Add a target archive to an existing toolchain
353    async fn add_toolchain_target(
354        &self,
355        toolchain_id: i64,
356        target: &str,
357        storage_path: &str,
358        hash: &str,
359        size: i64,
360    ) -> DbResult<i64>;
361
362    /// Add a component to a toolchain target
363    async fn add_toolchain_component(
364        &self,
365        target_id: i64,
366        name: &str,
367        storage_path: &str,
368        hash: &str,
369        size: i64,
370    ) -> DbResult<()>;
371
372    /// Update the processing status of a toolchain target
373    async fn set_target_status(&self, target_id: i64, status: &str) -> DbResult<()>;
374
375    /// Get a toolchain by its channel (e.g., "stable", "nightly")
376    async fn get_toolchain_by_channel(
377        &self,
378        channel: &str,
379    ) -> DbResult<Option<ToolchainWithTargets>>;
380
381    /// Get a toolchain by name and version
382    async fn get_toolchain_by_version(
383        &self,
384        name: &str,
385        version: &str,
386    ) -> DbResult<Option<ToolchainWithTargets>>;
387
388    /// List all toolchains
389    async fn list_toolchains(&self) -> DbResult<Vec<ToolchainWithTargets>>;
390
391    /// Delete a toolchain and all its targets
392    async fn delete_toolchain(&self, name: &str, version: &str) -> DbResult<()>;
393
394    /// Delete a specific toolchain target
395    async fn delete_toolchain_target(
396        &self,
397        name: &str,
398        version: &str,
399        target: &str,
400    ) -> DbResult<()>;
401
402    /// Set a channel to point to a specific toolchain version
403    async fn set_channel(&self, channel: &str, name: &str, version: &str) -> DbResult<()>;
404
405    /// Get all channels with their current versions
406    async fn get_channels(&self) -> DbResult<Vec<ChannelInfo>>;
407}
408
409pub mod mock {
410    use chrono::DateTime;
411    use mockall::predicate::*;
412    use mockall::*;
413
414    use super::*;
415
416    mock! {
417          pub Db {}
418
419        #[async_trait]
420        impl DbProvider for Db {
421
422            async fn get_last_updated_crate(&self) -> DbResult<Option<(OriginalName, Version)>> {
423                unimplemented!()
424            }
425
426            async fn authenticate_user(&self, _name: &str, _pwd: &str) -> DbResult<User> {
427                unimplemented!()
428            }
429
430            async fn increase_download_counter(
431                &self,
432                _crate_name: &NormalizedName,
433                _crate_version: &Version,
434            ) -> DbResult<()> {
435                unimplemented!()
436            }
437
438            async fn increase_cached_download_counter(
439                &self,
440                _crate_name: &NormalizedName,
441                _crate_version: &Version,
442            ) -> DbResult<()> {
443                unimplemented!()
444            }
445
446            async fn increase_download_counter_by(
447                &self,
448                _crate_name: &NormalizedName,
449                _crate_version: &Version,
450                _count: u64,
451            ) -> DbResult<()> {
452                unimplemented!()
453            }
454
455            async fn increase_cached_download_counter_by(
456                &self,
457                _crate_name: &NormalizedName,
458                _crate_version: &Version,
459                _count: u64,
460            ) -> DbResult<()> {
461                unimplemented!()
462            }
463
464            async fn validate_session(&self, _session_token: &str) -> DbResult<SessionInfo> {
465                unimplemented!()
466            }
467
468            async fn delete_expired_sessions(&self) -> DbResult<u64> {
469                unimplemented!()
470            }
471
472            async fn add_session_token(&self, _name: &str, _session_token: &str) -> DbResult<()> {
473                unimplemented!()
474            }
475
476            async fn add_crate_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<()> {
477                unimplemented!()
478            }
479
480            async fn add_owner(&self, _crate_name: &NormalizedName, _owner: &str) -> DbResult<()> {
481                unimplemented!()
482            }
483
484            async fn is_download_restricted(&self, crate_name: &NormalizedName) -> DbResult<bool> {
485                unimplemented!()
486            }
487
488            async fn change_download_restricted(
489                &self,
490                crate_name: &NormalizedName,
491                restricted: bool,
492            ) -> DbResult<()> {
493                unimplemented!()
494            }
495
496            async fn is_crate_user(&self, _crate_name: &NormalizedName, _user: &str) -> DbResult<bool> {
497                unimplemented!()
498            }
499
500            async fn is_owner(&self, _crate_name: &NormalizedName, _user: &str) -> DbResult<bool> {
501                unimplemented!()
502            }
503
504            async fn get_crate_id(&self, _crate_name: &NormalizedName) -> DbResult<Option<i64>> {
505                unimplemented!()
506            }
507
508            async fn get_crate_owners(&self, _crate_name: &NormalizedName) -> DbResult<Vec<User>> {
509                unimplemented!()
510            }
511
512            async fn get_crate_users(&self, _crate_name: &NormalizedName) -> DbResult<Vec<User>> {
513                unimplemented!()
514            }
515
516            async fn get_crate_versions(&self, _crate_name: &NormalizedName) -> DbResult<Vec<Version>> {
517                unimplemented!()
518            }
519
520            async fn delete_session_token(&self, _session_token: &str) -> DbResult<()> {
521                unimplemented!()
522            }
523
524            async fn delete_user(&self, _user_name: &str) -> DbResult<()> {
525                unimplemented!()
526            }
527
528            async fn change_pwd(&self, _user_name: &str, _new_pwd: &str) -> DbResult<()> {
529                unimplemented!()
530            }
531
532            async fn change_read_only_state(&self, _user_name: &str, _state: bool) -> DbResult<()> {
533                unimplemented!()
534            }
535
536            async fn change_admin_state(&self, _user_name: &str, _state: bool) -> DbResult<()> {
537                unimplemented!()
538            }
539
540            async fn crate_version_exists(&self, _crate_id: i64, _version: &str) -> DbResult<bool> {
541                unimplemented!()
542            }
543
544            async fn get_max_version_from_id(&self, crate_id: i64) -> DbResult<Version>  {
545                unimplemented!()
546            }
547
548            async fn get_max_version_from_name(&self, crate_name: &NormalizedName) -> DbResult<Version> {
549                unimplemented!()
550            }
551
552            async fn update_max_version(&self, crate_id: i64, version: &Version) -> DbResult<()> {
553                unimplemented!()
554            }
555
556            async fn add_auth_token(&self, _name: &str, _token: &str, _user: &str) -> DbResult<()> {
557                unimplemented!()
558            }
559
560            async fn get_user_from_token(&self, _token: &str) -> DbResult<User> {
561                unimplemented!()
562            }
563
564            async fn get_user(&self, _name: &str) -> DbResult<User> {
565                unimplemented!()
566            }
567
568            async fn get_auth_tokens(&self, _user_name: &str) -> DbResult<Vec<AuthToken>> {
569                unimplemented!()
570            }
571
572            async fn delete_auth_token(&self, _id: i32) -> DbResult<()> {
573                unimplemented!()
574            }
575
576            async fn delete_owner(&self, _crate_name: &str, _owner: &str) -> DbResult<()> {
577                unimplemented!()
578            }
579
580            async fn delete_crate_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<()>{
581                unimplemented!()
582            }
583
584            async fn add_user(&self, _name: &str, _pwd: &str, _salt: &str, _is_admin: bool, _is_read_only: bool) -> DbResult<()> {
585                unimplemented!()
586            }
587
588            async fn get_users(&self) -> DbResult<Vec<User>> {
589                unimplemented!()
590            }
591
592            async fn get_total_unique_crates(&self) -> DbResult<u64> {
593                unimplemented!()
594            }
595
596            async fn get_total_crate_versions(&self) -> DbResult<u64> {
597                unimplemented!()
598            }
599
600            async fn get_top_crates_downloads(&self, _top: u64) -> DbResult<Vec<(String, u64)>> {
601                unimplemented!()
602            }
603
604            async fn get_total_unique_cached_crates(&self) -> DbResult<u64> {
605                unimplemented!()
606            }
607
608            async fn get_total_cached_crate_versions(&self) -> DbResult<u64> {
609                unimplemented!()
610            }
611
612            async fn get_total_cached_downloads(&self) -> DbResult<u64> {
613                unimplemented!()
614            }
615
616            async fn get_crate_summaries(&self) -> DbResult<Vec<CrateSummary >> {
617                unimplemented!()
618            }
619
620                async fn add_doc_queue(&self, krate: &NormalizedName, version: &Version, path: &Path) -> DbResult<()>{
621                    unimplemented!()
622                }
623
624            async fn delete_doc_queue(&self, id: i64) -> DbResult<()>{
625                    unimplemented!()
626                }
627
628            async fn get_doc_queue(&self) -> DbResult<Vec<DocQueueEntry>> {
629                unimplemented!()
630            }
631
632            async fn delete_crate(&self, krate: &NormalizedName, version: &Version) -> DbResult<()> {
633                unimplemented!()
634            }
635
636            async fn get_total_downloads(&self) -> DbResult<u64>{
637                unimplemented!()
638            }
639
640            async fn get_crate_meta_list(&self, crate_name: &NormalizedName) -> DbResult<Vec<CrateMeta>>{
641                unimplemented!()
642            }
643
644            async fn update_last_updated(&self, id: i64, last_updated: &DateTime<Utc>) -> DbResult<()>{
645                unimplemented!()
646            }
647
648            async fn search_in_crate_name(&self, contains: &str, cache: bool) -> DbResult<Vec<CrateOverview>> {
649                unimplemented!()
650            }
651
652            async fn get_crate_overview_list(&self, limit: u64, offset: u64, cache: bool) -> DbResult<Vec<CrateOverview >> {
653                unimplemented!()
654            }
655
656            async fn get_crate_data(&self, crate_name: &NormalizedName) -> DbResult<CrateData> {
657                unimplemented!()
658            }
659
660            async fn add_empty_crate(&self, name: &str, created: &DateTime<Utc>) -> DbResult<i64> {
661                unimplemented!()
662            }
663
664            async fn add_crate(&self, pub_metadata: &PublishMetadata, sha256: &str, created: &DateTime<Utc>, owner: &str) -> DbResult<i64> {
665                unimplemented!()
666            }
667
668            async fn update_docs_link(&self, crate_name: &NormalizedName, version: &Version, docs_link: &str) -> DbResult<()> {
669                unimplemented!()
670            }
671
672            async fn add_crate_metadata(&self, pub_metadata: &PublishMetadata, created: &str, crate_id: i64,) -> DbResult<()> {
673                unimplemented!()
674            }
675
676            async fn get_prefetch_data(&self, crate_name: &str) -> DbResult<Prefetch> {
677                unimplemented!()
678            }
679
680            async fn is_cratesio_cache_up_to_date(&self, crate_name: &NormalizedName, etag: Option<String>, last_modified: Option<String>) -> DbResult<PrefetchState> {
681                unimplemented!()
682            }
683
684            async fn add_cratesio_prefetch_data(
685                &self,
686                crate_name: &OriginalName,
687                etag: &str,
688                last_modified: &str,
689                description: Option<String>,
690                indices: &[IndexMetadata],
691            ) -> DbResult<Prefetch> {
692                unimplemented!()
693            }
694
695            async fn get_cratesio_index_update_list(&self) -> DbResult<Vec<CratesioPrefetchMsg>> {
696                unimplemented!()
697            }
698
699            async fn unyank_crate(&self, crate_name: &NormalizedName, version: &Version) -> DbResult<()> {
700                unimplemented!()
701            }
702
703            async fn yank_crate(&self, crate_name: &NormalizedName, version: &Version) -> DbResult<()> {
704                unimplemented!()
705            }
706
707            async fn add_group(&self, name: &str) -> DbResult<()> {
708                        unimplemented!()
709            }
710            async fn get_group(&self, name: &str) -> DbResult<Group>{
711                        unimplemented!()
712            }
713            async fn get_groups(&self) -> DbResult<Vec<Group>>{
714                        unimplemented!()
715            }
716            async fn delete_group(&self, name: &str) -> DbResult<()>{
717                        unimplemented!()
718            }
719            async fn add_group_user(&self, group_name: &str, user: &str) -> DbResult<()>{
720                        unimplemented!()
721            }
722            async fn delete_group_user(&self, group_name: &str, user: &str) -> DbResult<()>{
723                        unimplemented!()
724            }
725            async fn get_group_users(&self, group_name: &str) -> DbResult<Vec<User>> {
726                unimplemented!()
727            }
728            async fn is_group_user(&self, group_name: &str, user: &str) -> DbResult<bool> {
729                unimplemented!()
730            }
731
732            async fn add_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<()>{
733                unimplemented!()
734            }
735            async fn delete_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<()>{
736                unimplemented!()
737            }
738            async fn get_crate_groups(&self, crate_name: &NormalizedName) -> DbResult<Vec<Group>>{
739                unimplemented!()
740            }
741            async fn is_crate_group(&self, crate_name: &NormalizedName, group: &str) -> DbResult<bool>{
742                unimplemented!()
743            }
744
745            async fn is_crate_group_user(&self, crate_name: &NormalizedName, user: &str) -> DbResult<bool>{
746                unimplemented!()
747            }
748
749            async fn register_webhook(
750                &self,
751                webhook: Webhook
752            ) -> DbResult<String> {
753                unimplemented!()
754            }
755            async fn delete_webhook(&self, id: &str) -> DbResult<()> {
756                unimplemented!()
757            }
758            async fn get_webhook(&self, id: &str) -> DbResult<Webhook> {
759                unimplemented!()
760            }
761            async fn get_all_webhooks(&self) -> DbResult<Vec<Webhook>> {
762                unimplemented!()
763            }
764            async fn add_webhook_queue(&self, event: WebhookEvent, payload: serde_json::Value) -> DbResult<()> {
765                unimplemented!()
766            }
767            async fn get_pending_webhook_queue_entries(&self, timestamp: DateTime<Utc>) -> DbResult<Vec<WebhookQueue>> {
768                unimplemented!()
769            }
770            async fn update_webhook_queue(&self, id: &str, last_attempt: DateTime<Utc>, next_attempt: DateTime<Utc>) -> DbResult<()> {
771                unimplemented!()
772            }
773            async fn delete_webhook_queue(&self, id: &str) -> DbResult<()> {
774                unimplemented!()
775            }
776
777            async fn get_user_by_oauth2_identity(
778                &self,
779                issuer: &str,
780                subject: &str,
781            ) -> DbResult<Option<User>> {
782                unimplemented!()
783            }
784
785            async fn create_oauth2_user(
786                &self,
787                username: &str,
788                issuer: &str,
789                subject: &str,
790                email: Option<String>,
791                is_admin: bool,
792                is_read_only: bool,
793            ) -> DbResult<User> {
794                unimplemented!()
795            }
796
797            async fn link_oauth2_identity(
798                &self,
799                user_id: i64,
800                issuer: &str,
801                subject: &str,
802                email: Option<String>,
803            ) -> DbResult<()> {
804                unimplemented!()
805            }
806
807            async fn store_oauth2_state(
808                &self,
809                state: &str,
810                pkce_verifier: &str,
811                nonce: &str,
812            ) -> DbResult<()> {
813                unimplemented!()
814            }
815
816            async fn get_and_delete_oauth2_state(
817                &self,
818                state: &str,
819            ) -> DbResult<Option<OAuth2StateData>> {
820                unimplemented!()
821            }
822
823            async fn cleanup_expired_oauth2_states(&self) -> DbResult<u64> {
824                unimplemented!()
825            }
826
827            async fn is_username_available(&self, username: &str) -> DbResult<bool> {
828                unimplemented!()
829            }
830
831            async fn add_toolchain(
832                &self,
833                name: &str,
834                version: &str,
835                date: &str,
836                channel: Option<String>,
837            ) -> DbResult<i64> {
838                unimplemented!()
839            }
840
841            async fn add_toolchain_target(
842                &self,
843                toolchain_id: i64,
844                target: &str,
845                storage_path: &str,
846                hash: &str,
847                size: i64,
848            ) -> DbResult<i64> {
849                unimplemented!()
850            }
851
852            async fn add_toolchain_component(
853                &self,
854                target_id: i64,
855                name: &str,
856                storage_path: &str,
857                hash: &str,
858                size: i64,
859            ) -> DbResult<()> {
860                unimplemented!()
861            }
862
863            async fn set_target_status(&self, target_id: i64, status: &str) -> DbResult<()> {
864                unimplemented!()
865            }
866
867            async fn get_toolchain_by_channel(&self, channel: &str) -> DbResult<Option<ToolchainWithTargets>> {
868                unimplemented!()
869            }
870
871            async fn get_toolchain_by_version(
872                &self,
873                name: &str,
874                version: &str,
875            ) -> DbResult<Option<ToolchainWithTargets>> {
876                unimplemented!()
877            }
878
879            async fn list_toolchains(&self) -> DbResult<Vec<ToolchainWithTargets>> {
880                unimplemented!()
881            }
882
883            async fn delete_toolchain(&self, name: &str, version: &str) -> DbResult<()> {
884                unimplemented!()
885            }
886
887            async fn delete_toolchain_target(
888                &self,
889                name: &str,
890                version: &str,
891                target: &str,
892            ) -> DbResult<()> {
893                unimplemented!()
894            }
895
896            async fn set_channel(&self, channel: &str, name: &str, version: &str) -> DbResult<()> {
897                unimplemented!()
898            }
899
900            async fn get_channels(&self) -> DbResult<Vec<ChannelInfo>> {
901                unimplemented!()
902            }
903        }
904    }
905}