Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage cleanup #9

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Implement `DoubleEndedIterator` for `{Indices,LinearisedIndices,ContiguousIndices,ContiguousLinearisedIndicesIterator}Iterator`
- Add `ParIndicesIterator` and `ParChunksIterator`
- Implement `From<String>` for `DimensionName`
- Add `{Async}ReadableWritableListableStorageTraits` and `{Async}ReadableWritableListableStorage`

### Changed
- Dependency bumps
Expand Down Expand Up @@ -59,7 +60,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed
- **Breaking**: remove `InvalidArraySubsetError` and `ArrayExtractElementsError`
- Remove non-default store lock constructors
- **Breaking**: Remove non-default store lock constructors
- **Breaking**: Remove unused `storage::store::{Readable,Writable,ReadableWritable,Listable}Store`

## [0.11.6] - 2024-02-06

Expand Down
1 change: 1 addition & 0 deletions examples/array_write_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fn array_write_read() -> Result<(), Box<dyn std::error::Error>> {
// let store = Arc::new(store::FilesystemStore::new(
// "tests/data/array_write_read.zarr",
// )?);
// let store: zarrs::storage::ReadableWritableListableStorage = Arc::new(store::MemoryStore::new());
let store = Arc::new(store::MemoryStore::new());

// Create a group
Expand Down
13 changes: 11 additions & 2 deletions src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ pub use self::storage_async::{
async_node_exists_listable, async_retrieve_chunk, async_retrieve_partial_values,
async_store_chunk, async_store_set_partial_values, AsyncListableStorageTraits,
AsyncReadableListableStorageTraits, AsyncReadableStorageTraits,
AsyncReadableWritableStorageTraits, AsyncWritableStorageTraits,
AsyncReadableWritableListableStorageTraits, AsyncReadableWritableStorageTraits,
AsyncWritableStorageTraits,
};

pub use self::storage_sync::{
create_array, create_group, discover_children, discover_nodes, erase_chunk, erase_node,
get_child_nodes, node_exists, node_exists_listable, retrieve_chunk, retrieve_partial_values,
store_chunk, store_set_partial_values, ListableStorageTraits, ReadableListableStorageTraits,
ReadableStorageTraits, ReadableWritableStorageTraits, WritableStorageTraits,
ReadableStorageTraits, ReadableWritableListableStorageTraits, ReadableWritableStorageTraits,
WritableStorageTraits,
};
pub use self::storage_transformer::StorageTransformerChain;

Expand All @@ -68,6 +70,9 @@ pub type WritableStorage = Arc<dyn WritableStorageTraits>;
/// [`Arc`] wrapped readable and writable storage.
pub type ReadableWritableStorage = Arc<dyn ReadableWritableStorageTraits>;

/// [`Arc`] wrapped readable, writable, and listable storage.
pub type ReadableWritableListableStorage = Arc<dyn ReadableWritableListableStorageTraits>;

/// [`Arc`] wrapped listable storage.
pub type ListableStorage = Arc<dyn ListableStorageTraits>;

Expand All @@ -90,6 +95,10 @@ pub type AsyncListableStorage = Arc<dyn AsyncListableStorageTraits>;
/// [`Arc`] wrapped asynchronous readable and listable storage.
pub type AsyncReadableListableStorage = Arc<dyn AsyncReadableListableStorageTraits>;

#[cfg(feature = "async")]
/// [`Arc`] wrapped asynchronous readable, writable and listable storage.
pub type AsyncReadableWritableListableStorage = Arc<dyn AsyncReadableWritableListableStorageTraits>;

/// A [`StoreKey`] and [`ByteRange`].
#[derive(Debug, Clone)]
pub struct StoreKeyRange {
Expand Down
11 changes: 11 additions & 0 deletions src/storage/storage_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,17 @@ impl<T> AsyncReadableListableStorageTraits for T where
{
}

/// A supertrait of [`AsyncReadableWritableStorageTraits`] and [`AsyncListableStorageTraits`].
pub trait AsyncReadableWritableListableStorageTraits:
AsyncReadableWritableStorageTraits + AsyncListableStorageTraits
{
}

impl<T> AsyncReadableWritableListableStorageTraits for T where
T: AsyncReadableWritableStorageTraits + AsyncListableStorageTraits
{
}

/// Asynchronously get the child nodes.
///
/// # Errors
Expand Down
11 changes: 11 additions & 0 deletions src/storage/storage_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,17 @@ pub trait ReadableListableStorageTraits: ReadableStorageTraits + ListableStorage

impl<T> ReadableListableStorageTraits for T where T: ReadableStorageTraits + ListableStorageTraits {}

/// A supertrait of [`ReadableWritableStorageTraits`] and [`ListableStorageTraits`].
pub trait ReadableWritableListableStorageTraits:
ReadableWritableStorageTraits + ListableStorageTraits
{
}

impl<T> ReadableWritableListableStorageTraits for T where
T: ReadableWritableStorageTraits + ListableStorageTraits
{
}

/// Get the child nodes.
///
/// # Errors
Expand Down
14 changes: 0 additions & 14 deletions src/storage/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ pub use store_sync::opendal::OpendalStore;

// pub use store_plugin::{StorePlugin, StorePluginCreateError}; // Currently disabled.

use std::sync::Arc;

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

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

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

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

// /// A readable store plugin.
// pub type ReadableStorePlugin = StorePlugin<ReadableStore>;
// inventory::collect!(ReadableStorePlugin);
Expand Down
Loading