Skip to content

Commit

Permalink
Move transfers to exe-unit components
Browse files Browse the repository at this point in the history
  • Loading branch information
nieznanysprawiciel committed Nov 27, 2023
1 parent be708ca commit c1ab24d
Show file tree
Hide file tree
Showing 23 changed files with 25 additions and 23 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ya-service-api-web = "0.2"
ya-service-bus = "0.6.1"
ya-sgx = "0.2"
ya-utils-path = "0.1"
ya-utils-futures = "0.2"
ya-utils-futures = "0.3"
ya-utils-process = { version = "0.2", features = ["lock"] }
ya-utils-networking = "0.2"
ya-fd-metrics = { path = "utils/fd-metrics" }
Expand Down Expand Up @@ -202,6 +202,7 @@ members = [
"exe-unit",
"exe-unit/runtime-api",
"exe-unit/tokio-process-ns",
"exe-unit/components/transfer",
"golem_cli",
"utils/actix_utils",
"utils/agreement-utils",
Expand All @@ -215,7 +216,6 @@ members = [
"utils/path",
"utils/process",
"utils/std-utils",
"utils/transfer",
"utils/diesel-utils",
"utils/fd-metrics",
"core/metrics",
Expand Down Expand Up @@ -290,7 +290,7 @@ ya-compile-time-utils = { path = "utils/compile-time-utils" }
ya-exe-unit = { path = "exe-unit" }
ya-file-logging = { path = "utils/file-logging" }
ya-manifest-utils = { path = "utils/manifest-utils" }
ya-transfer = { path = "utils/transfer" }
ya-transfer = { path = "exe-unit/components/transfer" }
ya-utils-actix = { path = "utils/actix_utils" }
ya-utils-cli = { path = "utils/cli" }
ya-utils-futures = { path = "utils/futures" }
Expand Down
2 changes: 1 addition & 1 deletion core/payment-driver/erc20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ trust-dns-resolver = { workspace = true }
ya-payment-driver = "0.3"
ya-client-model = "0.5"
ya-service-api-interfaces = "0.2"
ya-utils-futures = "0.2"
ya-utils-futures = "0.3"
ya-utils-networking = "0.2"
erc20_payment_lib = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion core/payment-driver/erc20next/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ web3 = { version = "0.19.0", default-features = false, features = [
ya-payment-driver = "0.3"
ya-client-model = "0.5"
ya-service-api-interfaces = "0.2"
ya-utils-futures = "0.2"
ya-utils-futures = "0.3"
ya-utils-networking = "0.2"
erc20_payment_lib = { workspace = true }

Expand Down
1 change: 1 addition & 0 deletions exe-unit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ya-runtime-api = { version = "0.7", path = "runtime-api", features = [
ya-service-bus = "0.6.1"
ya-transfer = "0.3"
ya-utils-path = "0.1"
ya-utils-futures = "0.3"
ya-std-utils = "0.1"
ya-utils-networking = { version = "0.2", default-features = false, features = [
"dns",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ya-client-model = "0.5"
ya-core-model = { version = "^0.9" }
ya-service-bus = "0.6.1"
ya-utils-path = "0.1"
ya-utils-futures = "0.3"
gftp = { version = "^0.3" }

actix-http = "3"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::error::{Error, TransferError};
use sha3::Digest;
use std::convert::TryFrom;
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
use std::path::{Component, PathBuf};
use ya_transfer::TransferUrl;

use crate::{error::Error as TransferError, TransferUrl};

#[derive(Debug, Clone)]
pub(crate) struct Cache {
pub struct Cache {
dir: PathBuf,
#[allow(dead_code)]
tmp_dir: PathBuf,
Expand Down Expand Up @@ -49,16 +49,16 @@ impl Cache {
}

impl TryFrom<ProjectedPath> for TransferUrl {
type Error = Error;
type Error = TransferError;

fn try_from(value: ProjectedPath) -> Result<Self, Error> {
fn try_from(value: ProjectedPath) -> Result<Self, TransferError> {
TransferUrl::parse(
value.to_path_buf().to_str().ok_or_else(|| {
Error::local(TransferError::InvalidUrlError("Invalid path".to_owned()))
})?,
value
.to_path_buf()
.to_str()
.ok_or_else(|| TransferError::InvalidUrlError("Invalid path".to_owned()))?,
"file",
)
.map_err(Error::local)
}
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod archive;
pub mod cache;
pub mod error;
mod file;
mod gftp;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions exe-unit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ pub mod process;
pub mod runtime;
pub mod service;
pub mod state;
pub mod util;

pub type Result<T> = std::result::Result<T, Error>;

lazy_static::lazy_static! {
Expand Down
4 changes: 2 additions & 2 deletions exe-unit/src/service/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ use url::Url;
use crate::deploy::ContainerVolume;
use crate::error::Error;
use crate::message::Shutdown;
use crate::util::cache::Cache;
use crate::util::Abort;
use crate::{ExeUnitContext, Result};

use ya_client_model::activity::TransferArgs;
use ya_transfer::cache::Cache;
use ya_transfer::error::Error as TransferError;
use ya_transfer::*;
use ya_utils_futures::abort::Abort;

#[derive(Clone, Debug, Message)]
#[rtype(result = "Result<()>")]
Expand Down
2 changes: 1 addition & 1 deletion utils/futures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ya-utils-futures"
version = "0.2.0"
version = "0.3.0"
authors = ["Golem Factory <contact@golem.network>"]
edition = "2018"

Expand Down
4 changes: 1 addition & 3 deletions exe-unit/src/util/mod.rs → utils/futures/src/abort.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use futures::future::{AbortHandle, AbortRegistration};
use futures3::future::{AbortHandle, AbortRegistration};
use std::cmp::Eq;
use std::hash::Hash;
use std::sync::atomic::{AtomicUsize, Ordering};

pub mod cache;

/// Allows storing AbortHandle objects in a container
#[derive(Clone, Debug)]
pub struct Abort {
Expand Down
1 change: 1 addition & 0 deletions utils/futures/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod abort;
pub mod timeout;

0 comments on commit c1ab24d

Please sign in to comment.