tonbo-io / tonbo

A portable embedded database using Arrow.
https://tonbo.io
Apache License 2.0
764 stars 42 forks source link

[Draft] Isolate range param lifetime from `self` in `Transaction::scan` #135

Open ethe opened 2 months ago

ethe commented 2 months ago

Tonbo does not support this:

let mut scan = txn
    .scan((Bound::Included(&"Alice".into()), Bound::Excluded(&"Blob".into())))
    .await
    // tonbo supports pushing down projection
    .projection(vec![1])
    .take()
    .await
    .unwrap();

I think it because we define scan method like this:

fn scan<'scan>(
        &'scan self,
        range: (Bound<&'scan R::Key>, Bound<&'scan R::Key>),
    ) -> Scan<'scan, R, FP>

Modifying type declaration might be helpful to support it:

fn scan<'scan, 'range>(
        &'scan self,
        range: (Bound<&'range R::Key>, Bound<&'range R::Key>),
    ) -> Scan<'scan, 'range, R, FP>