Skip to content

Commit

Permalink
Remove StoreExtension traits
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Oct 22, 2023
1 parent 9a97141 commit 39282e4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 54 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed
- **Breaking**: Disabled data type extensions `array::data_type::DataType::Extension`.
- **Breaking**: Remove `StoreExtension` traits

## [0.5.1] - 2023-10-10

Expand Down
32 changes: 9 additions & 23 deletions src/storage/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@ pub use http::{HTTPStore, HTTPStoreCreateError};

use std::sync::Arc;

use super::{ListableStorageTraits, ReadableStorageTraits, WritableStorageTraits};

/// An [`Arc`] wrapped readable store.
pub type ReadableStore = Arc<dyn ReadableStoreExtension>;
pub type ReadableStore = Arc<dyn super::ReadableStorageTraits>;

/// An [`Arc`] wrapped writable store.
pub type WritableStore = Arc<dyn WritableStoreExtension>;
pub type WritableStore = Arc<dyn super::WritableStorageTraits>;

/// An [`Arc`] wrapped listable store.
pub type ListableStore = Arc<dyn ListableStoreExtension>;
pub type ListableStore = Arc<dyn super::ListableStorageTraits>;

/// An [`Arc`] wrapped readable and writable store.
pub type ReadableWritableStore = Arc<dyn ReadableWritableStoreExtension>;
pub type ReadableWritableStore = Arc<dyn super::ReadableWritableStorageTraits>;

// /// A readable store plugin.
// pub type ReadableStorePlugin = StorePlugin<ReadableStore>;
Expand All @@ -54,23 +52,11 @@ pub type ReadableWritableStore = Arc<dyn ReadableWritableStoreExtension>;
// pub type ReadableWritableStorePlugin = StorePlugin<ReadableWritableStore>;
// inventory::collect!(ReadableWritableStorePlugin);

/// Traits for a store extension.
pub trait StoreExtension: Send + Sync {
// /// The URI scheme of the store, if it has one.
// fn uri_scheme(&self) -> Option<&'static str>;
}

/// A readable store extension.
pub trait ReadableStoreExtension: StoreExtension + ReadableStorageTraits {}

/// A writable store extension.
pub trait WritableStoreExtension: StoreExtension + WritableStorageTraits {}

/// A listable store extension.
pub trait ListableStoreExtension: StoreExtension + ListableStorageTraits {}

/// A readable and writable store extension.
pub trait ReadableWritableStoreExtension: ReadableStoreExtension + WritableStoreExtension {}
// /// Traits for a store extension.
// pub trait StoreExtension: Send + Sync {
// // /// The URI scheme of the store, if it has one.
// // fn uri_scheme(&self) -> Option<&'static str>;
// }

// /// Get a readable store from a Uniform Resource Identifier (URI).
// ///
Expand Down
18 changes: 2 additions & 16 deletions src/storage/store/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ use crate::{
storage::{
ListableStorageTraits, ReadableListableStorageTraits, ReadableStorageTraits,
ReadableWritableStorageTraits, StorageError, StoreKeyRange, StoreKeyStartValue,
StoreKeysPrefixes,
StoreKeysPrefixes, WritableStorageTraits,
},
};

use super::{
ListableStoreExtension, ReadableStoreExtension, ReadableWritableStoreExtension, StoreExtension,
StoreKey, StoreKeyError, StoreKeys, StorePrefix, StorePrefixes, WritableStorageTraits,
WritableStoreExtension,
};
use super::{StoreKey, StoreKeyError, StoreKeys, StorePrefix, StorePrefixes};

use parking_lot::RwLock;
use thiserror::Error;
Expand Down Expand Up @@ -62,16 +58,6 @@ pub struct FilesystemStore {
files: Mutex<HashMap<StoreKey, Arc<RwLock<()>>>>,
}

impl ReadableStoreExtension for FilesystemStore {}

impl WritableStoreExtension for FilesystemStore {}

impl ListableStoreExtension for FilesystemStore {}

impl ReadableWritableStoreExtension for FilesystemStore {}

impl StoreExtension for FilesystemStore {}

impl FilesystemStore {
/// Create a new file system store at a given `base_path`.
///
Expand Down
6 changes: 1 addition & 5 deletions src/storage/store/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
storage::{ReadableStorageTraits, StorageError, StoreKeyRange},
};

use super::{ReadableStoreExtension, StoreExtension, StoreKey};
use super::StoreKey;

use itertools::Itertools;
use reqwest::{
Expand All @@ -23,10 +23,6 @@ pub struct HTTPStore {
batch_range_requests: bool,
}

impl ReadableStoreExtension for HTTPStore {}

impl StoreExtension for HTTPStore {}

impl From<reqwest::Error> for StorageError {
fn from(err: reqwest::Error) -> Self {
Self::Other(err.to_string())
Expand Down
11 changes: 1 addition & 10 deletions src/storage/store/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ use std::{
sync::Arc,
};

use super::{
ReadableStoreExtension, StoreExtension, StoreKey, StoreKeys, StorePrefix,
WritableStoreExtension,
};
use super::{StoreKey, StoreKeys, StorePrefix};

/// An in-memory store.
#[derive(Debug)]
Expand All @@ -45,12 +42,6 @@ impl Default for MemoryStore {
}
}

impl StoreExtension for MemoryStore {}

impl ReadableStoreExtension for MemoryStore {}

impl WritableStoreExtension for MemoryStore {}

impl MemoryStore {
fn set_impl(&self, key: &StoreKey, value: &[u8], offset: Option<ByteOffset>, _truncate: bool) {
let mut data_map = self.data_map.lock().unwrap();
Expand Down

0 comments on commit 39282e4

Please sign in to comment.