diff --git a/src/meta/binaries/metactl/import.rs b/src/meta/binaries/metactl/import.rs index 6f3178ee73de..c8a552b8cbaa 100644 --- a/src/meta/binaries/metactl/import.rs +++ b/src/meta/binaries/metactl/import.rs @@ -38,18 +38,18 @@ use databend_common_meta_sled_store::get_sled_db; use databend_common_meta_sled_store::init_sled_db; use databend_common_meta_sled_store::openraft::storage::RaftLogStorageExt; use databend_common_meta_sled_store::openraft::RaftSnapshotBuilder; +use databend_common_meta_types::raft_types::CommittedLeaderId; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::Membership; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::StoredMembership; use databend_common_meta_types::sys_data::SysData; use databend_common_meta_types::Cmd; -use databend_common_meta_types::CommittedLeaderId; use databend_common_meta_types::Endpoint; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::LogEntry; -use databend_common_meta_types::LogId; -use databend_common_meta_types::Membership; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::StoredMembership; use databend_meta::store::RaftStore; use url::Url; diff --git a/src/meta/process/src/kv_processor.rs b/src/meta/process/src/kv_processor.rs index 47e7c2e80b90..c86fb75934d5 100644 --- a/src/meta/process/src/kv_processor.rs +++ b/src/meta/process/src/kv_processor.rs @@ -14,11 +14,11 @@ use anyhow::Error; use databend_common_meta_raft_store::key_spaces::RaftStoreEntry; +use databend_common_meta_types::raft_types::Entry; use databend_common_meta_types::seq_value::SeqV; use databend_common_meta_types::txn_condition::Target; use databend_common_meta_types::txn_op::Request; use databend_common_meta_types::Cmd; -use databend_common_meta_types::Entry; use databend_common_meta_types::LogEntry; use databend_common_meta_types::Operation; use databend_common_meta_types::TxnCondition; diff --git a/src/meta/raft-store/src/applier.rs b/src/meta/raft-store/src/applier.rs index 5a985d99115b..be70fd45f460 100644 --- a/src/meta/raft-store/src/applier.rs +++ b/src/meta/raft-store/src/applier.rs @@ -17,6 +17,9 @@ use std::time::Duration; use databend_common_base::display::display_unix_epoch::DisplayUnixTimeStampExt; use databend_common_meta_types::protobuf as pb; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; +use databend_common_meta_types::raft_types::StoredMembership; use databend_common_meta_types::seq_value::SeqV; use databend_common_meta_types::seq_value::SeqValue; use databend_common_meta_types::txn_condition; @@ -27,13 +30,10 @@ use databend_common_meta_types::Change; use databend_common_meta_types::Cmd; use databend_common_meta_types::CmdContext; use databend_common_meta_types::ConditionResult; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::Interval; use databend_common_meta_types::MatchSeq; use databend_common_meta_types::MetaSpec; use databend_common_meta_types::Node; -use databend_common_meta_types::StoredMembership; use databend_common_meta_types::TxnCondition; use databend_common_meta_types::TxnDeleteByPrefixRequest; use databend_common_meta_types::TxnDeleteByPrefixResponse; diff --git a/src/meta/raft-store/src/config.rs b/src/meta/raft-store/src/config.rs index 9c4f383cfa46..24a7ef8dfe14 100644 --- a/src/meta/raft-store/src/config.rs +++ b/src/meta/raft-store/src/config.rs @@ -17,9 +17,9 @@ use std::sync::LazyLock; use databend_common_exception::Result; use databend_common_grpc::DNSResolver; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::Endpoint; use databend_common_meta_types::MetaStartupError; -use databend_common_meta_types::NodeId; pub static DATABEND_COMMIT_VERSION: LazyLock = LazyLock::new(|| { let build_semver = option_env!("VERGEN_BUILD_SEMVER"); diff --git a/src/meta/raft-store/src/key_spaces.rs b/src/meta/raft-store/src/key_spaces.rs index eb957026f466..d4e6c4ffa9b2 100644 --- a/src/meta/raft-store/src/key_spaces.rs +++ b/src/meta/raft-store/src/key_spaces.rs @@ -20,12 +20,12 @@ use databend_common_meta_sled_store::SledKeySpace; use databend_common_meta_sled_store::SledOrderedSerde; use databend_common_meta_sled_store::SledSerde; use databend_common_meta_stoerr::MetaStorageError; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::LogIndex; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::seq_value::SeqV; -use databend_common_meta_types::Entry; -use databend_common_meta_types::LogId; -use databend_common_meta_types::LogIndex; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; use databend_common_meta_types::SeqNum; use serde::Deserialize; use serde::Serialize; diff --git a/src/meta/raft-store/src/leveled_store/sys_data.rs b/src/meta/raft-store/src/leveled_store/sys_data.rs index ff19ae246809..3afb198c6e72 100644 --- a/src/meta/raft-store/src/leveled_store/sys_data.rs +++ b/src/meta/raft-store/src/leveled_store/sys_data.rs @@ -14,11 +14,11 @@ use std::collections::BTreeMap; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::StoredMembership; use databend_common_meta_types::sys_data::SysData; -use databend_common_meta_types::LogId; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::StoredMembership; use crate::leveled_store::sys_data_api::SysDataApiRO; diff --git a/src/meta/raft-store/src/leveled_store/sys_data_api.rs b/src/meta/raft-store/src/leveled_store/sys_data_api.rs index 8262721e7410..aa1a82fa9620 100644 --- a/src/meta/raft-store/src/leveled_store/sys_data_api.rs +++ b/src/meta/raft-store/src/leveled_store/sys_data_api.rs @@ -14,10 +14,10 @@ use std::collections::BTreeMap; -use databend_common_meta_types::LogId; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::StoredMembership; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::StoredMembership; /// APIs to access the non-user-data of the state machine(leveled map). pub trait SysDataApiRO { diff --git a/src/meta/raft-store/src/log/raft_log.rs b/src/meta/raft-store/src/log/raft_log.rs index 9cc99953ceaa..2e7461895bf8 100644 --- a/src/meta/raft-store/src/log/raft_log.rs +++ b/src/meta/raft-store/src/log/raft_log.rs @@ -18,9 +18,9 @@ use databend_common_meta_sled_store::sled; use databend_common_meta_sled_store::AsKeySpace; use databend_common_meta_sled_store::SledTree; use databend_common_meta_stoerr::MetaStorageError; -use databend_common_meta_types::Entry; -use databend_common_meta_types::LogId; -use databend_common_meta_types::LogIndex; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::LogIndex; use log::info; use crate::config::RaftConfig; diff --git a/src/meta/raft-store/src/sm_v003/adapter.rs b/src/meta/raft-store/src/sm_v003/adapter.rs index 2789e09f1dbf..883cae089fdb 100644 --- a/src/meta/raft-store/src/sm_v003/adapter.rs +++ b/src/meta/raft-store/src/sm_v003/adapter.rs @@ -17,11 +17,11 @@ use std::iter::repeat_with; use std::sync::Arc; use std::sync::Mutex; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::StoredMembership; use databend_common_meta_types::snapshot_db::DB; use databend_common_meta_types::sys_data::SysData; -use databend_common_meta_types::LogId; use databend_common_meta_types::SnapshotData; -use databend_common_meta_types::StoredMembership; use itertools::Itertools; use log::info; use openraft::SnapshotId; diff --git a/src/meta/raft-store/src/sm_v003/compact_immutable_levels_test.rs b/src/meta/raft-store/src/sm_v003/compact_immutable_levels_test.rs index a911829bd5e4..48c602a637aa 100644 --- a/src/meta/raft-store/src/sm_v003/compact_immutable_levels_test.rs +++ b/src/meta/raft-store/src/sm_v003/compact_immutable_levels_test.rs @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +use databend_common_meta_types::raft_types::Membership; +use databend_common_meta_types::raft_types::StoredMembership; use databend_common_meta_types::seq_value::KVMeta; use databend_common_meta_types::Endpoint; -use databend_common_meta_types::Membership; use databend_common_meta_types::Node; -use databend_common_meta_types::StoredMembership; use databend_common_meta_types::UpsertKV; use futures_util::TryStreamExt; use maplit::btreemap; diff --git a/src/meta/raft-store/src/sm_v003/compact_with_db_test.rs b/src/meta/raft-store/src/sm_v003/compact_with_db_test.rs index 2468b9cef06d..aa868c338f70 100644 --- a/src/meta/raft-store/src/sm_v003/compact_with_db_test.rs +++ b/src/meta/raft-store/src/sm_v003/compact_with_db_test.rs @@ -14,11 +14,11 @@ use std::io; +use databend_common_meta_types::raft_types::Membership; +use databend_common_meta_types::raft_types::StoredMembership; use databend_common_meta_types::seq_value::KVMeta; use databend_common_meta_types::Endpoint; -use databend_common_meta_types::Membership; use databend_common_meta_types::Node; -use databend_common_meta_types::StoredMembership; use databend_common_meta_types::UpsertKV; use futures_util::TryStreamExt; use maplit::btreemap; diff --git a/src/meta/raft-store/src/sm_v003/received.rs b/src/meta/raft-store/src/sm_v003/received.rs index 4449186cc011..9a8aadf6ee2f 100644 --- a/src/meta/raft-store/src/sm_v003/received.rs +++ b/src/meta/raft-store/src/sm_v003/received.rs @@ -14,8 +14,8 @@ use std::fmt; -use databend_common_meta_types::SnapshotMeta; -use databend_common_meta_types::Vote; +use databend_common_meta_types::raft_types::SnapshotMeta; +use databend_common_meta_types::raft_types::Vote; /// Contains information about a received snapshot data. #[derive(Debug)] diff --git a/src/meta/raft-store/src/sm_v003/receiver_v003.rs b/src/meta/raft-store/src/sm_v003/receiver_v003.rs index 10386d32df46..e0e2b149aab0 100644 --- a/src/meta/raft-store/src/sm_v003/receiver_v003.rs +++ b/src/meta/raft-store/src/sm_v003/receiver_v003.rs @@ -20,8 +20,8 @@ use std::io::BufWriter; use std::io::Write; use databend_common_meta_types::protobuf::SnapshotChunkRequestV003; -use databend_common_meta_types::SnapshotMeta; -use databend_common_meta_types::Vote; +use databend_common_meta_types::raft_types::SnapshotMeta; +use databend_common_meta_types::raft_types::Vote; use log::debug; use log::error; use log::info; diff --git a/src/meta/raft-store/src/sm_v003/sm_v003.rs b/src/meta/raft-store/src/sm_v003/sm_v003.rs index 9b30d7ca72fa..b310a69df595 100644 --- a/src/meta/raft-store/src/sm_v003/sm_v003.rs +++ b/src/meta/raft-store/src/sm_v003/sm_v003.rs @@ -21,17 +21,17 @@ use databend_common_meta_kvapi::kvapi::KVStream; use databend_common_meta_kvapi::kvapi::UpsertKVReply; use databend_common_meta_kvapi::kvapi::UpsertKVReq; use databend_common_meta_types::protobuf::StreamItem; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::StorageError; use databend_common_meta_types::seq_value::SeqV; use databend_common_meta_types::seq_value::SeqValue; use databend_common_meta_types::snapshot_db::DB; use databend_common_meta_types::sys_data::SysData; use databend_common_meta_types::AppliedState; use databend_common_meta_types::CmdContext; -use databend_common_meta_types::Entry; use databend_common_meta_types::EvalExpireTime; use databend_common_meta_types::MatchSeqExt; use databend_common_meta_types::Operation; -use databend_common_meta_types::StorageError; use databend_common_meta_types::TxnReply; use databend_common_meta_types::TxnRequest; use databend_common_meta_types::UpsertKV; diff --git a/src/meta/raft-store/src/sm_v003/snapshot_store_v002.rs b/src/meta/raft-store/src/sm_v003/snapshot_store_v002.rs index 6c0a9c110351..ff8a58f33ead 100644 --- a/src/meta/raft-store/src/sm_v003/snapshot_store_v002.rs +++ b/src/meta/raft-store/src/sm_v003/snapshot_store_v002.rs @@ -17,9 +17,9 @@ use std::io; use std::str::FromStr; use databend_common_meta_stoerr::MetaStorageError; -use databend_common_meta_types::ErrorSubject; +use databend_common_meta_types::raft_types::ErrorSubject; +use databend_common_meta_types::raft_types::StorageError; use databend_common_meta_types::SnapshotData; -use databend_common_meta_types::StorageError; use log::error; use log::info; use log::warn; diff --git a/src/meta/raft-store/src/state/raft_state.rs b/src/meta/raft-store/src/state/raft_state.rs index 5a60748be710..bdb9dfb41907 100644 --- a/src/meta/raft-store/src/state/raft_state.rs +++ b/src/meta/raft-store/src/state/raft_state.rs @@ -18,10 +18,10 @@ use databend_common_meta_sled_store::sled; use databend_common_meta_sled_store::AsKeySpace; use databend_common_meta_sled_store::SledTree; use databend_common_meta_stoerr::MetaStorageError; -use databend_common_meta_types::LogId; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::Vote; use databend_common_meta_types::MetaStartupError; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::Vote; use log::debug; use log::info; diff --git a/src/meta/raft-store/src/state/raft_state_kv.rs b/src/meta/raft-store/src/state/raft_state_kv.rs index bc0c808b4b2a..eb4c4fbc776c 100644 --- a/src/meta/raft-store/src/state/raft_state_kv.rs +++ b/src/meta/raft-store/src/state/raft_state_kv.rs @@ -19,9 +19,9 @@ use databend_common_meta_sled_store::SledBytesError; use databend_common_meta_sled_store::SledOrderedSerde; use databend_common_meta_sled_store::SledSerde; use databend_common_meta_types::anyerror::AnyError; -use databend_common_meta_types::LogId; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::Vote; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::Vote; use serde::Deserialize; use serde::Serialize; use sled::IVec; diff --git a/src/meta/raft-store/src/state_machine/log_meta.rs b/src/meta/raft-store/src/state_machine/log_meta.rs index fac80d8ccef7..4de3977f6fe6 100644 --- a/src/meta/raft-store/src/state_machine/log_meta.rs +++ b/src/meta/raft-store/src/state_machine/log_meta.rs @@ -19,7 +19,7 @@ use databend_common_meta_sled_store::SledBytesError; use databend_common_meta_sled_store::SledOrderedSerde; use databend_common_meta_sled_store::SledSerde; use databend_common_meta_types::anyerror::AnyError; -use databend_common_meta_types::LogId; +use databend_common_meta_types::raft_types::LogId; use serde::Deserialize; use serde::Serialize; use sled::IVec; diff --git a/src/meta/raft-store/src/state_machine/sm.rs b/src/meta/raft-store/src/state_machine/sm.rs index 58e25cd5fa68..287d50039482 100644 --- a/src/meta/raft-store/src/state_machine/sm.rs +++ b/src/meta/raft-store/src/state_machine/sm.rs @@ -28,6 +28,11 @@ use databend_common_meta_sled_store::Store; use databend_common_meta_sled_store::TransactionSledTree; use databend_common_meta_stoerr::MetaStorageError; use databend_common_meta_types::protobuf as pb; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::StoredMembership; use databend_common_meta_types::seq_value::SeqV; use databend_common_meta_types::seq_value::SeqValue; use databend_common_meta_types::txn_condition; @@ -38,17 +43,12 @@ use databend_common_meta_types::Change; use databend_common_meta_types::Cmd; use databend_common_meta_types::CmdContext; use databend_common_meta_types::ConditionResult; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::Interval; -use databend_common_meta_types::LogId; use databend_common_meta_types::MatchSeq; use databend_common_meta_types::MatchSeqExt; use databend_common_meta_types::MetaSpec; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; use databend_common_meta_types::Operation; -use databend_common_meta_types::StoredMembership; use databend_common_meta_types::TxnCondition; use databend_common_meta_types::TxnDeleteByPrefixRequest; use databend_common_meta_types::TxnDeleteByPrefixResponse; diff --git a/src/meta/raft-store/src/state_machine/snapshot_id.rs b/src/meta/raft-store/src/state_machine/snapshot_id.rs index 8d604ca32e31..c9c8ae2e332d 100644 --- a/src/meta/raft-store/src/state_machine/snapshot_id.rs +++ b/src/meta/raft-store/src/state_machine/snapshot_id.rs @@ -17,8 +17,8 @@ use std::str::FromStr; use std::time::SystemTime; use std::time::UNIX_EPOCH; -use databend_common_meta_types::new_log_id; -use databend_common_meta_types::LogId; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::LogId; /// Structured snapshot id used by meta service #[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] @@ -153,7 +153,7 @@ impl Display for MetaSnapshotId { mod tests { use std::str::FromStr; - use databend_common_meta_types::new_log_id; + use databend_common_meta_types::raft_types::new_log_id; use crate::state_machine::snapshot_id::MetaSnapshotId; diff --git a/src/meta/raft-store/src/state_machine/state_machine_meta.rs b/src/meta/raft-store/src/state_machine/state_machine_meta.rs index 32b18d0777ea..448da6a3775a 100644 --- a/src/meta/raft-store/src/state_machine/state_machine_meta.rs +++ b/src/meta/raft-store/src/state_machine/state_machine_meta.rs @@ -19,8 +19,8 @@ use databend_common_meta_sled_store::SledBytesError; use databend_common_meta_sled_store::SledOrderedSerde; use databend_common_meta_sled_store::SledSerde; use databend_common_meta_types::anyerror::AnyError; -use databend_common_meta_types::LogId; -use databend_common_meta_types::StoredMembership; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::StoredMembership; use serde::Deserialize; use serde::Serialize; use sled::IVec; diff --git a/src/meta/raft-store/src/state_machine/testing.rs b/src/meta/raft-store/src/state_machine/testing.rs index 75c3790d9e37..32c20a7a1870 100644 --- a/src/meta/raft-store/src/state_machine/testing.rs +++ b/src/meta/raft-store/src/state_machine/testing.rs @@ -13,10 +13,10 @@ // limitations under the License. use databend_common_meta_sled_store::openraft; -use databend_common_meta_types::new_log_id; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; use databend_common_meta_types::Cmd; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::LogEntry; use databend_common_meta_types::RaftTxId; use databend_common_meta_types::UpsertKV; diff --git a/src/meta/raft-store/tests/it/log.rs b/src/meta/raft-store/tests/it/log.rs index ec2c6150c687..4aa3141390ef 100644 --- a/src/meta/raft-store/tests/it/log.rs +++ b/src/meta/raft-store/tests/it/log.rs @@ -13,10 +13,10 @@ // limitations under the License. use databend_common_meta_raft_store::log::RaftLog; -use databend_common_meta_types::new_log_id; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; use databend_common_meta_types::Cmd; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::LogEntry; use databend_common_meta_types::UpsertKV; use test_harness::test; diff --git a/src/meta/raft-store/tests/it/state.rs b/src/meta/raft-store/tests/it/state.rs index ce8153460f47..f9577500f34f 100644 --- a/src/meta/raft-store/tests/it/state.rs +++ b/src/meta/raft-store/tests/it/state.rs @@ -13,7 +13,7 @@ // limitations under the License. use databend_common_meta_raft_store::state::RaftState; -use databend_common_meta_types::Vote; +use databend_common_meta_types::raft_types::Vote; use test_harness::test; use crate::testing::new_raft_test_context; diff --git a/src/meta/raft-store/tests/it/state_machine/expire.rs b/src/meta/raft-store/tests/it/state_machine/expire.rs index b13140663a56..72dd93853531 100644 --- a/src/meta/raft-store/tests/it/state_machine/expire.rs +++ b/src/meta/raft-store/tests/it/state_machine/expire.rs @@ -20,10 +20,10 @@ use databend_common_meta_raft_store::key_spaces::GenericKV; use databend_common_meta_raft_store::state_machine::ExpireKey; use databend_common_meta_raft_store::state_machine::StateMachine; use databend_common_meta_sled_store::AsKeySpace; -use databend_common_meta_types::new_log_id; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; use databend_common_meta_types::Cmd; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::LogEntry; use databend_common_meta_types::MetaSpec; use databend_common_meta_types::UpsertKV; diff --git a/src/meta/raft-store/tests/it/state_machine/mod.rs b/src/meta/raft-store/tests/it/state_machine/mod.rs index 797dbdd5f250..27a07649a2ee 100644 --- a/src/meta/raft-store/tests/it/state_machine/mod.rs +++ b/src/meta/raft-store/tests/it/state_machine/mod.rs @@ -18,7 +18,9 @@ use std::time::UNIX_EPOCH; use databend_common_meta_kvapi::kvapi::KVApi; use databend_common_meta_raft_store::state_machine::StateMachine; -use databend_common_meta_types::new_log_id; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; use databend_common_meta_types::seq_value::KVMeta; use databend_common_meta_types::seq_value::SeqV; use databend_common_meta_types::seq_value::SeqValue; @@ -27,8 +29,6 @@ use databend_common_meta_types::Change; use databend_common_meta_types::Cmd; use databend_common_meta_types::CmdContext; use databend_common_meta_types::Endpoint; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::LogEntry; use databend_common_meta_types::MatchSeq; use databend_common_meta_types::MetaSpec; diff --git a/src/meta/raft-store/tests/it/types.rs b/src/meta/raft-store/tests/it/types.rs index 6d0dfb6ff701..c24a8b6b5469 100644 --- a/src/meta/raft-store/tests/it/types.rs +++ b/src/meta/raft-store/tests/it/types.rs @@ -17,7 +17,7 @@ use std::ops::Bound; use databend_common_meta_sled_store::sled; use databend_common_meta_sled_store::SledOrderedSerde; use databend_common_meta_sled_store::SledRangeSerde; -use databend_common_meta_types::NodeId; +use databend_common_meta_types::raft_types::NodeId; #[test] fn test_node_id_serde_ser() -> anyhow::Result<()> { diff --git a/src/meta/service/src/api/http/v1/ctrl.rs b/src/meta/service/src/api/http/v1/ctrl.rs index 2578db12c70b..2af9f368d3df 100644 --- a/src/meta/service/src/api/http/v1/ctrl.rs +++ b/src/meta/service/src/api/http/v1/ctrl.rs @@ -15,7 +15,7 @@ use std::sync::Arc; use databend_common_meta_sled_store::openraft::async_runtime::watch::WatchReceiver; -use databend_common_meta_types::NodeId; +use databend_common_meta_types::raft_types::NodeId; use http::StatusCode; use log::info; use log::warn; diff --git a/src/meta/service/src/message.rs b/src/meta/service/src/message.rs index 2b917e9ffd35..e75fb544d8d5 100644 --- a/src/meta/service/src/message.rs +++ b/src/meta/service/src/message.rs @@ -21,11 +21,11 @@ use databend_common_meta_kvapi::kvapi::ListKVReq; use databend_common_meta_kvapi::kvapi::MGetKVReply; use databend_common_meta_kvapi::kvapi::MGetKVReq; use databend_common_meta_types::protobuf::RaftRequest; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::AppliedState; use databend_common_meta_types::Endpoint; use databend_common_meta_types::LogEntry; use databend_common_meta_types::MetaAPIError; -use databend_common_meta_types::NodeId; #[derive(serde::Serialize, serde::Deserialize, Debug, Default, Clone, PartialEq, Eq)] pub struct JoinRequest { diff --git a/src/meta/service/src/meta_service/forwarder.rs b/src/meta/service/src/meta_service/forwarder.rs index 435d5ad672e7..705f58ebf510 100644 --- a/src/meta/service/src/meta_service/forwarder.rs +++ b/src/meta/service/src/meta_service/forwarder.rs @@ -18,13 +18,13 @@ use databend_common_meta_api::reply::reply_to_api_result; use databend_common_meta_client::MetaGrpcReadReq; use databend_common_meta_types::protobuf::raft_service_client::RaftServiceClient; use databend_common_meta_types::protobuf::StreamItem; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::ConnectionError; use databend_common_meta_types::Endpoint; use databend_common_meta_types::ForwardRPCError; use databend_common_meta_types::GrpcConfig; use databend_common_meta_types::MetaAPIError; use databend_common_meta_types::MetaNetworkError; -use databend_common_meta_types::NodeId; use log::debug; use tonic::codegen::BoxStream; use tonic::transport::Channel; diff --git a/src/meta/service/src/meta_service/meta_leader.rs b/src/meta/service/src/meta_service/meta_leader.rs index 39350e2c9016..9dfce821c98c 100644 --- a/src/meta/service/src/meta_service/meta_leader.rs +++ b/src/meta/service/src/meta_service/meta_leader.rs @@ -22,18 +22,18 @@ use databend_common_meta_raft_store::sm_v003::SMV003; use databend_common_meta_sled_store::openraft::ChangeMembers; use databend_common_meta_stoerr::MetaStorageError; use databend_common_meta_types::protobuf::StreamItem; +use databend_common_meta_types::raft_types::ClientWriteError; +use databend_common_meta_types::raft_types::MembershipNode; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::RaftError; use databend_common_meta_types::seq_value::SeqV; use databend_common_meta_types::AppliedState; -use databend_common_meta_types::ClientWriteError; use databend_common_meta_types::Cmd; use databend_common_meta_types::LogEntry; -use databend_common_meta_types::MembershipNode; use databend_common_meta_types::MetaDataError; use databend_common_meta_types::MetaDataReadError; use databend_common_meta_types::MetaOperationError; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::RaftError; use databend_common_metrics::count::Count; use futures::StreamExt; use log::debug; diff --git a/src/meta/service/src/meta_service/meta_node.rs b/src/meta/service/src/meta_service/meta_node.rs index ba777977309c..326d4e715758 100644 --- a/src/meta/service/src/meta_service/meta_node.rs +++ b/src/meta/service/src/meta_service/meta_node.rs @@ -38,16 +38,19 @@ use databend_common_meta_stoerr::MetaStorageError; use databend_common_meta_types::protobuf::raft_service_client::RaftServiceClient; use databend_common_meta_types::protobuf::raft_service_server::RaftServiceServer; use databend_common_meta_types::protobuf::WatchRequest; +use databend_common_meta_types::raft_types::CommittedLeaderId; +use databend_common_meta_types::raft_types::ForwardToLeader; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::MembershipNode; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::RaftMetrics; +use databend_common_meta_types::raft_types::TypeConfig; use databend_common_meta_types::AppliedState; use databend_common_meta_types::Cmd; -use databend_common_meta_types::CommittedLeaderId; use databend_common_meta_types::Endpoint; use databend_common_meta_types::ForwardRPCError; -use databend_common_meta_types::ForwardToLeader; use databend_common_meta_types::GrpcConfig; use databend_common_meta_types::LogEntry; -use databend_common_meta_types::LogId; -use databend_common_meta_types::MembershipNode; use databend_common_meta_types::MetaAPIError; use databend_common_meta_types::MetaError; use databend_common_meta_types::MetaManagementError; @@ -55,9 +58,6 @@ use databend_common_meta_types::MetaNetworkError; use databend_common_meta_types::MetaOperationError; use databend_common_meta_types::MetaStartupError; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::RaftMetrics; -use databend_common_meta_types::TypeConfig; use fastrace::func_name; use fastrace::prelude::*; use futures::channel::oneshot; diff --git a/src/meta/service/src/meta_service/meta_node_status.rs b/src/meta/service/src/meta_service/meta_node_status.rs index abcf0a0a1b78..73c084fb77b5 100644 --- a/src/meta/service/src/meta_service/meta_node_status.rs +++ b/src/meta/service/src/meta_service/meta_node_status.rs @@ -15,9 +15,9 @@ use std::collections::BTreeMap; use databend_common_meta_raft_store::ondisk::DataVersion; -use databend_common_meta_types::LogId; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; #[derive(serde::Serialize)] pub struct MetaNodeStatus { diff --git a/src/meta/service/src/meta_service/raft_service_impl.rs b/src/meta/service/src/meta_service/raft_service_impl.rs index bd805dbdab59..208e0f3c27d7 100644 --- a/src/meta/service/src/meta_service/raft_service_impl.rs +++ b/src/meta/service/src/meta_service/raft_service_impl.rs @@ -35,20 +35,20 @@ use databend_common_meta_types::protobuf::SnapshotChunkRequest; use databend_common_meta_types::protobuf::SnapshotChunkRequestV003; use databend_common_meta_types::protobuf::SnapshotResponseV003; use databend_common_meta_types::protobuf::StreamItem; +use databend_common_meta_types::raft_types::AppendEntriesRequest; +use databend_common_meta_types::raft_types::InstallSnapshotError; +use databend_common_meta_types::raft_types::InstallSnapshotRequest; +use databend_common_meta_types::raft_types::InstallSnapshotResponse; +use databend_common_meta_types::raft_types::RaftError; +use databend_common_meta_types::raft_types::Snapshot; +use databend_common_meta_types::raft_types::SnapshotMeta; +use databend_common_meta_types::raft_types::StorageError; use databend_common_meta_types::raft_types::TransferLeaderRequest; +use databend_common_meta_types::raft_types::Vote; +use databend_common_meta_types::raft_types::VoteRequest; use databend_common_meta_types::snapshot_db::DB; -use databend_common_meta_types::AppendEntriesRequest; use databend_common_meta_types::GrpcHelper; -use databend_common_meta_types::InstallSnapshotError; -use databend_common_meta_types::InstallSnapshotRequest; -use databend_common_meta_types::InstallSnapshotResponse; -use databend_common_meta_types::RaftError; -use databend_common_meta_types::Snapshot; use databend_common_meta_types::SnapshotData; -use databend_common_meta_types::SnapshotMeta; -use databend_common_meta_types::StorageError; -use databend_common_meta_types::Vote; -use databend_common_meta_types::VoteRequest; use databend_common_metrics::count::Count; use fastrace::func_path; use fastrace::prelude::*; diff --git a/src/meta/service/src/meta_service/snapshot_receiver_v1.rs b/src/meta/service/src/meta_service/snapshot_receiver_v1.rs index 8a338b950b40..a137df539d99 100644 --- a/src/meta/service/src/meta_service/snapshot_receiver_v1.rs +++ b/src/meta/service/src/meta_service/snapshot_receiver_v1.rs @@ -24,11 +24,11 @@ use databend_common_meta_sled_store::openraft::ErrorSubject; use databend_common_meta_sled_store::openraft::ErrorVerb; use databend_common_meta_sled_store::openraft::SnapshotId; use databend_common_meta_sled_store::openraft::SnapshotSegmentId; -use databend_common_meta_types::InstallSnapshotError; -use databend_common_meta_types::InstallSnapshotRequest; -use databend_common_meta_types::RaftError; -use databend_common_meta_types::SnapshotMismatch; -use databend_common_meta_types::StorageError; +use databend_common_meta_types::raft_types::InstallSnapshotError; +use databend_common_meta_types::raft_types::InstallSnapshotRequest; +use databend_common_meta_types::raft_types::RaftError; +use databend_common_meta_types::raft_types::SnapshotMismatch; +use databend_common_meta_types::raft_types::StorageError; use fastrace::func_name; use log::info; diff --git a/src/meta/service/src/metrics/meta_metrics.rs b/src/meta/service/src/metrics/meta_metrics.rs index 7b98a9c3a16e..6698b0385657 100644 --- a/src/meta/service/src/metrics/meta_metrics.rs +++ b/src/meta/service/src/metrics/meta_metrics.rs @@ -33,7 +33,7 @@ use prometheus_client::encoding::text::encode as prometheus_encode; pub mod server_metrics { use std::sync::LazyLock; - use databend_common_meta_types::NodeId; + use databend_common_meta_types::raft_types::NodeId; use prometheus_client::metrics::counter::Counter; use prometheus_client::metrics::family::Family; use prometheus_client::metrics::gauge::Gauge; @@ -239,7 +239,7 @@ pub mod raft_metrics { pub mod network { use std::sync::LazyLock; - use databend_common_meta_types::NodeId; + use databend_common_meta_types::raft_types::NodeId; use prometheus_client; use prometheus_client::encoding::EncodeLabelSet; use prometheus_client::metrics::counter::Counter; diff --git a/src/meta/service/src/network.rs b/src/meta/service/src/network.rs index b03c9c56d93d..5739276c2bca 100644 --- a/src/meta/service/src/network.rs +++ b/src/meta/service/src/network.rs @@ -43,30 +43,30 @@ use databend_common_meta_types::protobuf::RaftReply; use databend_common_meta_types::protobuf::RaftRequest; use databend_common_meta_types::protobuf::SnapshotChunkRequest; use databend_common_meta_types::protobuf::SnapshotChunkRequestV003; +use databend_common_meta_types::raft_types::AppendEntriesRequest; +use databend_common_meta_types::raft_types::AppendEntriesResponse; +use databend_common_meta_types::raft_types::ErrorSubject; +use databend_common_meta_types::raft_types::InstallSnapshotError; +use databend_common_meta_types::raft_types::InstallSnapshotRequest; +use databend_common_meta_types::raft_types::InstallSnapshotResponse; +use databend_common_meta_types::raft_types::MembershipNode; +use databend_common_meta_types::raft_types::NetworkError; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::RPCError; +use databend_common_meta_types::raft_types::RaftError; +use databend_common_meta_types::raft_types::Snapshot; +use databend_common_meta_types::raft_types::SnapshotResponse; +use databend_common_meta_types::raft_types::StorageError; +use databend_common_meta_types::raft_types::StreamingError; use databend_common_meta_types::raft_types::TransferLeaderRequest; -use databend_common_meta_types::AppendEntriesRequest; -use databend_common_meta_types::AppendEntriesResponse; +use databend_common_meta_types::raft_types::TypeConfig; +use databend_common_meta_types::raft_types::Vote; +use databend_common_meta_types::raft_types::VoteRequest; +use databend_common_meta_types::raft_types::VoteResponse; use databend_common_meta_types::Endpoint; -use databend_common_meta_types::ErrorSubject; use databend_common_meta_types::GrpcConfig; use databend_common_meta_types::GrpcHelper; -use databend_common_meta_types::InstallSnapshotError; -use databend_common_meta_types::InstallSnapshotRequest; -use databend_common_meta_types::InstallSnapshotResponse; -use databend_common_meta_types::MembershipNode; use databend_common_meta_types::MetaNetworkError; -use databend_common_meta_types::NetworkError; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::RPCError; -use databend_common_meta_types::RaftError; -use databend_common_meta_types::Snapshot; -use databend_common_meta_types::SnapshotResponse; -use databend_common_meta_types::StorageError; -use databend_common_meta_types::StreamingError; -use databend_common_meta_types::TypeConfig; -use databend_common_meta_types::Vote; -use databend_common_meta_types::VoteRequest; -use databend_common_meta_types::VoteResponse; use databend_common_metrics::count::Count; use fastrace::func_name; use futures::FutureExt; diff --git a/src/meta/service/src/raft_client.rs b/src/meta/service/src/raft_client.rs index 5428893fbe21..90cc3865a79d 100644 --- a/src/meta/service/src/raft_client.rs +++ b/src/meta/service/src/raft_client.rs @@ -13,9 +13,9 @@ // limitations under the License. use databend_common_meta_types::protobuf::raft_service_client::RaftServiceClient; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::Endpoint; use databend_common_meta_types::GrpcConfig; -use databend_common_meta_types::NodeId; use databend_common_metrics::count; use log::debug; use tonic::transport::channel::Channel; diff --git a/src/meta/service/src/request_handling.rs b/src/meta/service/src/request_handling.rs index 0328b2f00e7a..88b625755ac8 100644 --- a/src/meta/service/src/request_handling.rs +++ b/src/meta/service/src/request_handling.rs @@ -13,10 +13,10 @@ // limitations under the License. use databend_common_meta_client::RequestFor; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::Endpoint; use databend_common_meta_types::ForwardRPCError; use databend_common_meta_types::MetaOperationError; -use databend_common_meta_types::NodeId; use crate::message::ForwardRequest; use crate::message::ForwardRequestBody; diff --git a/src/meta/service/src/store/raft_log_storage_impl.rs b/src/meta/service/src/store/raft_log_storage_impl.rs index e59307ac85ec..743a699400ae 100644 --- a/src/meta/service/src/store/raft_log_storage_impl.rs +++ b/src/meta/service/src/store/raft_log_storage_impl.rs @@ -30,12 +30,12 @@ use databend_common_meta_sled_store::openraft::LogState; use databend_common_meta_sled_store::openraft::OptionalSend; use databend_common_meta_sled_store::openraft::RaftLogId; use databend_common_meta_sled_store::openraft::RaftLogReader; -use databend_common_meta_types::Entry; -use databend_common_meta_types::LogId; -use databend_common_meta_types::Membership; -use databend_common_meta_types::StorageError; -use databend_common_meta_types::TypeConfig; -use databend_common_meta_types::Vote; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::Membership; +use databend_common_meta_types::raft_types::StorageError; +use databend_common_meta_types::raft_types::TypeConfig; +use databend_common_meta_types::raft_types::Vote; use deepsize::DeepSizeOf; use log::debug; use log::error; diff --git a/src/meta/service/src/store/raft_state_machine_impl.rs b/src/meta/service/src/store/raft_state_machine_impl.rs index 0df9f575dad9..3e3dd2e43d2c 100644 --- a/src/meta/service/src/store/raft_state_machine_impl.rs +++ b/src/meta/service/src/store/raft_state_machine_impl.rs @@ -17,15 +17,15 @@ use databend_common_meta_raft_store::sm_v003::SnapshotStoreV003; use databend_common_meta_sled_store::openraft::storage::RaftStateMachine; use databend_common_meta_sled_store::openraft::OptionalSend; use databend_common_meta_sled_store::openraft::RaftSnapshotBuilder; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::Snapshot; +use databend_common_meta_types::raft_types::SnapshotMeta; +use databend_common_meta_types::raft_types::StorageError; +use databend_common_meta_types::raft_types::StoredMembership; +use databend_common_meta_types::raft_types::TypeConfig; use databend_common_meta_types::snapshot_db::DB; use databend_common_meta_types::AppliedState; -use databend_common_meta_types::Entry; -use databend_common_meta_types::LogId; -use databend_common_meta_types::Snapshot; -use databend_common_meta_types::SnapshotMeta; -use databend_common_meta_types::StorageError; -use databend_common_meta_types::StoredMembership; -use databend_common_meta_types::TypeConfig; use log::debug; use log::error; use log::info; diff --git a/src/meta/service/src/store/store_inner.rs b/src/meta/service/src/store/store_inner.rs index f3f0fece7f87..86a84fb6a6a2 100644 --- a/src/meta/service/src/store/store_inner.rs +++ b/src/meta/service/src/store/store_inner.rs @@ -37,18 +37,18 @@ use databend_common_meta_raft_store::state_machine::MetaSnapshotId; use databend_common_meta_sled_store::get_sled_db; use databend_common_meta_sled_store::SledTree; use databend_common_meta_stoerr::MetaStorageError; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::Membership; +use databend_common_meta_types::raft_types::NodeId; +use databend_common_meta_types::raft_types::Snapshot; +use databend_common_meta_types::raft_types::SnapshotMeta; +use databend_common_meta_types::raft_types::StorageError; +use databend_common_meta_types::raft_types::Vote; use databend_common_meta_types::snapshot_db::DB; use databend_common_meta_types::Endpoint; -use databend_common_meta_types::LogId; -use databend_common_meta_types::Membership; use databend_common_meta_types::MetaNetworkError; use databend_common_meta_types::MetaStartupError; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; -use databend_common_meta_types::Snapshot; -use databend_common_meta_types::SnapshotMeta; -use databend_common_meta_types::StorageError; -use databend_common_meta_types::Vote; use futures::TryStreamExt; use log::debug; use log::error; diff --git a/src/meta/service/src/store/to_storage_error.rs b/src/meta/service/src/store/to_storage_error.rs index 1792c34456d0..ea72405bab16 100644 --- a/src/meta/service/src/store/to_storage_error.rs +++ b/src/meta/service/src/store/to_storage_error.rs @@ -14,8 +14,8 @@ use databend_common_meta_sled_store::openraft; use databend_common_meta_stoerr::MetaStorageError; -use databend_common_meta_types::ErrorSubject; -use databend_common_meta_types::StorageError; +use databend_common_meta_types::raft_types::ErrorSubject; +use databend_common_meta_types::raft_types::StorageError; use openraft::ErrorVerb; /// Convert MetaStorageError to openraft::StorageError; diff --git a/src/meta/service/tests/it/meta_node/meta_node_lifecycle.rs b/src/meta/service/tests/it/meta_node/meta_node_lifecycle.rs index dfafa3b78313..0dcebfe27872 100644 --- a/src/meta/service/tests/it/meta_node/meta_node_lifecycle.rs +++ b/src/meta/service/tests/it/meta_node/meta_node_lifecycle.rs @@ -19,12 +19,12 @@ use databend_common_base::base::tokio::time::sleep; use databend_common_meta_kvapi::kvapi::KVApi; use databend_common_meta_sled_store::openraft::LogIdOptionExt; use databend_common_meta_sled_store::openraft::ServerState; -use databend_common_meta_types::new_log_id; use databend_common_meta_types::protobuf::raft_service_client::RaftServiceClient; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::Cmd; use databend_common_meta_types::Endpoint; use databend_common_meta_types::LogEntry; -use databend_common_meta_types::NodeId; use databend_common_meta_types::UpsertKV; use databend_meta::configs; use databend_meta::message::ForwardRequest; diff --git a/src/meta/service/tests/it/meta_node/meta_node_replication.rs b/src/meta/service/tests/it/meta_node/meta_node_replication.rs index 4dac4d55b083..73d8e45bd94f 100644 --- a/src/meta/service/tests/it/meta_node/meta_node_replication.rs +++ b/src/meta/service/tests/it/meta_node/meta_node_replication.rs @@ -24,18 +24,18 @@ use databend_common_meta_sled_store::openraft::LogIdOptionExt; use databend_common_meta_sled_store::openraft::ServerState; use databend_common_meta_types::protobuf::SnapshotChunkRequest; use databend_common_meta_types::protobuf::SnapshotChunkRequestV003; +use databend_common_meta_types::raft_types::InstallSnapshotError; +use databend_common_meta_types::raft_types::InstallSnapshotRequest; +use databend_common_meta_types::raft_types::RaftError; +use databend_common_meta_types::raft_types::SnapshotMeta; +use databend_common_meta_types::raft_types::SnapshotResponse; +use databend_common_meta_types::raft_types::StoredMembership; +use databend_common_meta_types::raft_types::Vote; use databend_common_meta_types::seq_value::SeqV; use databend_common_meta_types::sys_data::SysData; use databend_common_meta_types::Cmd; -use databend_common_meta_types::InstallSnapshotError; -use databend_common_meta_types::InstallSnapshotRequest; use databend_common_meta_types::LogEntry; -use databend_common_meta_types::RaftError; -use databend_common_meta_types::SnapshotMeta; -use databend_common_meta_types::SnapshotResponse; -use databend_common_meta_types::StoredMembership; use databend_common_meta_types::UpsertKV; -use databend_common_meta_types::Vote; use databend_meta::meta_service::MetaNode; use futures::stream; use itertools::Itertools; diff --git a/src/meta/service/tests/it/meta_node/meta_node_request_forwarding.rs b/src/meta/service/tests/it/meta_node/meta_node_request_forwarding.rs index a9ace2a51c25..68caaa6f48da 100644 --- a/src/meta/service/tests/it/meta_node/meta_node_request_forwarding.rs +++ b/src/meta/service/tests/it/meta_node/meta_node_request_forwarding.rs @@ -15,9 +15,9 @@ use std::sync::Arc; use databend_common_meta_sled_store::openraft::error::RaftError; -use databend_common_meta_types::ClientWriteError; +use databend_common_meta_types::raft_types::ClientWriteError; +use databend_common_meta_types::raft_types::ForwardToLeader; use databend_common_meta_types::Cmd; -use databend_common_meta_types::ForwardToLeader; use databend_common_meta_types::LogEntry; use databend_common_meta_types::UpsertKV; use databend_meta::meta_service::meta_leader::MetaLeader; diff --git a/src/meta/service/tests/it/store.rs b/src/meta/service/tests/it/store.rs index cd9654d127b3..92565d0df8ec 100644 --- a/src/meta/service/tests/it/store.rs +++ b/src/meta/service/tests/it/store.rs @@ -25,14 +25,14 @@ use databend_common_meta_sled_store::openraft::testing::log::StoreBuilder; use databend_common_meta_sled_store::openraft::testing::log_id; use databend_common_meta_sled_store::openraft::RaftLogReader; use databend_common_meta_sled_store::openraft::RaftSnapshotBuilder; -use databend_common_meta_types::new_log_id; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::Membership; +use databend_common_meta_types::raft_types::StorageError; +use databend_common_meta_types::raft_types::StoredMembership; +use databend_common_meta_types::raft_types::TypeConfig; +use databend_common_meta_types::raft_types::Vote; use databend_common_meta_types::snapshot_db::DB; -use databend_common_meta_types::Entry; -use databend_common_meta_types::Membership; -use databend_common_meta_types::StorageError; -use databend_common_meta_types::StoredMembership; -use databend_common_meta_types::TypeConfig; -use databend_common_meta_types::Vote; use databend_meta::meta_service::meta_node::LogStore; use databend_meta::meta_service::meta_node::SMStore; use databend_meta::store::RaftStore; diff --git a/src/meta/service/tests/it/tests/meta_node.rs b/src/meta/service/tests/it/tests/meta_node.rs index cd32b7ffbb1d..27fd4bc4c139 100644 --- a/src/meta/service/tests/it/tests/meta_node.rs +++ b/src/meta/service/tests/it/tests/meta_node.rs @@ -19,9 +19,9 @@ use std::sync::Arc; use std::time::Duration; use databend_common_meta_sled_store::openraft::ServerState; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::AppliedState; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; use databend_meta::meta_service::MetaNode; use databend_meta::Opened; use log::info; diff --git a/src/meta/service/tests/it/tests/service.rs b/src/meta/service/tests/it/tests/service.rs index c8a43f53f587..e145626fef3b 100644 --- a/src/meta/service/tests/it/tests/service.rs +++ b/src/meta/service/tests/it/tests/service.rs @@ -27,8 +27,8 @@ use databend_common_meta_client::ClientHandle; use databend_common_meta_client::MetaGrpcClient; use databend_common_meta_kvapi::kvapi; use databend_common_meta_types::protobuf::raft_service_client::RaftServiceClient; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::MetaClientError; -use databend_common_meta_types::NodeId; use databend_meta::api::GrpcServer; use databend_meta::configs; use databend_meta::message::ForwardRequest; diff --git a/src/meta/sled-store/src/sled_serde.rs b/src/meta/sled-store/src/sled_serde.rs index f06fe025ec2b..d12141373069 100644 --- a/src/meta/sled-store/src/sled_serde.rs +++ b/src/meta/sled-store/src/sled_serde.rs @@ -18,7 +18,7 @@ use std::ops::RangeBounds; use byteorder::BigEndian; use byteorder::ByteOrder; -use databend_common_meta_types::Entry; +use databend_common_meta_types::raft_types::Entry; use serde::de::DeserializeOwned; use serde::Serialize; use sled::IVec; diff --git a/src/meta/sled-store/src/sled_serde_impl.rs b/src/meta/sled-store/src/sled_serde_impl.rs index 08825465223b..d28407dc58e3 100644 --- a/src/meta/sled-store/src/sled_serde_impl.rs +++ b/src/meta/sled-store/src/sled_serde_impl.rs @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::Membership; +use databend_common_meta_types::raft_types::SnapshotMeta; +use databend_common_meta_types::raft_types::StoredMembership; +use databend_common_meta_types::raft_types::Vote; use databend_common_meta_types::seq_value::SeqV; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; -use databend_common_meta_types::LogId; -use databend_common_meta_types::Membership; use databend_common_meta_types::Node; use databend_common_meta_types::SeqNum; -use databend_common_meta_types::SnapshotMeta; -use databend_common_meta_types::StoredMembership; -use databend_common_meta_types::Vote; use crate::SledBytesError; use crate::SledSerde; diff --git a/src/meta/sled-store/tests/it/sled_iter.rs b/src/meta/sled-store/tests/it/sled_iter.rs index 4d6a1f605b83..dd6804f5bffd 100644 --- a/src/meta/sled-store/tests/it/sled_iter.rs +++ b/src/meta/sled-store/tests/it/sled_iter.rs @@ -14,10 +14,10 @@ use databend_common_meta_sled_store::SledItem; use databend_common_meta_sled_store::SledTree; -use databend_common_meta_types::new_log_id; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; use databend_common_meta_types::Cmd; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::LogEntry; use databend_common_meta_types::UpsertKV; use log::info; diff --git a/src/meta/sled-store/tests/it/sled_tree.rs b/src/meta/sled-store/tests/it/sled_tree.rs index 11ee7a6a6ed1..b2ed93a298b1 100644 --- a/src/meta/sled-store/tests/it/sled_tree.rs +++ b/src/meta/sled-store/tests/it/sled_tree.rs @@ -13,13 +13,13 @@ // limitations under the License. use databend_common_meta_sled_store::SledTree; -use databend_common_meta_types::new_log_id; +use databend_common_meta_types::raft_types::new_log_id; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::EntryPayload; +use databend_common_meta_types::raft_types::LogIndex; use databend_common_meta_types::seq_value::SeqV; use databend_common_meta_types::Cmd; -use databend_common_meta_types::Entry; -use databend_common_meta_types::EntryPayload; use databend_common_meta_types::LogEntry; -use databend_common_meta_types::LogIndex; use databend_common_meta_types::UpsertKV; use test_harness::test; diff --git a/src/meta/sled-store/tests/it/testing/fake_key_spaces.rs b/src/meta/sled-store/tests/it/testing/fake_key_spaces.rs index 6d69d02f8524..f9c80e47c2e6 100644 --- a/src/meta/sled-store/tests/it/testing/fake_key_spaces.rs +++ b/src/meta/sled-store/tests/it/testing/fake_key_spaces.rs @@ -13,11 +13,11 @@ // limitations under the License. use databend_common_meta_sled_store::SledKeySpace; +use databend_common_meta_types::raft_types::Entry; +use databend_common_meta_types::raft_types::LogIndex; +use databend_common_meta_types::raft_types::NodeId; use databend_common_meta_types::seq_value::SeqV; -use databend_common_meta_types::Entry; -use databend_common_meta_types::LogIndex; use databend_common_meta_types::Node; -use databend_common_meta_types::NodeId; use crate::testing::fake_state_machine_meta::StateMachineMetaKey; use crate::testing::fake_state_machine_meta::StateMachineMetaValue; diff --git a/src/meta/sled-store/tests/it/testing/fake_state_machine_meta.rs b/src/meta/sled-store/tests/it/testing/fake_state_machine_meta.rs index a917408f0a70..0d3f2e0f03c1 100644 --- a/src/meta/sled-store/tests/it/testing/fake_state_machine_meta.rs +++ b/src/meta/sled-store/tests/it/testing/fake_state_machine_meta.rs @@ -18,8 +18,8 @@ use databend_common_meta_sled_store::SledBytesError; use databend_common_meta_sled_store::SledOrderedSerde; use databend_common_meta_sled_store::SledSerde; use databend_common_meta_types::anyerror::AnyError; -use databend_common_meta_types::LogId; -use databend_common_meta_types::Membership; +use databend_common_meta_types::raft_types::LogId; +use databend_common_meta_types::raft_types::Membership; use serde::Deserialize; use serde::Serialize; use sled::IVec; diff --git a/src/meta/types/src/cmd/mod.rs b/src/meta/types/src/cmd/mod.rs index 22ec14dbbaac..ffb46d54ffbd 100644 --- a/src/meta/types/src/cmd/mod.rs +++ b/src/meta/types/src/cmd/mod.rs @@ -17,8 +17,8 @@ use std::fmt; use serde::Deserialize; use serde::Serialize; +use crate::raft_types::NodeId; use crate::Node; -use crate::NodeId; use crate::TxnRequest; mod cmd_context; diff --git a/src/meta/types/src/errors/meta_api_errors.rs b/src/meta/types/src/errors/meta_api_errors.rs index e6e85a20c314..c34b8d4e7f6e 100644 --- a/src/meta/types/src/errors/meta_api_errors.rs +++ b/src/meta/types/src/errors/meta_api_errors.rs @@ -20,13 +20,13 @@ use tonic::Status; use crate::errors; use crate::raft_types::ChangeMembershipError; +use crate::raft_types::ClientWriteError; use crate::raft_types::Fatal; use crate::raft_types::ForwardToLeader; -use crate::ClientWriteError; +use crate::raft_types::RaftError; use crate::InvalidArgument; use crate::InvalidReply; use crate::MetaNetworkError; -use crate::RaftError; /// Errors raised when meta-service handling a request. #[derive(thiserror::Error, serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] diff --git a/src/meta/types/src/errors/meta_raft_errors.rs b/src/meta/types/src/errors/meta_raft_errors.rs index 356288e177d1..2af33338aeb9 100644 --- a/src/meta/types/src/errors/meta_raft_errors.rs +++ b/src/meta/types/src/errors/meta_raft_errors.rs @@ -18,9 +18,9 @@ pub use openraft::error::InProgress; pub use openraft::error::InitializeError; use crate::raft_types::ClientWriteError; +use crate::raft_types::RaftError; use crate::MetaDataError; use crate::MetaOperationError; -use crate::RaftError; // Collection of errors that occur when change membership on local raft node. pub type RaftChangeMembershipError = ClientWriteError; diff --git a/src/meta/types/src/errors/meta_startup_errors.rs b/src/meta/types/src/errors/meta_startup_errors.rs index dd4a0e91587b..f4836f2a3065 100644 --- a/src/meta/types/src/errors/meta_startup_errors.rs +++ b/src/meta/types/src/errors/meta_startup_errors.rs @@ -16,8 +16,8 @@ use anyerror::AnyError; use databend_common_meta_stoerr::MetaStorageError; use crate::raft_types::InitializeError; +use crate::raft_types::RaftError; use crate::MetaNetworkError; -use crate::RaftError; /// Error raised when meta-server startup. #[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)] diff --git a/src/meta/types/src/grpc_helper.rs b/src/meta/types/src/grpc_helper.rs index 6a1b5503df9a..3eba3851d84c 100644 --- a/src/meta/types/src/grpc_helper.rs +++ b/src/meta/types/src/grpc_helper.rs @@ -22,8 +22,8 @@ use tonic::metadata::MetadataValue; use crate::protobuf::RaftReply; use crate::protobuf::RaftRequest; +use crate::raft_types::RaftError; use crate::Endpoint; -use crate::RaftError; const HEADER_LEADER: &str = "x-databend-meta-leader-grpc-endpoint"; // const HEADER_LEADER_BIN: &str = "x-databend-meta-leader-grpc-endpoint-bin"; diff --git a/src/meta/types/src/lib.rs b/src/meta/types/src/lib.rs index 11af3e85e5f3..cead64922b6c 100644 --- a/src/meta/types/src/lib.rs +++ b/src/meta/types/src/lib.rs @@ -121,39 +121,3 @@ pub use crate::grpc_helper::GrpcHelper; pub use crate::non_empty::NonEmptyStr; pub use crate::non_empty::NonEmptyString; pub use crate::raft_snapshot_data::SnapshotData; -pub use crate::raft_types::new_log_id; -pub use crate::raft_types::AppendEntriesRequest; -pub use crate::raft_types::AppendEntriesResponse; -pub use crate::raft_types::ChangeMembershipError; -pub use crate::raft_types::ClientWriteError; -pub use crate::raft_types::CommittedLeaderId; -pub use crate::raft_types::Entry; -pub use crate::raft_types::EntryPayload; -pub use crate::raft_types::ErrorSubject; -pub use crate::raft_types::Fatal; -pub use crate::raft_types::ForwardToLeader; -pub use crate::raft_types::InstallSnapshotError; -pub use crate::raft_types::InstallSnapshotRequest; -pub use crate::raft_types::InstallSnapshotResponse; -pub use crate::raft_types::LogId; -pub use crate::raft_types::LogIndex; -pub use crate::raft_types::Membership; -pub use crate::raft_types::MembershipNode; -pub use crate::raft_types::NetworkError; -pub use crate::raft_types::NodeId; -pub use crate::raft_types::RPCError; -pub use crate::raft_types::RaftError; -pub use crate::raft_types::RaftMetrics; -pub use crate::raft_types::RemoteError; -pub use crate::raft_types::Snapshot; -pub use crate::raft_types::SnapshotMeta; -pub use crate::raft_types::SnapshotMismatch; -pub use crate::raft_types::SnapshotResponse; -pub use crate::raft_types::StorageError; -pub use crate::raft_types::StoredMembership; -pub use crate::raft_types::StreamingError; -pub use crate::raft_types::Term; -pub use crate::raft_types::TypeConfig; -pub use crate::raft_types::Vote; -pub use crate::raft_types::VoteRequest; -pub use crate::raft_types::VoteResponse; diff --git a/src/meta/types/src/proto_ext/raft_types_ext.rs b/src/meta/types/src/proto_ext/raft_types_ext.rs index 3588dca6645d..6c9bc72a398e 100644 --- a/src/meta/types/src/proto_ext/raft_types_ext.rs +++ b/src/meta/types/src/proto_ext/raft_types_ext.rs @@ -42,7 +42,7 @@ mod log_id_impls { use crate::protobuf as pb; use crate::raft_types; - use crate::CommittedLeaderId; + use crate::raft_types::CommittedLeaderId; impl From for pb::LogId { fn from(log_id: raft_types::LogId) -> Self { diff --git a/src/meta/types/src/proto_ext/snapshot_chunk_request_ext.rs b/src/meta/types/src/proto_ext/snapshot_chunk_request_ext.rs index 3fcd4331f566..c438de3191bc 100644 --- a/src/meta/types/src/proto_ext/snapshot_chunk_request_ext.rs +++ b/src/meta/types/src/proto_ext/snapshot_chunk_request_ext.rs @@ -18,10 +18,10 @@ use crate::protobuf::SnapshotChunkRequest; use crate::protobuf::SnapshotChunkRequestV003; use crate::protobuf::SnapshotChunkV1; use crate::protobuf::SnapshotResponseV003; -use crate::InstallSnapshotRequest; -use crate::NetworkError; -use crate::SnapshotMeta; -use crate::Vote; +use crate::raft_types::InstallSnapshotRequest; +use crate::raft_types::NetworkError; +use crate::raft_types::SnapshotMeta; +use crate::raft_types::Vote; impl SnapshotChunkRequest { /// Return the length of the data in the chunk. diff --git a/src/meta/types/src/proto_ext/transfer_leader_request_ext.rs b/src/meta/types/src/proto_ext/transfer_leader_request_ext.rs index 2a448d4af665..69f763f3e543 100644 --- a/src/meta/types/src/proto_ext/transfer_leader_request_ext.rs +++ b/src/meta/types/src/proto_ext/transfer_leader_request_ext.rs @@ -16,7 +16,7 @@ use tonic::Status; use crate::protobuf as pb; use crate::raft_types::TransferLeaderRequest; -use crate::Vote; +use crate::raft_types::Vote; impl From for pb::TransferLeaderRequest { fn from(req: TransferLeaderRequest) -> Self { diff --git a/src/meta/types/src/snapshot_db.rs b/src/meta/types/src/snapshot_db.rs index dcf17e6e34ab..5c79a97bdc74 100644 --- a/src/meta/types/src/snapshot_db.rs +++ b/src/meta/types/src/snapshot_db.rs @@ -23,8 +23,8 @@ use rotbl::v001::stat::RotblStat; use rotbl::v001::Rotbl; use rotbl::v001::SeqMarked; +use crate::raft_types::SnapshotMeta; use crate::sys_data::SysData; -use crate::SnapshotMeta; /// A readonly leveled map that owns the data. #[derive(Debug, Clone)] diff --git a/src/meta/types/src/sys_data.rs b/src/meta/types/src/sys_data.rs index 338287e1dcc8..fd1e82ee3bb1 100644 --- a/src/meta/types/src/sys_data.rs +++ b/src/meta/types/src/sys_data.rs @@ -16,10 +16,10 @@ use std::collections::BTreeMap; use log::debug; -use crate::LogId; +use crate::raft_types::LogId; +use crate::raft_types::NodeId; +use crate::raft_types::StoredMembership; use crate::Node; -use crate::NodeId; -use crate::StoredMembership; /// Snapshot System data(non-user data). ///