Skip to content

Commit

Permalink
use derive_from_json_struct
Browse files Browse the repository at this point in the history
  • Loading branch information
zwang28 committed Nov 1, 2023
1 parent 883c07d commit 451726f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/meta/model_v2/src/compaction_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}

#[derive(Clone, Debug, PartialEq, Eq, FromJsonQueryResult, Serialize, Deserialize, Default)]
pub struct CompactionConfig(pub PbCompactionConfig);
crate::derive_from_json_struct!(CompactionConfig, PbCompactionConfig);
3 changes: 1 addition & 2 deletions src/meta/model_v2/src/compaction_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}

#[derive(Clone, Debug, PartialEq, Eq, FromJsonQueryResult, Serialize, Deserialize, Default)]
pub struct LevelHandlers(pub Vec<PbLevelHandler>);
crate::derive_from_json_struct!(LevelHandlers, Vec<PbLevelHandler>);
3 changes: 1 addition & 2 deletions src/meta/model_v2/src/compaction_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}

#[derive(Clone, Debug, PartialEq, Eq, FromJsonQueryResult, Serialize, Deserialize, Default)]
pub struct CompactionTask(pub PbCompactTask);
crate::derive_from_json_struct!(CompactionTask, PbCompactTask);

impl From<Model> for CompactTaskAssignment {
fn from(value: Model) -> Self {
Expand Down
6 changes: 2 additions & 4 deletions src/meta/model_v2/src/hummock_version_delta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}

#[derive(Clone, Debug, PartialEq, Eq, FromJsonQueryResult, Serialize, Deserialize, Default)]
pub struct SstableObjectIds(pub Vec<HummockSstableObjectId>);
crate::derive_from_json_struct!(SstableObjectIds, Vec<HummockSstableObjectId>);

#[derive(Clone, Debug, PartialEq, Eq, FromJsonQueryResult, Serialize, Deserialize, Default)]
pub struct GroupDeltas(pub HashMap<CompactionGroupId, Vec<PbGroupDelta>>);
crate::derive_from_json_struct!(GroupDeltas, HashMap<CompactionGroupId, Vec<PbGroupDelta>>);

impl From<Model> for HummockVersionDelta {
fn from(value: Model) -> Self {
Expand Down
2 changes: 2 additions & 0 deletions src/meta/model_v2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ macro_rules! derive_from_json_struct {
};
}

pub(crate) use derive_from_json_struct;

derive_from_json_struct!(I32Array, Vec<i32>);
derive_from_json_struct!(U32Array, Vec<u32>);

Expand Down
3 changes: 1 addition & 2 deletions src/meta/src/backup_restore/meta_snapshot_builder_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(dead_code)]
#![allow(unused_variables)]
#![expect(dead_code, reason = "WIP")]

use std::future::Future;

Expand Down

0 comments on commit 451726f

Please sign in to comment.