Add 'syncable' feature to 'db' crate to conditionally derive serialization for Partition*

This is leading up syncing with partition support.
This commit is contained in:
Grisha Kruglov 2018-06-27 19:59:19 -04:00
parent 26446ddb05
commit 687b2cf997
4 changed files with 9 additions and 1 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"]
syncable = ["mentat_tolstoy", "mentat_db/syncable"]
[workspace]
members = ["tools/cli", "ffi"]

View file

@ -6,6 +6,7 @@ workspace = ".."
[features]
default = []
sqlcipher = ["rusqlite/sqlcipher"]
syncable = ["serde", "serde_json", "serde_derive"]
[dependencies]
failure = "0.1.1"
@ -17,6 +18,9 @@ log = "0.4"
ordered-float = "0.5"
time = "0.1"
petgraph = "0.4.12"
serde = { version = "1.0", optional = true }
serde_json = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
[dependencies.rusqlite]
version = "0.13"

View file

@ -15,6 +15,9 @@ extern crate itertools;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
#[cfg(feature = "syncable")]
#[macro_use] extern crate serde_derive;
extern crate petgraph;
extern crate rusqlite;
extern crate tabwriter;

View file

@ -38,6 +38,7 @@ use errors;
/// Represents one partition of the entid space.
#[derive(Clone,Debug,Eq,Hash,Ord,PartialOrd,PartialEq)]
#[cfg_attr(feature = "syncable", derive(Serialize,Deserialize))]
pub struct Partition {
/// The first entid in the partition.
pub start: i64,