Skip to content

Commit

Permalink
rename iterator to HummockJavaBindingIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
wenym1 committed Mar 15, 2023
1 parent c4a6e9d commit 5cfd57b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn select_all_vnode_stream(
select_all(streams.into_iter().map(Box::pin))
}

pub struct Iterator {
pub struct HummockJavaBindingIterator {
row_serde: EitherSerde,
stream: SelectAllIterStream,
}
Expand All @@ -67,7 +67,7 @@ impl KeyedRow {
}
}

impl Iterator {
impl HummockJavaBindingIterator {
pub async fn new(read_plan: ReadPlan) -> StorageResult<Self> {
// Note(bugen): should we forward the implementation to the `StorageTable`?
let object_store = Arc::new(
Expand Down
12 changes: 6 additions & 6 deletions src/java_binding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![feature(once_cell)]
#![feature(type_alias_impl_trait)]

mod iterator;
mod hummock_iterator;
mod stream_chunk_iterator;

use std::backtrace::Backtrace;
Expand All @@ -27,7 +27,7 @@ use std::panic::catch_unwind;
use std::slice::from_raw_parts;
use std::sync::LazyLock;

use iterator::{Iterator, KeyedRow};
use hummock_iterator::{HummockJavaBindingIterator, KeyedRow};
use jni::objects::{AutoArray, JClass, JObject, JString, ReleaseMode};
use jni::sys::{jboolean, jbyte, jbyteArray, jdouble, jfloat, jint, jlong, jshort};
use jni::JNIEnv;
Expand Down Expand Up @@ -264,18 +264,18 @@ pub extern "system" fn Java_com_risingwave_java_binding_Binding_vnodeCount(
pub extern "system" fn Java_com_risingwave_java_binding_Binding_hummockIteratorNew<'a>(
env: EnvParam<'a>,
read_plan: JByteArray<'a>,
) -> Pointer<'static, Iterator> {
) -> Pointer<'static, HummockJavaBindingIterator> {
execute_and_catch(env, move || {
let read_plan = Message::decode(read_plan.to_guarded_slice(*env)?.deref())?;
let iter = RUNTIME.block_on(Iterator::new(read_plan))?;
let iter = RUNTIME.block_on(HummockJavaBindingIterator::new(read_plan))?;
Ok(iter.into())
})
}

#[no_mangle]
pub extern "system" fn Java_com_risingwave_java_binding_Binding_hummockIteratorNext<'a>(
env: EnvParam<'a>,
mut pointer: Pointer<'a, Iterator>,
mut pointer: Pointer<'a, HummockJavaBindingIterator>,
) -> Pointer<'static, JavaBindingRow> {
execute_and_catch(env, move || {
match RUNTIME.block_on(pointer.as_mut().next())? {
Expand All @@ -288,7 +288,7 @@ pub extern "system" fn Java_com_risingwave_java_binding_Binding_hummockIteratorN
#[no_mangle]
pub extern "system" fn Java_com_risingwave_java_binding_Binding_hummockIteratorClose(
_env: EnvParam<'_>,
pointer: Pointer<'_, Iterator>,
pointer: Pointer<'_, HummockJavaBindingIterator>,
) {
pointer.drop();
}
Expand Down

0 comments on commit 5cfd57b

Please sign in to comment.