This repository has been archived by the owner on May 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
590 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mod pacbuild; | ||
mod repository; | ||
|
||
pub use crate::model::pacbuild::*; | ||
pub use crate::model::repository::Repository; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use chrono::NaiveDateTime as DateTime; | ||
use serde_derive::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct PacBuild { | ||
pub name: PackageId, | ||
pub last_updated: DateTime, | ||
pub repository: URL, | ||
pub maintainer: String, | ||
pub package_name: String, | ||
pub description: String, | ||
pub homepage: URL, | ||
pub repology_version: Version, | ||
pub repology: URL, | ||
pub install_state: InstallState, | ||
pub dependencies: Vec<PackageId>, | ||
pub optional_dependencies: Vec<PackageId>, | ||
pub license: String, | ||
pub url: URL, | ||
pub kind: Kind, | ||
} | ||
|
||
pub type Version = String; | ||
pub type PackageId = String; | ||
pub type URL = String; | ||
pub type Hash = String; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum InstallState { | ||
Direct(DateTime, Version), | ||
Indirect(DateTime, Version), | ||
None, | ||
} | ||
|
||
impl InstallState { | ||
pub fn is_installed(&self) -> bool { | ||
match self { | ||
Self::None => false, | ||
_ => true, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum Kind { | ||
AppImage(Hash), | ||
Binary(Hash), | ||
DebFile(Hash), | ||
GitBranch, | ||
GitRelease, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use chrono::NaiveDateTime as DateTime; | ||
use serde_derive::{Deserialize, Serialize}; | ||
|
||
use crate::model::pacbuild::PacBuild; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct Repository { | ||
pub name: String, | ||
pub last_updated: DateTime, | ||
pub url: String, | ||
pub pacbuilds: Vec<PacBuild>, | ||
pub priority: u8, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use self::storable::Storable; | ||
|
||
mod error; | ||
mod filesystem; | ||
pub mod filters; | ||
pub mod storable; | ||
|
||
pub use error::StoreError; | ||
pub use filesystem::FileSystemStore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#[derive(Clone)] | ||
pub struct StoreError { | ||
pub message: String, | ||
} | ||
|
||
impl StoreError { | ||
pub fn new(message: &str) -> StoreError { | ||
StoreError { | ||
message: message.to_string(), | ||
} | ||
} | ||
} | ||
|
||
impl std::fmt::Display for StoreError { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "Store error: {}", self.message) | ||
} | ||
} | ||
|
||
impl std::fmt::Debug for StoreError { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "[{}:{}] Store error: {}", file!(), line!(), self.message) | ||
} | ||
} |
Oops, something went wrong.