diff --git a/lib/src/sparql/dataset.rs b/lib/src/sparql/dataset.rs index 64f8ae94..5558698c 100644 --- a/lib/src/sparql/dataset.rs +++ b/lib/src/sparql/dataset.rs @@ -1,7 +1,7 @@ use crate::sparql::algebra::DatasetSpec; use crate::sparql::EvaluationError; use crate::store::numeric_encoder::{ - EncodedQuad, EncodedTerm, ReadEncoder, StrContainer, StrId, StrLookup, WithStoreError, + EncodedQuad, EncodedTerm, ReadEncoder, StrContainer, StrEncodingAware, StrId, StrLookup, }; use crate::store::ReadableEncodedStore; use lasso::{Rodeo, Spur}; @@ -48,7 +48,7 @@ impl DatasetView { } } -impl WithStoreError for DatasetView { +impl StrEncodingAware for DatasetView { type Error = EvaluationError; type StrId = DatasetStrId; } diff --git a/lib/src/sparql/mod.rs b/lib/src/sparql/mod.rs index 39f71688..df7e9a61 100644 --- a/lib/src/sparql/mod.rs +++ b/lib/src/sparql/mod.rs @@ -33,7 +33,7 @@ pub use crate::sparql::error::EvaluationError; pub use crate::sparql::model::Variable; pub use crate::sparql::parser::ParseError; pub use crate::sparql::parser::Query; -use crate::store::numeric_encoder::WithStoreError; +use crate::store::numeric_encoder::StrEncodingAware; use std::error::Error; /// A prepared [SPARQL query](https://www.w3.org/TR/sparql11-query/) @@ -50,21 +50,21 @@ pub(crate) struct SimplePreparedQuery( #[derive(Clone)] enum SimplePreparedQueryAction { Select { - plan: Rc as WithStoreError>::StrId>>, + plan: Rc as StrEncodingAware>::StrId>>, variables: Rc>, evaluator: SimpleEvaluator>, }, Ask { - plan: Rc as WithStoreError>::StrId>>, + plan: Rc as StrEncodingAware>::StrId>>, evaluator: SimpleEvaluator>, }, Construct { - plan: Rc as WithStoreError>::StrId>>, - construct: Rc as WithStoreError>::StrId>>>, + plan: Rc as StrEncodingAware>::StrId>>, + construct: Rc as StrEncodingAware>::StrId>>>, evaluator: SimpleEvaluator>, }, Describe { - plan: Rc as WithStoreError>::StrId>>, + plan: Rc as StrEncodingAware>::StrId>>, evaluator: SimpleEvaluator>, }, } diff --git a/lib/src/store/binary_encoder.rs b/lib/src/store/binary_encoder.rs index b818e343..d519193a 100644 --- a/lib/src/store/binary_encoder.rs +++ b/lib/src/store/binary_encoder.rs @@ -673,7 +673,7 @@ mod test { } } - impl WithStoreError for MemoryStrStore { + impl StrEncodingAware for MemoryStrStore { type Error = Infallible; type StrId = StrHash; } diff --git a/lib/src/store/memory.rs b/lib/src/store/memory.rs index bac6564b..300eca2a 100644 --- a/lib/src/store/memory.rs +++ b/lib/src/store/memory.rs @@ -5,7 +5,7 @@ use crate::io::{DatasetFormat, DatasetParser, GraphFormat, GraphParser}; use crate::model::*; use crate::sparql::{EvaluationError, Query, QueryOptions, QueryResult, SimplePreparedQuery}; use crate::store::numeric_encoder::{ - Decoder, ReadEncoder, StrContainer, StrId, StrLookup, WithStoreError, WriteEncoder, + Decoder, ReadEncoder, StrContainer, StrEncodingAware, StrId, StrLookup, WriteEncoder, }; use crate::store::{ dump_dataset, dump_graph, get_encoded_quad_pattern, load_dataset, load_graph, @@ -803,7 +803,7 @@ impl MemoryStore { } } -impl WithStoreError for MemoryStore { +impl StrEncodingAware for MemoryStore { type Error = Infallible; type StrId = LargeSpur; } @@ -853,7 +853,7 @@ impl<'a> WritableEncodedStore for &'a MemoryStore { } } -impl WithStoreError for MemoryStoreIndexes { +impl StrEncodingAware for MemoryStoreIndexes { type Error = Infallible; type StrId = LargeSpur; } diff --git a/lib/src/store/mod.rs b/lib/src/store/mod.rs index 480a3174..6fdb3c4b 100644 --- a/lib/src/store/mod.rs +++ b/lib/src/store/mod.rs @@ -46,7 +46,7 @@ pub(crate) trait ReadableEncodedStore: StrLookup { ) -> Self::QuadsIter; } -pub(crate) trait WritableEncodedStore: WithStoreError { +pub(crate) trait WritableEncodedStore: StrEncodingAware { fn insert_encoded(&mut self, quad: &EncodedQuad) -> Result<(), Self::Error>; fn remove_encoded(&mut self, quad: &EncodedQuad) -> Result<(), Self::Error>; diff --git a/lib/src/store/numeric_encoder.rs b/lib/src/store/numeric_encoder.rs index a9c55671..1a12e5ab 100644 --- a/lib/src/store/numeric_encoder.rs +++ b/lib/src/store/numeric_encoder.rs @@ -554,29 +554,29 @@ impl EncodedQuad { } } -pub(crate) trait WithStoreError { +pub(crate) trait StrEncodingAware { //TODO: rename type Error: Error + Into + 'static; type StrId: StrId + 'static; } -impl<'a, T: WithStoreError> WithStoreError for &'a T { +impl<'a, T: StrEncodingAware> StrEncodingAware for &'a T { type Error = T::Error; type StrId = T::StrId; } -pub(crate) trait StrLookup: WithStoreError { +pub(crate) trait StrLookup: StrEncodingAware { fn get_str(&self, id: Self::StrId) -> Result, Self::Error>; fn get_str_id(&self, value: &str) -> Result, Self::Error>; } -pub(crate) trait StrContainer: WithStoreError { +pub(crate) trait StrContainer: StrEncodingAware { fn insert_str(&mut self, value: &str) -> Result; } /// Tries to encode a term based on the existing strings (does not insert anything) -pub(crate) trait ReadEncoder: WithStoreError { +pub(crate) trait ReadEncoder: StrEncodingAware { fn get_encoded_named_node( &self, named_node: NamedNodeRef<'_>, @@ -819,7 +819,7 @@ impl ReadEncoder for S { } /// Encodes a term and insert strings if needed -pub(crate) trait WriteEncoder: WithStoreError { +pub(crate) trait WriteEncoder: StrEncodingAware { fn encode_named_node( &mut self, named_node: NamedNodeRef<'_>, diff --git a/lib/src/store/rocksdb.rs b/lib/src/store/rocksdb.rs index 76b7e231..b1e1f350 100644 --- a/lib/src/store/rocksdb.rs +++ b/lib/src/store/rocksdb.rs @@ -6,7 +6,7 @@ use crate::model::*; use crate::sparql::{EvaluationError, Query, QueryOptions, QueryResult, SimplePreparedQuery}; use crate::store::binary_encoder::*; use crate::store::numeric_encoder::{ - Decoder, ReadEncoder, StrContainer, StrLookup, WithStoreError, WriteEncoder, + Decoder, ReadEncoder, StrContainer, StrEncodingAware, StrLookup, WriteEncoder, }; use crate::store::{ dump_dataset, dump_graph, get_encoded_quad_pattern, load_dataset, load_graph, @@ -624,7 +624,7 @@ impl fmt::Display for RocksDbStore { } } -impl WithStoreError for RocksDbStore { +impl StrEncodingAware for RocksDbStore { type Error = io::Error; type StrId = StrHash; } @@ -756,7 +756,7 @@ impl AutoBatchWriter<'_> { } } -impl WithStoreError for AutoBatchWriter<'_> { +impl StrEncodingAware for AutoBatchWriter<'_> { type Error = io::Error; type StrId = StrHash; } @@ -935,7 +935,7 @@ impl RocksDbTransaction<'_> { } } -impl WithStoreError for RocksDbTransaction<'_> { +impl StrEncodingAware for RocksDbTransaction<'_> { type Error = io::Error; type StrId = StrHash; } diff --git a/lib/src/store/sled.rs b/lib/src/store/sled.rs index f010e935..1d98c535 100644 --- a/lib/src/store/sled.rs +++ b/lib/src/store/sled.rs @@ -6,7 +6,7 @@ use crate::model::*; use crate::sparql::{EvaluationError, Query, QueryOptions, QueryResult, SimplePreparedQuery}; use crate::store::binary_encoder::*; use crate::store::numeric_encoder::{ - Decoder, ReadEncoder, StrContainer, StrLookup, WithStoreError, WriteEncoder, + Decoder, ReadEncoder, StrContainer, StrEncodingAware, StrLookup, WriteEncoder, }; use crate::store::{ dump_dataset, dump_graph, get_encoded_quad_pattern, load_dataset, load_graph, @@ -597,7 +597,7 @@ impl fmt::Display for SledStore { } } -impl WithStoreError for SledStore { +impl StrEncodingAware for SledStore { type Error = io::Error; type StrId = StrHash; } @@ -876,7 +876,7 @@ impl SledTransaction<'_> { } } -impl<'a> WithStoreError for &'a SledTransaction<'a> { +impl<'a> StrEncodingAware for &'a SledTransaction<'a> { type Error = SledUnabortableTransactionError; type StrId = StrHash; }