Skip to content

Commit

Permalink
move ErrorKind to crate level
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Apr 26, 2024
1 parent dffcc3b commit 67ae013
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
23 changes: 23 additions & 0 deletions src/analytic_engine/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

/// Global Error type for analytic engine.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum ErrorKind {
KeyTooLarge,
Internal,
}
2 changes: 1 addition & 1 deletion src/analytic_engine/src/instance/wal_replayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ use crate::{
serial_executor::TableOpSerialExecutor,
write::{Error as WriteError, MemTableWriter},
},
memtable::error::ErrorKind,
payload::{ReadPayload, SingleSchemaProviderAdapter, TableSchemaProvider, WalDecoder},
table::data::TableDataRef,
ErrorKind,
};

// Metrics of wal replayer
Expand Down
2 changes: 2 additions & 0 deletions src/analytic_engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
mod compaction;
mod context;
mod engine;
pub mod error;
mod instance;
mod manifest;
pub mod memtable;
Expand All @@ -39,6 +40,7 @@ pub mod table_meta_set_impl;
#[cfg(any(test, feature = "test"))]
pub mod tests;

use error::ErrorKind;
use manifest::details::Options as ManifestOptions;
use object_store::config::StorageOptions;
use serde::{Deserialize, Serialize};
Expand Down
8 changes: 2 additions & 6 deletions src/analytic_engine/src/memtable/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

use thiserror::Error;

use crate::ErrorKind;

#[derive(Debug, Error)]
#[error(transparent)]
pub struct Error(#[from] InnerError);
Expand All @@ -27,12 +29,6 @@ impl From<anyhow::Error> for Error {
}
}

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum ErrorKind {
KeyTooLarge,
Internal,
}

impl Error {
pub fn kind(&self) -> ErrorKind {
match self.0 {
Expand Down
2 changes: 1 addition & 1 deletion src/analytic_engine/src/memtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use common_types::{
time::TimeRange,
SequenceNumber, MUTABLE_SEGMENT_SWITCH_THRESHOLD,
};
pub use error::{Error, ErrorKind};
pub use error::Error;
use horaedbproto::manifest;
use macros::define_result;
use serde::{Deserialize, Serialize};
Expand Down

0 comments on commit 67ae013

Please sign in to comment.