Pre: Move tolstoy/errors into tolstoy-traits

This commit is contained in:
Grisha Kruglov 2018-08-08 14:33:53 -07:00
parent 2c8f197a3f
commit 99301398a3
14 changed files with 72 additions and 19 deletions

View file

@ -19,7 +19,7 @@ build = "build/version.rs"
default = ["bundled_sqlite3", "syncable"]
bundled_sqlite3 = ["rusqlite/bundled"]
sqlcipher = ["rusqlite/sqlcipher", "mentat_db/sqlcipher"]
syncable = ["mentat_tolstoy", "mentat_db/syncable"]
syncable = ["mentat_tolstoy", "tolstoy_traits", "mentat_db/syncable"]
[workspace]
members = ["tools/cli", "ffi"]
@ -86,6 +86,10 @@ path = "sql-traits"
path = "tolstoy"
optional = true
[dependencies.tolstoy_traits]
path = "tolstoy-traits"
optional = true
[profile.release]
opt-level = 3
debug = false

View file

@ -38,7 +38,9 @@ use sql_traits::errors::{
};
#[cfg(feature = "syncable")]
use mentat_tolstoy;
use tolstoy_traits::errors::{
TolstoyError,
};
pub type Result<T> = std::result::Result<T, MentatError>;
@ -118,7 +120,7 @@ pub enum MentatError {
#[cfg(feature = "syncable")]
#[fail(display = "{}", _0)]
TolstoyError(#[cause] mentat_tolstoy::TolstoyError),
TolstoyError(#[cause] TolstoyError),
}
impl From<std::io::Error> for MentatError {
@ -170,8 +172,8 @@ impl From<SQLError> for MentatError {
}
#[cfg(feature = "syncable")]
impl From<mentat_tolstoy::TolstoyError> for MentatError {
fn from(error: mentat_tolstoy::TolstoyError) -> MentatError {
impl From<TolstoyError> for MentatError {
fn from(error: TolstoyError) -> MentatError {
MentatError::TolstoyError(error)
}
}

View file

@ -38,6 +38,9 @@ extern crate mentat_sql;
#[cfg(feature = "syncable")]
extern crate mentat_tolstoy;
#[cfg(feature = "syncable")]
extern crate tolstoy_traits;
pub use core_traits::{
Attribute,
Binding,

View file

@ -14,6 +14,9 @@ extern crate core_traits;
#[cfg(feature = "syncable")]
extern crate mentat_tolstoy;
#[cfg(feature = "syncable")]
extern crate tolstoy_traits;
#[cfg(feature = "syncable")]
mod tests {
use std::collections::BTreeMap;
@ -26,7 +29,7 @@ mod tests {
TxReceiver,
TxPart,
};
use mentat_tolstoy::errors::Result;
use tolstoy_traits::errors::Result;
use core_traits::{
Entid,
TypedValue,

22
tolstoy-traits/Cargo.toml Normal file
View file

@ -0,0 +1,22 @@
[package]
name = "tolstoy_traits"
version = "0.0.1"
workspace = ".."
[lib]
name = "tolstoy_traits"
path = "lib.rs"
[dependencies]
failure = "0.1.1"
failure_derive = "0.1.1"
hyper = "0.11"
serde_json = "1.0"
uuid = { version = "0.5" }
[dependencies.db_traits]
path = "../db-traits"
[dependencies.rusqlite]
version = "0.13"
features = ["limits"]

22
tolstoy-traits/lib.rs Normal file
View file

@ -0,0 +1,22 @@
// Copyright 2018 Mozilla
//
// 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.
extern crate failure;
#[macro_use]
extern crate failure_derive;
extern crate hyper;
extern crate rusqlite;
extern crate uuid;
extern crate serde_json;
extern crate db_traits;
pub mod errors;

View file

@ -6,7 +6,6 @@ authors = ["Grisha Kruglov <gkruglov@mozilla.com>"]
[dependencies]
failure = "0.1.1"
failure_derive = "0.1.1"
futures = "0.1"
hyper = "0.11"
log = "0.4"
@ -33,6 +32,9 @@ path = "../db"
[dependencies.db_traits]
path = "../db-traits"
[dependencies.tolstoy_traits]
path = "../tolstoy-traits"
[dependencies.rusqlite]
version = "0.13"
features = ["limits"]

View file

@ -9,8 +9,6 @@
// specific language governing permissions and limitations under the License.
extern crate failure;
#[macro_use]
extern crate failure_derive;
#[macro_use]
extern crate lazy_static;
@ -40,14 +38,11 @@ extern crate rusqlite;
extern crate uuid;
#[macro_use]
pub mod errors;
extern crate tolstoy_traits;
pub mod schema;
pub mod metadata;
pub mod tx_processor;
pub mod syncer;
pub mod tx_mapper;
pub use syncer::Syncer;
pub use errors::{
TolstoyError,
Result,
};

View file

@ -14,7 +14,7 @@ use rusqlite;
use uuid::Uuid;
use schema;
use errors::{
use tolstoy_traits::errors::{
TolstoyError,
Result,
};

View file

@ -9,7 +9,7 @@
// specific language governing permissions and limitations under the License.
use rusqlite;
use errors::Result;
use tolstoy_traits::errors::Result;
pub static REMOTE_HEAD_KEY: &str = r#"remote_head"#;

View file

@ -33,7 +33,7 @@ use metadata::SyncMetadataClient;
use metadata::HeadTrackable;
use schema::ensure_current_version;
use errors::{
use tolstoy_traits::errors::{
TolstoyError,
Result,
};

View file

@ -16,7 +16,7 @@ use core_traits::{
Entid,
};
use errors::{
use tolstoy_traits::errors::{
TolstoyError,
Result,
};

View file

@ -11,7 +11,7 @@ use std::iter::Peekable;
use rusqlite;
use errors::{
use tolstoy_traits::errors::{
Result,
};