From 097f0acb85d4876f07471147e49cb847c6e4702f Mon Sep 17 00:00:00 2001 From: Dom Dwyer Date: Mon, 21 Nov 2022 16:11:55 +0100 Subject: [PATCH] refactor: move SequenceNumberRange Moves the SequenceNumberRange type out of "data" and into the root to be reused outside of the data module. This construct is universally useful across all the ingester code. --- ingester/src/data.rs | 3 --- ingester/src/data/partition.rs | 6 ++++-- ingester/src/data/partition/buffer.rs | 4 ++-- ingester/src/data/partition/buffer/state_machine.rs | 2 +- ingester/src/lib.rs | 1 + ingester/src/{data => }/sequence_range.rs | 0 6 files changed, 8 insertions(+), 8 deletions(-) rename ingester/src/{data => }/sequence_range.rs (100%) diff --git a/ingester/src/data.rs b/ingester/src/data.rs index 773623e3b9..6aeccfb2da 100644 --- a/ingester/src/data.rs +++ b/ingester/src/data.rs @@ -32,12 +32,9 @@ use write_summary::ShardProgress; pub(crate) mod namespace; pub mod partition; -mod sequence_range; pub(crate) mod shard; pub(crate) mod table; -pub(crate) use sequence_range::*; - use self::{ namespace::name_resolver::{NamespaceNameProvider, NamespaceNameResolver}, partition::resolver::{CatalogPartitionResolver, PartitionCache, PartitionProvider}, diff --git a/ingester/src/data/partition.rs b/ingester/src/data/partition.rs index b6484016bb..79c6200896 100644 --- a/ingester/src/data/partition.rs +++ b/ingester/src/data/partition.rs @@ -10,9 +10,11 @@ use thiserror::Error; use write_summary::ShardProgress; use self::buffer::{traits::Queryable, BufferState, DataBuffer, Persisting}; -use crate::{deferred_load::DeferredLoad, query_adaptor::QueryAdaptor}; +use crate::{ + deferred_load::DeferredLoad, query_adaptor::QueryAdaptor, sequence_range::SequenceNumberRange, +}; -use super::{sequence_range::SequenceNumberRange, table::TableName}; +use super::table::TableName; mod buffer; pub mod resolver; diff --git a/ingester/src/data/partition/buffer.rs b/ingester/src/data/partition/buffer.rs index 00e6f376ba..0cf3aad411 100644 --- a/ingester/src/data/partition/buffer.rs +++ b/ingester/src/data/partition/buffer.rs @@ -4,8 +4,6 @@ use arrow::record_batch::RecordBatch; use data_types::SequenceNumber; use mutable_batch::MutableBatch; -use crate::data::SequenceNumberRange; - mod always_some; mod mutable_buffer; mod state_machine; @@ -13,6 +11,8 @@ pub(crate) mod traits; pub(crate) use state_machine::*; +use crate::sequence_range::SequenceNumberRange; + use self::{always_some::AlwaysSome, traits::Queryable}; /// The current state of the [`BufferState`] state machine. diff --git a/ingester/src/data/partition/buffer/state_machine.rs b/ingester/src/data/partition/buffer/state_machine.rs index 3d28f23ec2..c09d3ba550 100644 --- a/ingester/src/data/partition/buffer/state_machine.rs +++ b/ingester/src/data/partition/buffer/state_machine.rs @@ -12,7 +12,7 @@ mod snapshot; pub(in crate::data::partition::buffer) use buffering::*; pub(crate) use persisting::*; -use crate::data::SequenceNumberRange; +use crate::sequence_range::SequenceNumberRange; use super::traits::{Queryable, Writeable}; diff --git a/ingester/src/lib.rs b/ingester/src/lib.rs index 9dd8ae0111..8680b56f59 100644 --- a/ingester/src/lib.rs +++ b/ingester/src/lib.rs @@ -28,6 +28,7 @@ pub mod lifecycle; mod poison; pub mod querier_handler; pub(crate) mod query_adaptor; +mod sequence_range; pub mod server; pub(crate) mod stream_handler; #[cfg(test)] diff --git a/ingester/src/data/sequence_range.rs b/ingester/src/sequence_range.rs similarity index 100% rename from ingester/src/data/sequence_range.rs rename to ingester/src/sequence_range.rs