From 87f850a44edb6b25480aadac619cfb66c2ebe70c Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Mon, 2 Jul 2018 09:22:27 -0700 Subject: [PATCH] Part 1: Move `intern_set` into `edn` crate. It's not great to keep lifting functionality higher and higher up the crate hierarchy, but we really do want to intern while we parse. Eventually, I expect that we will split the `edn` crate into `types` and `parsing`, and the `types` crate can depend on a more efficient interning dependency. --- core/src/lib.rs | 1 - db/src/db.rs | 15 ++++++++------- db/src/tx.rs | 3 +-- {core => edn}/src/intern_set.rs | 2 +- edn/src/lib.rs | 4 ++++ src/conn.rs | 5 +++-- src/entity_builder.rs | 14 ++++++++------ 7 files changed, 25 insertions(+), 19 deletions(-) rename {core => edn}/src/intern_set.rs (97%) diff --git a/core/src/lib.rs b/core/src/lib.rs index af9c71fe..4282a0b6 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -365,7 +365,6 @@ impl HasSchema for Schema { } } -pub mod intern_set; pub mod counter; pub mod util; diff --git a/db/src/db.rs b/db/src/db.rs index 327ef4ce..c8dd0fa5 100644 --- a/db/src/db.rs +++ b/db/src/db.rs @@ -1119,20 +1119,21 @@ mod tests { use debug; use errors; use edn; + use edn::{ + InternSet, + }; + use edn::entities::{ + OpType, + TempId, + }; + use mentat_core::{ HasSchema, Keyword, KnownEntid, attribute, }; - use mentat_core::intern_set::{ - InternSet, - }; use mentat_core::util::Either::*; - use edn::entities::{ - OpType, - TempId, - }; use rusqlite; use std::collections::{ BTreeMap, diff --git a/db/src/tx.rs b/db/src/tx.rs index dc777c34..c4ce8321 100644 --- a/db/src/tx.rs +++ b/db/src/tx.rs @@ -66,6 +66,7 @@ use db::{ PartitionMapping, }; use edn::{ + InternSet, Keyword, }; use entids; @@ -101,8 +102,6 @@ use mentat_core::{ now, }; -use mentat_core::intern_set::InternSet; - use edn::entities as entmod; use edn::entities::{ AttributePlace, diff --git a/core/src/intern_set.rs b/edn/src/intern_set.rs similarity index 97% rename from core/src/intern_set.rs rename to edn/src/intern_set.rs index 524cebf9..c8c7418f 100644 --- a/core/src/intern_set.rs +++ b/edn/src/intern_set.rs @@ -41,7 +41,7 @@ impl InternSet where T: Eq + Hash { /// /// ``` /// use std::rc::Rc; - /// use mentat_core::intern_set::InternSet; + /// use edn::intern_set::InternSet; /// /// let mut s = InternSet::new(); /// diff --git a/edn/src/lib.rs b/edn/src/lib.rs index a2a1dbcc..f9c57c94 100644 --- a/edn/src/lib.rs +++ b/edn/src/lib.rs @@ -23,6 +23,10 @@ extern crate serde; extern crate serde_derive; pub mod entities; +pub mod intern_set; +pub use intern_set::{ + InternSet, +}; // Intentionally not pub. mod namespaceable_name; pub mod query; diff --git a/src/conn.rs b/src/conn.rs index 9e5ca8d6..9f9e3ddd 100644 --- a/src/conn.rs +++ b/src/conn.rs @@ -41,6 +41,9 @@ use rusqlite::{ }; use edn; +use edn::{ + InternSet, +}; use mentat_core::{ Attribute, @@ -55,8 +58,6 @@ use mentat_core::{ ValueType, }; -use mentat_core::intern_set::InternSet; - use mentat_db::cache::{ InProgressCacheTransactWatcher, InProgressSQLiteAttributeCache, diff --git a/src/entity_builder.rs b/src/entity_builder.rs index c273b8ca..fe2e52ed 100644 --- a/src/entity_builder.rs +++ b/src/entity_builder.rs @@ -53,6 +53,14 @@ // We probably need both, but this file provides the latter. Unfortunately, Entity -- the input to // the transactor -- is intimately tied to EDN and to spanned values. +use edn::{ + InternSet, +}; +use edn::entities::{ + OpType, + TempId, +}; + use mentat_core::{ HasSchema, KnownEntid, @@ -60,7 +68,6 @@ use mentat_core::{ TypedValue, }; -use mentat_core::intern_set::InternSet; use mentat_core::util::Either; use mentat_db::{ @@ -75,11 +82,6 @@ use mentat_db::internal_types::{ TypedValueOr, }; -use edn::entities::{ - OpType, - TempId, -}; - use conn::{ InProgress, };