JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Add backend trait and git backend stub

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨b9203a9

⁨src/backend/mod.rs⁩ - ⁨1471⁩ bytes
Raw
1 pub mod git;
2
3 use std::error::Error;
4
5 use crate::{
6 command::repository::{
7 CreateRepositoryCommand, CreateRepositoryResponse, RepositoryFileInspectionCommand,
8 RepositoryFileInspectionResponse, RepositoryInfoRequest, RepositoryIssueLabelsRequest,
9 RepositoryIssueLabelsResponse, RepositoryIssuesCountRequest, RepositoryIssuesCountResponse,
10 RepositoryIssuesRequest, RepositoryIssuesResponse,
11 },
12 model::repository::RepositoryView,
13 };
14
15 pub trait RepositoryBackend {
16 fn create_repository(
17 &mut self,
18 request: &CreateRepositoryCommand,
19 ) -> Result<CreateRepositoryResponse, Box<dyn Error + Send>>;
20 fn repository_info(
21 &mut self,
22 request: &RepositoryInfoRequest,
23 ) -> Result<RepositoryView, Box<dyn Error + Send>>;
24 fn repository_file_inspect(
25 &mut self,
26 request: &RepositoryFileInspectionCommand,
27 ) -> Result<RepositoryFileInspectionResponse, Box<dyn Error + Send>>;
28
29 fn repository_issues_count(
30 &mut self,
31 request: &RepositoryIssuesCountRequest,
32 ) -> Result<RepositoryIssuesCountResponse, Box<dyn Error + Send>>;
33 fn repository_issue_labels(
34 &mut self,
35 request: &RepositoryIssueLabelsRequest,
36 ) -> Result<RepositoryIssueLabelsResponse, Box<dyn Error + Send>>;
37 fn repository_issues(
38 &mut self,
39 request: &RepositoryIssuesRequest,
40 ) -> Result<RepositoryIssuesResponse, Box<dyn Error + Send>>;
41 }
42