refactor grin crate into separate modules (#955)

This commit is contained in:
Yeastplume 2018-04-12 10:11:24 +01:00 committed by GitHub
parent 8e26d4dbac
commit 1c5aee68bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 146 additions and 95 deletions

View file

@ -28,7 +28,7 @@ env:
- RUST_BACKTRACE="1" - RUST_BACKTRACE="1"
- RUST_FLAGS="-C debug-assertions" - RUST_FLAGS="-C debug-assertions"
matrix: matrix:
- RUST_TEST_THREADS=1 TEST_DIR=grin - RUST_TEST_THREADS=1 TEST_DIR=servers
- TEST_DIR=store - TEST_DIR=store
- TEST_DIR=chain - TEST_DIR=chain
- TEST_DIR=pool - TEST_DIR=pool

58
Cargo.lock generated
View file

@ -603,10 +603,10 @@ dependencies = [
"grin_api 0.2.0", "grin_api 0.2.0",
"grin_config 0.2.0", "grin_config 0.2.0",
"grin_core 0.2.0", "grin_core 0.2.0",
"grin_grin 0.2.0",
"grin_keychain 0.2.0", "grin_keychain 0.2.0",
"grin_p2p 0.2.0", "grin_p2p 0.2.0",
"grin_pow 0.2.0", "grin_pow 0.2.0",
"grin_servers 0.2.0",
"grin_util 0.2.0", "grin_util 0.2.0",
"grin_wallet 0.2.0", "grin_wallet 0.2.0",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -662,9 +662,9 @@ dependencies = [
name = "grin_config" name = "grin_config"
version = "0.2.0" version = "0.2.0"
dependencies = [ dependencies = [
"grin_grin 0.2.0",
"grin_p2p 0.2.0", "grin_p2p 0.2.0",
"grin_pow 0.2.0", "grin_pow 0.2.0",
"grin_servers 0.2.0",
"grin_util 0.2.0", "grin_util 0.2.0",
"grin_wallet 0.2.0", "grin_wallet 0.2.0",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -691,33 +691,6 @@ dependencies = [
"time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "grin_grin"
version = "0.2.0"
dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_api 0.2.0",
"grin_chain 0.2.0",
"grin_config 0.2.0",
"grin_core 0.2.0",
"grin_keychain 0.2.0",
"grin_p2p 0.2.0",
"grin_pool 0.2.0",
"grin_pow 0.2.0",
"grin_store 0.2.0",
"grin_util 0.2.0",
"grin_wallet 0.2.0",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"router 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "grin_keychain" name = "grin_keychain"
version = "0.2.0" version = "0.2.0"
@ -783,6 +756,33 @@ dependencies = [
"time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "grin_servers"
version = "0.2.0"
dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"grin_api 0.2.0",
"grin_chain 0.2.0",
"grin_config 0.2.0",
"grin_core 0.2.0",
"grin_keychain 0.2.0",
"grin_p2p 0.2.0",
"grin_pool 0.2.0",
"grin_pow 0.2.0",
"grin_store 0.2.0",
"grin_util 0.2.0",
"grin_wallet 0.2.0",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"router 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "grin_store" name = "grin_store"
version = "0.2.0" version = "0.2.0"

View file

@ -7,7 +7,7 @@ publish = false
build = "src/build/build.rs" build = "src/build/build.rs"
[workspace] [workspace]
members = ["api", "chain", "config", "core", "grin", "keychain", "p2p", "store", "util", "pool", "wallet"] members = ["api", "chain", "config", "core", "keychain", "p2p", "servers", "store", "util", "pool", "wallet"]
[[bin]] [[bin]]
name = "grin" name = "grin"
@ -27,10 +27,10 @@ time = "0.1"
grin_api = { path = "./api" } grin_api = { path = "./api" }
grin_config = { path = "./config" } grin_config = { path = "./config" }
grin_core = { path = "./core" } grin_core = { path = "./core" }
grin_grin = { path = "./grin" }
grin_keychain = { path = "./keychain" } grin_keychain = { path = "./keychain" }
grin_p2p = { path = "./p2p"} grin_p2p = { path = "./p2p"}
grin_pow = { path = "./pow"} grin_pow = { path = "./pow"}
grin_servers = { path = "./servers" }
grin_util = { path = "./util"} grin_util = { path = "./util"}
grin_wallet = { path = "./wallet" } grin_wallet = { path = "./wallet" }

View file

@ -10,7 +10,7 @@ serde = "1"
serde_derive = "1" serde_derive = "1"
toml = "0.4" toml = "0.4"
grin_grin = { path = "../grin" } grin_servers = { path = "../servers" }
grin_p2p = { path = "../p2p" } grin_p2p = { path = "../p2p" }
grin_pow = { path = "../pow"} grin_pow = { path = "../pow"}
grin_util = { path = "../util" } grin_util = { path = "../util" }

View file

@ -20,7 +20,7 @@ use std::path::PathBuf;
use std::fs::File; use std::fs::File;
use toml; use toml;
use grin::ServerConfig; use servers::ServerConfig;
use pow::types::MinerConfig; use pow::types::MinerConfig;
use util::LoggingConfig; use util::LoggingConfig;
use types::{ConfigError, ConfigMembers, GlobalConfig}; use types::{ConfigError, ConfigMembers, GlobalConfig};

View file

@ -25,7 +25,7 @@ extern crate serde;
extern crate serde_derive; extern crate serde_derive;
extern crate toml; extern crate toml;
extern crate grin_grin as grin; extern crate grin_servers as servers;
extern crate grin_p2p as p2p; extern crate grin_p2p as p2p;
extern crate grin_pow as pow; extern crate grin_pow as pow;
extern crate grin_util as util; extern crate grin_util as util;

View file

@ -18,7 +18,7 @@ use std::path::PathBuf;
use std::io; use std::io;
use std::fmt; use std::fmt;
use grin::ServerConfig; use servers::ServerConfig;
use pow::types::MinerConfig; use pow::types::MinerConfig;
use util::LoggingConfig; use util::LoggingConfig;
use wallet::WalletConfig; use wallet::WalletConfig;

View file

@ -1,5 +1,5 @@
[package] [package]
name = "grin_grin" name = "grin_servers"
version = "0.2.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."

View file

@ -31,7 +31,7 @@ use p2p;
use pool; use pool;
use util::OneTime; use util::OneTime;
use store; use store;
use types::{ChainValidationMode, ServerConfig}; use common::types::{ChainValidationMode, ServerConfig};
use util::LOGGER; use util::LOGGER;
// All adapters use `Weak` references instead of `Arc` to avoid cycles that // All adapters use `Weak` references instead of `Arc` to avoid cycles that

19
servers/src/common/mod.rs Normal file
View file

@ -0,0 +1,19 @@
// Copyright 2018 The Grin Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Modules common to all Grin server types
pub mod adapters;
pub mod stats;
pub mod types;

20
servers/src/grin/mod.rs Normal file
View file

@ -0,0 +1,20 @@
// Copyright 2018 The Grin Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Grin P2P / API server
pub mod dandelion_monitor;
pub mod seed;
pub mod server;
pub mod sync;

View file

@ -22,20 +22,20 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::thread; use std::thread;
use std::time; use std::time;
use adapters::*; use common::adapters::*;
use api; use api;
use chain; use chain;
use core::{consensus, genesis, global}; use core::{consensus, genesis, global};
use core::core::target::Difficulty; use core::core::target::Difficulty;
use core::core::hash::Hashed; use core::core::hash::Hashed;
use dandelion_monitor; use grin::dandelion_monitor;
use miner; use mining::miner;
use p2p; use p2p;
use pool; use pool;
use seed; use grin::seed;
use sync; use grin::sync;
use types::*; use common::types::*;
use stats::*; use common::stats::*;
use pow; use pow;
use util::LOGGER; use util::LOGGER;

View file

@ -23,7 +23,7 @@ use core::core::hash::{Hash, Hashed};
use core::core::target::Difficulty; use core::core::target::Difficulty;
use core::global; use core::global;
use p2p::{self, Peer, Peers}; use p2p::{self, Peer, Peers};
use types::Error; use common::types::Error;
use util::LOGGER; use util::LOGGER;
/// Starts the syncing loop, just spawns two threads that loop forever /// Starts the syncing loop, just spawns two threads that loop forever

View file

@ -43,15 +43,10 @@ extern crate grin_store as store;
extern crate grin_util as util; extern crate grin_util as util;
extern crate grin_wallet as wallet; extern crate grin_wallet as wallet;
mod adapters; mod common;
mod dandelion_monitor; mod grin;
mod server; mod mining;
mod seed;
mod sync;
pub mod types;
pub mod stats;
mod miner;
pub use server::Server; pub use grin::server::Server;
pub use types::{Seeding, ServerConfig}; pub use common::types::{Seeding, ServerConfig};
pub use stats::ServerStats; pub use common::stats::{PeerStats, ServerStats, DiffBlock};

View file

@ -22,7 +22,7 @@ use std::thread;
use std::time::Duration; use std::time::Duration;
use time; use time;
use adapters::PoolToChainAdapter; use common::adapters::PoolToChainAdapter;
use core::consensus; use core::consensus;
use core::core; use core::core;
use core::core::Proof; use core::core::Proof;
@ -34,8 +34,8 @@ use core::ser;
use core::global; use core::global;
use core::ser::AsFixedBytes; use core::ser::AsFixedBytes;
use util::LOGGER; use util::LOGGER;
use types::Error; use common::types::Error;
use stats::MiningStats; use common::stats::MiningStats;
use chain; use chain;
use pool; use pool;

17
servers/src/mining/mod.rs Normal file
View file

@ -0,0 +1,17 @@
// Copyright 2018 The Grin Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Mining + Mining server
pub mod miner;

View file

@ -19,7 +19,7 @@ extern crate grin_api as api;
extern crate grin_chain as chain; extern crate grin_chain as chain;
extern crate grin_config as config; extern crate grin_config as config;
extern crate grin_core as core; extern crate grin_core as core;
extern crate grin_grin as grin; extern crate grin_servers as servers;
extern crate grin_p2p as p2p; extern crate grin_p2p as p2p;
extern crate grin_pow as pow; extern crate grin_pow as pow;
extern crate grin_util as util; extern crate grin_util as util;

View file

@ -20,7 +20,7 @@ extern crate grin_api as api;
extern crate grin_chain as chain; extern crate grin_chain as chain;
extern crate grin_config as config; extern crate grin_config as config;
extern crate grin_core as core; extern crate grin_core as core;
extern crate grin_grin as grin; extern crate grin_servers as servers;
extern crate grin_p2p as p2p; extern crate grin_p2p as p2p;
extern crate grin_pow as pow; extern crate grin_pow as pow;
extern crate grin_util as util; extern crate grin_util as util;

View file

@ -15,7 +15,7 @@
extern crate grin_api as api; extern crate grin_api as api;
extern crate grin_chain as chain; extern crate grin_chain as chain;
extern crate grin_core as core; extern crate grin_core as core;
extern crate grin_grin as grin; extern crate grin_servers as servers;
extern crate grin_keychain as keychain; extern crate grin_keychain as keychain;
extern crate grin_p2p as p2p; extern crate grin_p2p as p2p;
extern crate grin_pow as pow; extern crate grin_pow as pow;
@ -128,7 +128,7 @@ pub struct LocalServerContainer {
// Structure of references to the // Structure of references to the
// internal server data // internal server data
pub p2p_server_stats: Option<grin::ServerStats>, pub p2p_server_stats: Option<servers::ServerStats>,
// The API server instance // The API server instance
api_server: Option<api::ApiServer>, api_server: Option<api::ApiServer>,
@ -178,14 +178,14 @@ impl LocalServerContainer {
}) })
} }
pub fn run_server(&mut self, duration_in_seconds: u64) -> grin::ServerStats { pub fn run_server(&mut self, duration_in_seconds: u64) -> servers::ServerStats {
let api_addr = format!("{}:{}", self.config.base_addr, self.config.api_server_port); let api_addr = format!("{}:{}", self.config.base_addr, self.config.api_server_port);
let mut seeding_type = grin::Seeding::None; let mut seeding_type = servers::Seeding::None;
let mut seeds = Vec::new(); let mut seeds = Vec::new();
if self.config.seed_addr.len() > 0 { if self.config.seed_addr.len() > 0 {
seeding_type = grin::Seeding::List; seeding_type = servers::Seeding::List;
seeds = vec![self.config.seed_addr.to_string()]; seeds = vec![self.config.seed_addr.to_string()];
} }
@ -205,7 +205,7 @@ impl LocalServerContainer {
..Default::default() ..Default::default()
}; };
let s = grin::Server::new(grin::ServerConfig { let s = servers::Server::new(servers::ServerConfig {
api_http_addr: api_addr, api_http_addr: api_addr,
db_root: format!("{}/.grin", self.working_dir), db_root: format!("{}/.grin", self.working_dir),
p2p_config: p2p::P2PConfig { p2p_config: p2p::P2PConfig {
@ -498,7 +498,7 @@ impl LocalServerContainerPool {
/// once they've all been run /// once they've all been run
/// ///
pub fn run_all_servers(self) -> Vec<grin::ServerStats> { pub fn run_all_servers(self) -> Vec<servers::ServerStats> {
let run_length = self.config.run_length_in_seconds; let run_length = self.config.run_length_in_seconds;
let mut handles = vec![]; let mut handles = vec![];

View file

@ -15,7 +15,7 @@
extern crate grin_api as api; extern crate grin_api as api;
extern crate grin_chain as chain; extern crate grin_chain as chain;
extern crate grin_core as core; extern crate grin_core as core;
extern crate grin_grin as grin; extern crate grin_servers as servers;
extern crate grin_p2p as p2p; extern crate grin_p2p as p2p;
extern crate grin_pow as pow; extern crate grin_pow as pow;
extern crate grin_util as util; extern crate grin_util as util;
@ -186,7 +186,7 @@ fn simulate_block_propagation() {
// instantiates 5 servers on different ports // instantiates 5 servers on different ports
let mut servers = vec![]; let mut servers = vec![];
for n in 0..5 { for n in 0..5 {
let s = grin::Server::new(config(10 * n, test_name_dir, 0)).unwrap(); let s = servers::Server::new(config(10 * n, test_name_dir, 0)).unwrap();
servers.push(s); servers.push(s);
thread::sleep(time::Duration::from_millis(100)); thread::sleep(time::Duration::from_millis(100));
} }
@ -226,14 +226,14 @@ fn simulate_full_sync() {
let test_name_dir = "grin-sync"; let test_name_dir = "grin-sync";
framework::clean_all_output(test_name_dir); framework::clean_all_output(test_name_dir);
let s1 = grin::Server::new(config(1000, "grin-sync", 1000)).unwrap(); let s1 = servers::Server::new(config(1000, "grin-sync", 1000)).unwrap();
// mine a few blocks on server 1 // mine a few blocks on server 1
s1.start_miner(miner_config()); s1.start_miner(miner_config());
thread::sleep(time::Duration::from_secs(8)); thread::sleep(time::Duration::from_secs(8));
#[ignore(unused_mut)] // mut needed? #[ignore(unused_mut)] // mut needed?
let mut conf = config(1001, "grin-sync", 1000); let mut conf = config(1001, "grin-sync", 1000);
let s2 = grin::Server::new(conf).unwrap(); let s2 = servers::Server::new(conf).unwrap();
while s2.head().height < 4 { while s2.head().height < 4 {
thread::sleep(time::Duration::from_millis(100)); thread::sleep(time::Duration::from_millis(100));
} }
@ -253,14 +253,14 @@ fn simulate_fast_sync() {
let test_name_dir = "grin-fast"; let test_name_dir = "grin-fast";
framework::clean_all_output(test_name_dir); framework::clean_all_output(test_name_dir);
let s1 = grin::Server::new(config(2000, "grin-fast", 2000)).unwrap(); let s1 = servers::Server::new(config(2000, "grin-fast", 2000)).unwrap();
// mine a few blocks on server 1 // mine a few blocks on server 1
s1.start_miner(miner_config()); s1.start_miner(miner_config());
thread::sleep(time::Duration::from_secs(8)); thread::sleep(time::Duration::from_secs(8));
let mut conf = config(2001, "grin-fast", 2000); let mut conf = config(2001, "grin-fast", 2000);
conf.archive_mode = Some(false); conf.archive_mode = Some(false);
let s2 = grin::Server::new(conf).unwrap(); let s2 = servers::Server::new(conf).unwrap();
while s2.head().height != s2.header_head().height || s2.head().height < 20 { while s2.head().height != s2.header_head().height || s2.head().height < 20 {
thread::sleep(time::Duration::from_millis(1000)); thread::sleep(time::Duration::from_millis(1000));
} }
@ -280,7 +280,7 @@ fn simulate_fast_sync_double() {
framework::clean_all_output("grin-double-fast1"); framework::clean_all_output("grin-double-fast1");
framework::clean_all_output("grin-double-fast2"); framework::clean_all_output("grin-double-fast2");
let s1 = grin::Server::new(config(3000, "grin-double-fast1", 3000)).unwrap(); let s1 = servers::Server::new(config(3000, "grin-double-fast1", 3000)).unwrap();
// mine a few blocks on server 1 // mine a few blocks on server 1
s1.start_miner(miner_config()); s1.start_miner(miner_config());
thread::sleep(time::Duration::from_secs(8)); thread::sleep(time::Duration::from_secs(8));
@ -288,7 +288,7 @@ fn simulate_fast_sync_double() {
{ {
let mut conf = config(3001, "grin-double-fast2", 3000); let mut conf = config(3001, "grin-double-fast2", 3000);
conf.archive_mode = Some(false); conf.archive_mode = Some(false);
let s2 = grin::Server::new(conf).unwrap(); let s2 = servers::Server::new(conf).unwrap();
while s2.head().height != s2.header_head().height || s2.head().height < 20 { while s2.head().height != s2.header_head().height || s2.head().height < 20 {
thread::sleep(time::Duration::from_millis(1000)); thread::sleep(time::Duration::from_millis(1000));
} }
@ -301,7 +301,7 @@ fn simulate_fast_sync_double() {
let mut conf = config(3001, "grin-double-fast2", 3000); let mut conf = config(3001, "grin-double-fast2", 3000);
conf.archive_mode = Some(false); conf.archive_mode = Some(false);
let s2 = grin::Server::new(conf).unwrap(); let s2 = servers::Server::new(conf).unwrap();
while s2.head().height != s2.header_head().height || s2.head().height < 50 { while s2.head().height != s2.header_head().height || s2.head().height < 50 {
thread::sleep(time::Duration::from_millis(1000)); thread::sleep(time::Duration::from_millis(1000));
} }
@ -309,15 +309,15 @@ fn simulate_fast_sync_double() {
s2.stop(); s2.stop();
} }
fn config(n: u16, test_name_dir: &str, seed_n: u16) -> grin::ServerConfig { fn config(n: u16, test_name_dir: &str, seed_n: u16) -> servers::ServerConfig {
grin::ServerConfig { servers::ServerConfig {
api_http_addr: format!("127.0.0.1:{}", 20000 + n), api_http_addr: format!("127.0.0.1:{}", 20000 + n),
db_root: format!("target/tmp/{}/grin-sync-{}", test_name_dir, n), db_root: format!("target/tmp/{}/grin-sync-{}", test_name_dir, n),
p2p_config: p2p::P2PConfig { p2p_config: p2p::P2PConfig {
port: 10000 + n, port: 10000 + n,
..p2p::P2PConfig::default() ..p2p::P2PConfig::default()
}, },
seeding_type: grin::Seeding::List, seeding_type: servers::Seeding::List,
seeds: Some(vec![format!("127.0.0.1:{}", 10000 + seed_n)]), seeds: Some(vec![format!("127.0.0.1:{}", 10000 + seed_n)]),
chain_type: core::global::ChainTypes::AutomatedTesting, chain_type: core::global::ChainTypes::AutomatedTesting,
archive_mode: Some(true), archive_mode: Some(true),

View file

@ -20,7 +20,7 @@ extern crate grin_api as api;
extern crate grin_chain as chain; extern crate grin_chain as chain;
extern crate grin_config as config; extern crate grin_config as config;
extern crate grin_core as core; extern crate grin_core as core;
extern crate grin_grin as grin; extern crate grin_servers as servers;
extern crate grin_p2p as p2p; extern crate grin_p2p as p2p;
extern crate grin_pow as pow; extern crate grin_pow as pow;
extern crate grin_util as util; extern crate grin_util as util;

View file

@ -18,7 +18,7 @@ use std::net::SocketAddr;
use api; use api;
use p2p; use p2p;
use grin::ServerConfig; use servers::ServerConfig;
pub fn show_status(config: &ServerConfig) { pub fn show_status(config: &ServerConfig) {
println!(); println!();

View file

@ -28,7 +28,7 @@ extern crate time;
extern crate grin_api as api; extern crate grin_api as api;
extern crate grin_config as config; extern crate grin_config as config;
extern crate grin_core as core; extern crate grin_core as core;
extern crate grin_grin as grin; extern crate grin_servers as servers;
extern crate grin_keychain as keychain; extern crate grin_keychain as keychain;
extern crate grin_p2p as p2p; extern crate grin_p2p as p2p;
extern crate grin_util as util; extern crate grin_util as util;
@ -84,7 +84,7 @@ fn log_build_info() {
} }
/// wrap below to allow UI to clean up on stop /// wrap below to allow UI to clean up on stop
fn start_server(config: grin::ServerConfig) { fn start_server(config: servers::ServerConfig) {
start_server_tui(config); start_server_tui(config);
// Just kill process for now, otherwise the process // Just kill process for now, otherwise the process
// hangs around until sigint because the API server // hangs around until sigint because the API server
@ -95,12 +95,12 @@ fn start_server(config: grin::ServerConfig) {
exit(0); exit(0);
} }
fn start_server_tui(config: grin::ServerConfig) { fn start_server_tui(config: servers::ServerConfig) {
// Run the UI controller.. here for now for simplicity to access // Run the UI controller.. here for now for simplicity to access
// everything it might need // everything it might need
if config.run_tui.is_some() && config.run_tui.unwrap() { if config.run_tui.is_some() && config.run_tui.unwrap() {
println!("Starting GRIN in UI mode..."); println!("Starting GRIN in UI mode...");
grin::Server::start(config, |serv: Arc<grin::Server>| { servers::Server::start(config, |serv: Arc<servers::Server>| {
let _ = thread::Builder::new() let _ = thread::Builder::new()
.name("ui".to_string()) .name("ui".to_string())
.spawn(move || { .spawn(move || {
@ -111,7 +111,7 @@ fn start_server_tui(config: grin::ServerConfig) {
}); });
}).unwrap(); }).unwrap();
} else { } else {
grin::Server::start(config, |_| {}).unwrap(); servers::Server::start(config, |_| {}).unwrap();
} }
} }
@ -412,7 +412,7 @@ fn server_command(server_args: Option<&ArgMatches>, mut global_config: GlobalCon
} }
if let Some(seeds) = a.values_of("seed") { if let Some(seeds) = a.values_of("seed") {
server_config.seeding_type = grin::Seeding::List; server_config.seeding_type = servers::Seeding::List;
server_config.seeds = Some(seeds.map(|s| s.to_string()).collect()); server_config.seeds = Some(seeds.map(|s| s.to_string()).collect());
} }
} }

View file

@ -29,7 +29,7 @@ use tui::chrono::prelude::*;
use tui::constants::*; use tui::constants::*;
use tui::types::*; use tui::types::*;
use grin::stats::*; use servers::{ServerStats, DiffBlock};
use tui::pow::cuckoo_miner::CuckooMinerDeviceStats; use tui::pow::cuckoo_miner::CuckooMinerDeviceStats;
use tui::table::{TableView, TableViewItem}; use tui::table::{TableView, TableViewItem};

View file

@ -16,7 +16,7 @@
use std::cmp::Ordering; use std::cmp::Ordering;
use grin::stats::{PeerStats, ServerStats}; use servers::{PeerStats, ServerStats};
use cursive::Cursive; use cursive::Cursive;
use cursive::view::View; use cursive::view::View;

View file

@ -23,7 +23,7 @@ use cursive::traits::*;
use tui::constants::*; use tui::constants::*;
use tui::types::*; use tui::types::*;
use grin::ServerStats; use servers::ServerStats;
pub struct TUIStatusView; pub struct TUIStatusView;

View file

@ -16,7 +16,7 @@
use cursive::Cursive; use cursive::Cursive;
use cursive::view::View; use cursive::view::View;
use grin::stats::ServerStats; use servers::ServerStats;
/// Main message struct to communicate between the UI and /// Main message struct to communicate between the UI and
/// the main process /// the main process

View file

@ -28,7 +28,7 @@ use cursive::views::{LinearLayout, Panel, StackView, TextView, ViewBox};
use cursive::direction::Orientation; use cursive::direction::Orientation;
use cursive::traits::*; use cursive::traits::*;
use grin::Server; use servers::Server;
use tui::{menu, mining, peers, status, version}; use tui::{menu, mining, peers, status, version};
use tui::types::*; use tui::types::*;

View file

@ -23,7 +23,7 @@ use cursive::traits::*;
use tui::constants::*; use tui::constants::*;
use tui::types::*; use tui::types::*;
use grin::ServerStats; use servers::ServerStats;
use info_strings; use info_strings;
pub struct TUIVersionView; pub struct TUIVersionView;