jiacai2050 commented on code in PR #1554: URL: https://github.com/apache/horaedb/pull/1554#discussion_r1753538736
########## horaedb/metric_engine/src/storage.rs: ########## @@ -0,0 +1,96 @@ +// 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. + +use arrow::{array::RecordBatch, datatypes::Schema}; +use async_trait::async_trait; + +use crate::{ + manifest::Manifest, + sst::SSTable, + types::{ObjectStoreRef, Predicate, SendableRecordBatchStream, TimeRange}, + Result, +}; + +pub struct CompactContext {} +pub struct WriteContext {} +pub struct ScanContext {} + +/// Time-aware merge storage interface. +#[async_trait] +pub trait TimeMergeStorage { + fn schema(&self) -> Result<&Schema>; + + async fn write(&self, ctx: &WriteContext, batch: RecordBatch) -> Result<()>; + + /// Implementation shoule ensure that the returned stream is sorted by time, + /// from old to latest. + async fn scan( + &self, + ctx: &ScanContext, + range: TimeRange, + predicates: Vec<Predicate>, Review Comment: > Seems time range is a predicate. TimeRange is special predicate, it must be included in every request. > And I think maybe we can just process the filter and projection by reusing realted fileds in old `ReadRequest`? No code reuse for now. > It seems not sure, may just define a empty `ScanRequest` in this sketch. The current one show basic usage, if we leave empty here, other dev have no idea what the query looks like. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
