Skip to content

Commit

Permalink
move litehouse registry out
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Jun 9, 2024
1 parent dd00c75 commit d95f696
Show file tree
Hide file tree
Showing 8 changed files with 731 additions and 589 deletions.
1,280 changes: 697 additions & 583 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion crates/litehouse-config/src/manifest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! The manifest file format contains a plugin import alongside 1 or more instance configurations

use base64::Engine;

use crate::{import::ImportParseError, Import};
use std::{collections::HashMap, str::FromStr};

Expand Down Expand Up @@ -48,7 +50,9 @@ impl FromStr for Manifest {
.split_once('#')
.ok_or(ManifestImportError::MissingDelimiter)?;
let import = Import::from_str(import)?;
let json = base64::decode(base64_json).map_err(|_| ManifestImportError::InvalidBase64)?;
let json = base64::prelude::BASE64_STANDARD
.decode(base64_json)
.map_err(|_| ManifestImportError::InvalidBase64)?;
let config =
serde_json::from_slice(&json).map_err(|_| ManifestImportError::InvalidManifest)?;

Expand Down
1 change: 1 addition & 0 deletions crates/litehouse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ bytes = "1.5.0"
which = "6.0.1"
inquire = "0.7.5"
opendal-fs-cache = { version = "0.1.0", path = "../opendal-fs-cache" }
litehouse-registry = { version = "0.1.0", path = "../registry" }

[dev-dependencies]
rusty-hook = "0.11.2"
6 changes: 3 additions & 3 deletions crates/litehouse/src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ use litehouse_config::{
ManifestImport, ParseError, PluginConfig,
};
use litehouse_plugin::serde_json;
use litehouse_registry::Registry;
use miette::{Context, IntoDiagnostic, NamedSource, Result};
use tokio::sync::broadcast::channel;

use crate::{
registry::Registry,
runtime::{set_up_engine, PluginRunnerFactory},
store::StoreStrategy,
util::resolve_span,
Expand Down Expand Up @@ -222,7 +222,7 @@ impl Subcommand {

println!("downloading");

let pass = packages::fetch(
let _pass = packages::fetch(
&config,
&registry
.with_download(wasm_path, cache_dir)
Expand Down Expand Up @@ -442,7 +442,7 @@ impl Subcommand {
let cache_dir = litehouse_config::directories().map(|d| d.cache_dir().to_owned());
let config = LitehouseConfig::load()?;

let pass = packages::fetch(
let _pass = packages::fetch(
&config,
&registry
.with_download(wasm_path, cache_dir)
Expand Down
2 changes: 1 addition & 1 deletion crates/litehouse/src/cmd/packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use litehouse_plugin::serde_json;
use tokio::process::Command;
use tokio_stream::StreamExt;

use crate::registry::{Download, Registry, Upload};
use litehouse_registry::{Download, Registry, Upload};

const WASM_PROCESS_FILE: &[u8] =
include_bytes!("../../../litehouse/wasi_snapshot_preview1.reactor.wasm");
Expand Down
1 change: 0 additions & 1 deletion crates/litehouse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilte

mod cache;
mod cmd;
mod registry;
mod runtime;
mod store;
mod util;
Expand Down
24 changes: 24 additions & 0 deletions crates/registry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "litehouse-registry"
version = "0.1.0"
repository.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
description.workspace = true
homepage.workspace = true

[dependencies]
litehouse-config = { version = "0.1.0", path = "../litehouse-config" }
miette = "7.2.0"
opendal = "0.45.1"
opendal-fs-cache = { version = "0.1.0", path = "../opendal-fs-cache" }
tokio = { version = "1.38.0", features = ["fs"] }

# anonymous s3
anyhow = "1.0.86"
reqsign = { version = "0.14.9" }
reqwest = { version = "0.11.24", default-features = false, features = [
"rustls-tls",
] }
async-trait = "0.1.80"
File renamed without changes.

0 comments on commit d95f696

Please sign in to comment.