From 243f39f473c5c570174da3b57191ed2d85d22cdf Mon Sep 17 00:00:00 2001 From: Georgy Moshkin <gmoshkin@picodata.io> Date: Mon, 5 Dec 2022 14:27:52 +0300 Subject: [PATCH] chore: ProperyName -> PropertyName --- src/main.rs | 13 ++++++++----- src/storage.rs | 14 +++++++------- src/traft/node.rs | 6 +++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main.rs b/src/main.rs index 91d3e8091f..7fd0c293f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use ::tarantool::transaction::start_transaction; use std::convert::TryFrom; use std::time::{Duration, Instant}; use storage::Clusterwide; -use storage::{ClusterwideSpace, ProperyName}; +use storage::{ClusterwideSpace, PropertyName}; use traft::rpc; use traft::rpc::{join, update_instance}; use traft::RaftSpaceAccess; @@ -387,7 +387,7 @@ fn picolib_setup(args: &args::Run) { tlua::function1(|id: u64| -> traft::Result<()> { let op = OpDML::replace( ClusterwideSpace::Property, - &(ProperyName::DesiredSchemaVersion, id), + &(PropertyName::DesiredSchemaVersion, id), )?; node::global()?.propose_and_wait(op, Duration::MAX)??; Ok(()) @@ -404,7 +404,7 @@ fn picolib_setup(args: &args::Run) { }; let op = OpDML::replace( ClusterwideSpace::Property, - &(ProperyName::DesiredSchemaVersion, id), + &(PropertyName::DesiredSchemaVersion, id), )?; node.propose_and_wait(op, Duration::MAX)??; event::wait(Event::MigrateDone) @@ -814,7 +814,10 @@ fn start_boot(args: &args::Run) { init_entries_push_op( OpDML::insert( ClusterwideSpace::Property, - &(ProperyName::ReplicationFactor, args.init_replication_factor), + &( + PropertyName::ReplicationFactor, + args.init_replication_factor, + ), ) .expect("cannot fail") .into(), @@ -822,7 +825,7 @@ fn start_boot(args: &args::Run) { init_entries_push_op( OpDML::insert( ClusterwideSpace::Property, - &(ProperyName::DesiredSchemaVersion, 0), + &(PropertyName::DesiredSchemaVersion, 0), ) .expect("cannot fail") .into(), diff --git a/src/storage.rs b/src/storage.rs index 778db795d0..3f81305ab9 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -65,12 +65,12 @@ impl ClusterwideSpace { } //////////////////////////////////////////////////////////////////////////////// -// ProperyName +// PropertyName //////////////////////////////////////////////////////////////////////////////// ::tarantool::define_str_enum! { /// An enumeration of [`ClusterwideSpace::Property`] key names. - pub enum ProperyName { + pub enum PropertyName { ReplicationFactor = "replication_factor", VshardBootstrapped = "vshard_bootstrapped", DesiredSchemaVersion = "desired_schema_version", @@ -136,7 +136,7 @@ impl State { } #[inline] - pub fn get<T>(&self, key: ProperyName) -> tarantool::Result<Option<T>> + pub fn get<T>(&self, key: PropertyName) -> tarantool::Result<Option<T>> where T: DecodeOwned, { @@ -148,7 +148,7 @@ impl State { #[allow(dead_code)] #[inline] - pub fn put(&self, key: ProperyName, value: &impl serde::Serialize) -> tarantool::Result<()> { + pub fn put(&self, key: PropertyName, value: &impl serde::Serialize) -> tarantool::Result<()> { self.space.put(&(key, value))?; Ok(()) } @@ -156,14 +156,14 @@ impl State { #[inline] pub fn vshard_bootstrapped(&self) -> tarantool::Result<bool> { Ok(self - .get(ProperyName::VshardBootstrapped)? + .get(PropertyName::VshardBootstrapped)? .unwrap_or_default()) } #[inline] pub fn replication_factor(&self) -> tarantool::Result<usize> { let res = self - .get(ProperyName::ReplicationFactor)? + .get(PropertyName::ReplicationFactor)? .expect("replication_factor must be set at boot"); Ok(res) } @@ -171,7 +171,7 @@ impl State { #[inline] pub fn desired_schema_version(&self) -> tarantool::Result<u64> { let res = self - .get(ProperyName::DesiredSchemaVersion)? + .get(PropertyName::DesiredSchemaVersion)? .unwrap_or_default(); Ok(res) } diff --git a/src/traft/node.rs b/src/traft/node.rs index b21f029637..c6f3fa244b 100644 --- a/src/traft/node.rs +++ b/src/traft/node.rs @@ -31,7 +31,7 @@ use crate::governor::raft_conf_change; use crate::governor::waiting_migrations; use crate::kvcell::KVCell; use crate::r#loop::{FlowControl, Loop}; -use crate::storage::{Clusterwide, ClusterwideSpace, ProperyName}; +use crate::storage::{Clusterwide, ClusterwideSpace, PropertyName}; use crate::stringify_cfunc; use crate::traft::rpc; use crate::traft::ContextCoercion as _; @@ -390,7 +390,7 @@ impl NodeImpl { let replication_factor = self .storage .state - .get(ProperyName::ReplicationFactor)? + .get(PropertyName::ReplicationFactor)? .ok_or_else(|| Error::other("missing replication_factor value in storage"))?; Topology::from_instances(instances).with_replication_factor(replication_factor) } @@ -1377,7 +1377,7 @@ fn raft_conf_change_loop( node.propose_and_wait( traft::OpDML::replace( ClusterwideSpace::Property, - &(ProperyName::VshardBootstrapped, true), + &(PropertyName::VshardBootstrapped, true), )?, // TODO: don't hard code the timeout Duration::from_secs(3), -- GitLab