Skip to content

Commit

Permalink
feat: added primitive support for plugin downloading, decompression a…
Browse files Browse the repository at this point in the history
…nd unarchiving
  • Loading branch information
patrickjcasey authored and alilleybrinker committed Sep 3, 2024
1 parent a0b6567 commit 55fe6f5
Show file tree
Hide file tree
Showing 8 changed files with 426 additions and 82 deletions.
89 changes: 81 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions hipcheck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ benchmarking = []

async-stream = "0.3.5"
base64 = "0.22.1"
blake3 = "1.5.4"
content_inspector = "0.2.4"
cyclonedx-bom = "0.7.0"
dotenv = "0.15.0"
Expand All @@ -47,6 +48,7 @@ env_logger = { version = "0.11.5" }
finl_unicode = { version = "1.2.0", default-features = false, features = [
"grapheme_clusters",
] }
flate2 = "1.0.33"
fs_extra = "1.3.0"
futures = "0.3.30"
# Vendor libgit2 and openssl so that they will be statically included
Expand Down Expand Up @@ -106,6 +108,7 @@ semver = "1.0.9"
serde = { version = "1.0.206", features = ["derive", "rc"] }
serde_derive = "1.0.137"
serde_json = "1.0.122"
sha256 = { version = "1.5.0", default-features = false }
smart-default = "0.7.1"
spdx-rs = "0.5.0"
tabled = "0.16.0"
Expand All @@ -117,6 +120,7 @@ tokio = { version = "1.39.3", features = [
"sync",
"time",
] }
tokio-stream = "0.1.15"
toml = "0.8.19"
tonic = "0.12.1"
thiserror = "1.0.63"
Expand All @@ -130,8 +134,9 @@ walkdir = "2.5.0"
which = { version = "6.0.3", default-features = false }
xml-rs = "0.8.20"
xz2 = "0.1.7"
zip = "2.1.6"
tokio-stream = "0.1.15"
zip = "2.2.0"
zip-extensions = "0.8.1"
zstd = "0.13.2"

[build-dependencies]

Expand Down
18 changes: 18 additions & 0 deletions hipcheck/src/cache/plugin_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ use std::path::{Path, PathBuf};

use pathbuf::pathbuf;

use crate::plugin::{PluginArch, PluginName, PluginPublisher, PluginVersion};

/// Plugins are stored with the following format `<path_to_plugin_cache>/<publisher>/<plugin_name>/<version>/<arch>`
pub struct HcPluginCache {
path: PathBuf,
}
Expand All @@ -13,4 +16,19 @@ impl HcPluginCache {
let plugins_path = pathbuf![path, "plugins"];
Self { path: plugins_path }
}

/// `<path_to_plugin_cache>/<publisher>/<plugin_name>/<version>/<arch>`
pub fn plugin_download_dir(
&self,
publisher: &PluginPublisher,
name: &PluginName,
version: &PluginVersion,
arch: &PluginArch,
) -> PathBuf {
self.path
.join(&publisher.0)
.join(&name.0)
.join(&version.0)
.join(&arch.0)
}
}
Loading

0 comments on commit 55fe6f5

Please sign in to comment.