Skip to content
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
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ members = [
"crates/infra/curvine-io",
"crates/adapters/curvine-rocksdb",
"crates/metadata/curvine-raft",
"crates/adapters/curvine-storage-local",
"crates/adapters/curvine-storage-spdk",
"crates/adapters/curvine-ufs-opendal",
"crates/adapters/curvine-ufs-oss-hdfs",
Expand Down Expand Up @@ -70,6 +71,7 @@ default-members = [
"crates/infra/curvine-sys",
"crates/infra/curvine-io",
"crates/metadata/curvine-raft",
"crates/adapters/curvine-storage-local",
"curvine-common",
"curvine-server",
"crates/client/curvine-client-core",
Expand Down Expand Up @@ -101,6 +103,7 @@ curvine-sys = { path = "crates/infra/curvine-sys" }
curvine-io = { path = "crates/infra/curvine-io" }
curvine-rocksdb = { path = "crates/adapters/curvine-rocksdb" }
curvine-raft = { path = "crates/metadata/curvine-raft" }
curvine-storage-local = { path = "crates/adapters/curvine-storage-local" }
curvine-storage-spdk = { path = "crates/adapters/curvine-storage-spdk" }
curvine-ufs-opendal = { path = "crates/adapters/curvine-ufs-opendal" }
curvine-ufs-oss-hdfs = { path = "crates/adapters/curvine-ufs-oss-hdfs" }
Expand Down
22 changes: 22 additions & 0 deletions crates/adapters/curvine-storage-local/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "curvine-storage-local"
version.workspace = true
edition.workspace = true
license.workspace = true
description = "Curvine local worker storage adapter."

[features]
default = []
spdk = ["dep:curvine-storage-spdk", "curvine-storage-spdk/spdk"]
spdk-rdma = ["spdk", "curvine-storage-spdk/spdk-rdma"]

[dependencies]
orpc = { workspace = true }
curvine-common = { workspace = true }
curvine-rocksdb = { workspace = true }
curvine-storage-spdk = { workspace = true, optional = true }
bytes = { workspace = true }
serde = { workspace = true }
log = { workspace = true }
indexmap = { workspace = true }
byteorder = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::worker::storage::VfsDir;
use crate::VfsDir;
use curvine_common::state::{ExtendedBlock, StorageType};
use orpc::common::FileUtils;
use orpc::{err_box, sys, CommonResult};
Expand Down Expand Up @@ -51,14 +51,14 @@ impl BlockState {
/// 3. Worker restarts the loading block, len is the file length.
#[derive(Debug, Clone)]
pub struct BlockMeta {
pub(crate) id: i64,
pub(crate) len: i64,
pub(crate) state: BlockState,
pub(crate) dir_id: u32,
pub(crate) storage_type: StorageType,
pub(crate) actual_len: i64,
pub id: i64,
pub len: i64,
pub state: BlockState,
pub dir_id: u32,
pub storage_type: StorageType,
pub actual_len: i64,
/// SPDK bdev byte offset
pub(crate) bdev_offset: i64,
pub bdev_offset: i64,
}

impl BlockMeta {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::worker::block::BlockMeta;
use crate::BlockMeta;
use curvine_common::state::ExtendedBlock;
use orpc::common::ByteUnit;
use orpc::{err_box, CommonResult};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::worker::storage::{ChoosingPolicy, RobinChoosingPolicy, VfsDir};
use crate::{ChoosingPolicy, RobinChoosingPolicy, VfsDir};
use curvine_common::state::{StorageInfo, StorageType};
use indexmap::map::Values;
use indexmap::IndexMap;
Expand Down Expand Up @@ -266,7 +266,7 @@ impl Index<usize> for DirList {

#[cfg(test)]
mod tests {
use crate::worker::storage::{DirList, StorageRequest, VfsDir};
use crate::{DirList, StorageRequest, VfsDir};
use curvine_common::conf::WorkerDataDir;
use curvine_common::state::StorageType;
use orpc::common::{ByteUnit, FileUtils};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::worker::block::{BlockMeta, BlockState};
use crate::worker::storage::layout::{validate_open_offset, BlockLayout};
use crate::worker::storage::{BlockReadContext, BlockWriteContext, SpdkMetaStore, VfsDir};
use crate::layout::{validate_open_offset, BlockLayout};
use crate::{BlockMeta, BlockState};
use crate::{BlockReadContext, BlockWriteContext, SpdkMetaStore, VfsDir};
use curvine_common::state::ExtendedBlock;
use log::{info, warn};
use orpc::io::IOResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::worker::block::{BlockMeta, BlockState};
use crate::worker::storage::layout::{validate_open_offset, BlockLayout};
use crate::worker::storage::{BlockReadContext, BlockWriteContext, VfsDir};
use crate::layout::{validate_open_offset, BlockLayout};
use crate::{BlockMeta, BlockState};
use crate::{BlockReadContext, BlockWriteContext, VfsDir};
use curvine_common::state::ExtendedBlock;
#[cfg(test)]
use orpc::common::ByteUnit;
Expand All @@ -31,7 +31,7 @@ pub struct FileLayout;
const ACTIVE_DIR: &str = "active";
const STAGING_DIR: &str = "staging";

pub(crate) struct FileFinalizePlan {
pub struct FileFinalizePlan {
final_meta: BlockMeta,
staging_path: PathBuf,
active_path: PathBuf,
Expand Down Expand Up @@ -84,7 +84,7 @@ impl FileLayout {
Ok(path)
}

pub(crate) fn block_path(dir: &VfsDir, meta: &BlockMeta) -> CommonResult<PathBuf> {
pub fn block_path(dir: &VfsDir, meta: &BlockMeta) -> CommonResult<PathBuf> {
Ok(Self::block_dir(dir, meta)?.join(meta.state().get_name(meta.id())))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pub use self::bdev_layout::BdevLayout;
pub(crate) use self::file_layout::FileFinalizePlan;
pub use self::file_layout::FileLayout;

use crate::worker::block::BlockMeta;
use crate::worker::storage::{BlockReadContext, BlockWriteContext, SpdkMetaStore, VfsDir};
use crate::BlockMeta;
use crate::{BlockReadContext, BlockWriteContext, SpdkMetaStore, VfsDir};
use curvine_common::state::{ExtendedBlock, StorageType};
use orpc::io::IOResult;
use orpc::{err_box, CommonResult};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

mod block_meta;
pub use self::block_meta::{BlockMeta, BlockState};

mod vfs_dir;
pub use self::vfs_dir::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::worker::block::BlockMeta;
use crate::BlockMeta;
use std::collections::HashMap;

#[derive(Default)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod vfs_meta_store;
pub use self::mem_meta_store::MemMetaStore;
pub use self::vfs_meta_store::VfsMetaStore;

use crate::worker::block::BlockMeta;
use crate::BlockMeta;
use orpc::CommonResult;

/// Persistent side-car store for block metadata records.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::worker::block::BlockMeta;
use crate::worker::storage::meta_store::{BlockMetaStore, MemMetaStore};
use crate::worker::storage::SpdkMetaStore;
use crate::meta_store::{BlockMetaStore, MemMetaStore};
use crate::BlockMeta;
use crate::SpdkMetaStore;
use curvine_common::state::StorageType;
use log::warn;
use std::sync::Arc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::worker::storage::VfsDir;
use crate::VfsDir;
use curvine_common::state::StorageType;
use indexmap::IndexMap;
use orpc::{err_box, CommonResult};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! RocksDB-backed SPDK block metadata.
use crate::worker::block::BlockMeta;
use crate::worker::storage::meta_store::BlockMetaStore;
use crate::meta_store::BlockMetaStore;
use crate::BlockMeta;
/// Key: block_id (8B). Value: dir_id(4B) | offset(8B) | size(8B) | len(8B) | finalized(1B) = 29B.
/// O(1) per block
use byteorder::{BigEndian, ByteOrder};
Expand Down
Loading
Loading