Skip to content

Commit 7ea984b

Browse files
committed
WIP
1 parent 7dc23a1 commit 7ea984b

32 files changed

Lines changed: 205 additions & 144 deletions

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version = "0.3.0"
33
[workspace]
44

55
members = [
6+
"rain_client",
67
"rain_core",
78
"rain_server",
89
"rain_task",

rain_client/Cargo.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "rain_client"
3+
version = "0.3.0"
4+
5+
description = "Distributed computational framework for large-scale task-based pipelines. Client library in Rust."
6+
# documentation = "https://docs.rs/rain_task/" # default docs.rs
7+
homepage = "https://github.com/substantic/rain"
8+
repository = "https://github.com/substantic/rain/"
9+
readme = "README.md"
10+
authors = [
11+
"Stanislav Bohm <spirali@kreatrix.org>",
12+
"Tomas Gavenciak <gavento@ucw.cz>",
13+
"Vojtech Cima <cima.vojtech@gmail.com>",
14+
]
15+
license = "MIT"
16+
17+
exclude = ["testing/**/*"]
18+
19+
[badges]
20+
travis-ci = { repository = "substantic/rain", branch = "master" }
21+
maintenance = { status = "actively-developed" }
22+
23+
[dependencies]
24+
futures="0.1"
25+
log = "0.4"
26+
rain_core = "0.3.0"
27+
tokio-core="0.1"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::error::Error;
22
use std::net::SocketAddr;
33

4-
use CLIENT_PROTOCOL_VERSION;
5-
use super::session::Session;
64
use super::communicator::Communicator;
5+
use super::session::Session;
6+
use rain_core::CLIENT_PROTOCOL_VERSION;
77
use std::rc::Rc;
88

99
pub struct Client {
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
use tokio_core::reactor::Core;
1+
use futures::Future;
2+
use rain_core::capnp_rpc::rpc_twoparty_capnp;
3+
use rain_core::comm::new_rpc_system;
4+
use std::error::Error;
25
use std::net::SocketAddr;
36
use tokio_core::net::TcpStream;
4-
use std::error::Error;
5-
use common::rpc::new_rpc_system;
6-
use capnp_rpc::rpc_twoparty_capnp;
7-
use futures::Future;
7+
use tokio_core::reactor::Core;
88

99
use super::task::Task;
10-
use common::id::{DataObjectId, TaskId};
11-
use common::convert::{FromCapnp, ToCapnp};
1210
use client::dataobject::DataObject;
11+
use rain_core::types::{DataObjectId, TaskId};
12+
use rain_core::utils::{FromCapnp, ToCapnp};
1313
use std::cell::RefCell;
1414
use std::cell::RefMut;
1515

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
use common::Attributes;
2-
use common::id::DataObjectId;
3-
use common::DataType;
1+
use rain_core::types::{DataObjectId, DataType};
42
use std::cell::Cell;
53

64
pub struct DataObject {
75
pub id: DataObjectId,
86
pub label: String,
97
pub keep: Cell<bool>,
108
pub data: Option<Vec<u8>>,
11-
pub attributes: Attributes,
129
pub data_type: DataType,
10+
pub attributes: Attributes,
1311
}
1412

1513
impl DataObject {
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
use super::task::Task;
22
use client::dataobject::DataObject;
33
use client::task::TaskInput;
4-
use common::convert::ToCapnp;
5-
use common::id::DataObjectId;
4+
use rain_core::types::DataObjectId;
5+
use rain_core::utils::ToCapnp;
66

77
macro_rules! to_capnp_list {
8-
($builder:expr, $items:expr, $name:ident) => {
9-
{
10-
let mut builder = $builder.$name($items.len() as u32);
11-
for (i, obj) in $items.iter().enumerate() {
12-
obj.to_capnp(&mut builder.reborrow().get(i as u32));
13-
}
8+
($builder:expr, $items:expr, $name:ident) => {{
9+
let mut builder = $builder.$name($items.len() as u32);
10+
for (i, obj) in $items.iter().enumerate() {
11+
obj.to_capnp(&mut builder.reborrow().get(i as u32));
1412
}
15-
}
13+
}};
1614
}
1715
macro_rules! from_capnp_list {
18-
($builder:expr, $items:ident, $obj:ident) => {
19-
{
20-
$builder
21-
.$items()?
22-
.iter()
23-
.map(|item| $obj::from_capnp(&item))
24-
.collect()
25-
}
26-
}
16+
($builder:expr, $items:ident, $obj:ident) => {{
17+
$builder
18+
.$items()?
19+
.iter()
20+
.map(|item| $obj::from_capnp(&item))
21+
.collect()
22+
}};
2723
}
2824

2925
impl<'a> ToCapnp<'a> for TaskInput {
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
use super::communicator::Communicator;
22
use client::dataobject::DataObject;
33
use client::task::Task;
4-
use std::collections::HashMap;
5-
use std::error::Error;
64
use client::task::TaskInput;
7-
use common::Attributes;
8-
use common::id::TaskId;
9-
use common::id::DataObjectId;
10-
use common::id::SId;
11-
use common::DataType;
5+
use rain_core::common_capnp;
6+
use rain_core::types::{DataObjectId, DataType, SId, TaskId};
127
use std::cell::Cell;
8+
use std::collections::HashMap;
9+
use std::error::Error;
1310
use std::rc::Rc;
1411

1512
pub type DataObjectPtr = Rc<DataObject>;
@@ -82,7 +79,7 @@ impl Session {
8279
}
8380
pub fn wait_all(&mut self) -> Result<(), Box<Error>> {
8481
self.comm.wait(
85-
&vec![TaskId::new(self.id, ::common_capnp::ALL_TASKS_ID)],
82+
&vec![TaskId::new(self.id, common_capnp::ALL_TASKS_ID)],
8683
&vec![],
8784
)
8885
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use std::error::Error;
2-
use common::Attributes;
3-
use common::id::TaskId;
41
use super::session::DataObjectPtr;
2+
use rain_core::types::TaskId;
3+
use std::error::Error;
54

65
pub struct TaskInput {
76
pub label: Option<String>,
@@ -13,7 +12,6 @@ pub struct Task {
1312
pub command: String,
1413
pub inputs: Vec<TaskInput>,
1514
pub outputs: Vec<DataObjectPtr>,
16-
pub attributes: Attributes,
1715
}
1816

1917
impl Task {

0 commit comments

Comments
 (0)