use cheetah_string::CheetahString;
use rocketmq_common::common::attribute::cq_type::CQType;
use rocketmq_common::common::boundary_type::BoundaryType;
use rocketmq_common::common::message::message_ext_broker_inner::MessageExtBrokerInner;
use crate::base::dispatch_request::DispatchRequest;
use crate::filter::MessageFilter;
use crate::queue::file_queue_life_cycle::FileQueueLifeCycle;
use crate::queue::queue_offset_operator::QueueOffsetOperator;
use crate::queue::CqUnit;
pub trait ConsumeQueueTrait: FileQueueLifeCycle {
fn get_topic(&self) -> &CheetahString;
fn get_queue_id(&self) -> i32;
fn iterate_from(&self, start_index: i64) -> Option<Box<dyn Iterator<Item = CqUnit> + Send + '_>>;
fn iterate_from_with_count(
&self,
start_index: i64,
count: i32,
) -> Option<Box<dyn Iterator<Item = CqUnit> + Send + '_>>;
fn get(&self, index: i64) -> Option<CqUnit>;
fn get_cq_unit_and_store_time(&self, index: i64) -> Option<(CqUnit, i64)>;
fn get_earliest_unit_and_store_time(&self) -> Option<(CqUnit, i64)>;
fn get_earliest_unit(&self) -> Option<CqUnit>;
fn get_latest_unit(&self) -> Option<CqUnit>;
fn get_last_offset(&self) -> i64;
fn get_min_offset_in_queue(&self) -> i64;
fn get_max_offset_in_queue(&self) -> i64;
fn get_message_total_in_queue(&self) -> i64;
fn get_offset_in_queue_by_time(&self, timestamp: i64) -> i64;
fn get_offset_in_queue_by_time_with_boundary(&self, timestamp: i64, boundary_type: BoundaryType) -> i64;
fn get_max_physic_offset(&self) -> i64;
fn get_min_logic_offset(&self) -> i64;
fn get_cq_type(&self) -> CQType;
fn get_total_size(&self) -> i64;
fn get_unit_size(&self) -> i32;
fn correct_min_offset(&self, min_commit_log_offset: i64);
fn put_message_position_info_wrapper(&mut self, request: &DispatchRequest);
fn assign_queue_offset(&self, queue_offset_assigner: &QueueOffsetOperator, msg: &mut MessageExtBrokerInner);
fn increase_queue_offset(
&self,
queue_offset_assigner: &QueueOffsetOperator,
msg: &MessageExtBrokerInner,
message_num: i16,
);
fn estimate_message_count(&self, from: i64, to: i64, filter: &dyn MessageFilter) -> i64;
}