Unverified Commit cd18cf2e authored by Tianer Zhou's avatar Tianer Zhou Committed by GitHub
Browse files

chore: fix spelling (#1434)


Signed-off-by: default avatarTianer Zhou <ezhoureal@gmail.com>
Co-authored-by: default avatarYan Ru Pei <yanrpei@gmail.com>
parent 68e4d2c1
......@@ -263,14 +263,14 @@ pub(crate) trait PrivateBlockExt {
fn register(
&mut self,
registry: &mut registry::BlockRegistry,
) -> Result<Option<PublishHandle>, registry::BlockRegistationError>;
) -> Result<Option<PublishHandle>, registry::BlockRegistrationError>;
}
impl<S: Storage, M: BlockMetadata> PrivateBlockExt for Block<S, M> {
fn register(
&mut self,
registry: &mut registry::BlockRegistry,
) -> Result<Option<PublishHandle>, registry::BlockRegistationError> {
) -> Result<Option<PublishHandle>, registry::BlockRegistrationError> {
registry.register_block(&mut self.state)
}
}
......
......@@ -47,7 +47,7 @@ use tokio::{runtime::Handle, sync::mpsc};
pub type GlobalRegistry = Arc<Mutex<HashMap<SequenceHash, Weak<RegistrationHandle>>>>;
#[derive(Debug, thiserror::Error)]
pub enum BlockRegistationError {
pub enum BlockRegistrationError {
#[error("Block already registered")]
BlockAlreadyRegistered(SequenceHash),
......@@ -147,12 +147,12 @@ impl BlockRegistry {
pub fn register_block(
&mut self,
block_state: &mut BlockState,
) -> Result<Option<PublishHandle>, BlockRegistationError> {
) -> Result<Option<PublishHandle>, BlockRegistrationError> {
match block_state {
BlockState::Reset => Err(BlockRegistationError::InvalidState(
BlockState::Reset => Err(BlockRegistrationError::InvalidState(
"Block is in Reset state".to_string(),
)),
BlockState::Partial(_partial) => Err(BlockRegistationError::InvalidState(
BlockState::Partial(_partial) => Err(BlockRegistrationError::InvalidState(
"Block is in Partial state".to_string(),
)),
......@@ -163,7 +163,9 @@ impl BlockRegistry {
// If an identical block already exists in this pool, return an error.
if let Some(handle) = blocks.get(&sequence_hash) {
if let Some(_handle) = handle.upgrade() {
return Err(BlockRegistationError::BlockAlreadyRegistered(sequence_hash));
return Err(BlockRegistrationError::BlockAlreadyRegistered(
sequence_hash,
));
}
}
......@@ -207,7 +209,7 @@ impl BlockRegistry {
Ok(publish_handle)
}
BlockState::Registered(registered, _) => Err(
BlockRegistationError::BlockAlreadyRegistered(registered.sequence_hash()),
BlockRegistrationError::BlockAlreadyRegistered(registered.sequence_hash()),
),
}
}
......
......@@ -14,7 +14,7 @@
// limitations under the License.
use crate::block_manager::{
block::{registry::BlockRegistationError, BlockState, PrivateBlockExt},
block::{registry::BlockRegistrationError, BlockState, PrivateBlockExt},
events::Publisher,
};
......@@ -175,7 +175,7 @@ impl<S: Storage, M: BlockMetadata> State<S, M> {
}
block
}
Err(BlockRegistationError::BlockAlreadyRegistered(_)) => {
Err(BlockRegistrationError::BlockAlreadyRegistered(_)) => {
// Block is already registered, wait for it to be returned
offload = false;
let raw_block =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment