pub struct RowNumberProvider { /* private fields */ }Expand description
Provides stable encoded numbers for keys with automatic Insert/Update detection
This component maintains:
- A sequential counter for generating new encoded numbers
- A mapping from keys to their assigned encoded numbers
When a key is seen for the first time, it gets a new encoded number and returns true. When a key is seen again, it returns the existing encoded number and false.
Implementations§
Source§impl RowNumberProvider
impl RowNumberProvider
Sourcepub fn new(node: FlowNodeId) -> Self
pub fn new(node: FlowNodeId) -> Self
Create a new RowNumberProvider for the given operator
Sourcepub async fn get_or_create_row_numbers_batch<'a, I>(
&self,
txn: &mut FlowTransaction,
keys: I,
) -> Result<Vec<(RowNumber, bool)>>where
I: IntoIterator<Item = &'a EncodedKey>,
pub async fn get_or_create_row_numbers_batch<'a, I>(
&self,
txn: &mut FlowTransaction,
keys: I,
) -> Result<Vec<(RowNumber, bool)>>where
I: IntoIterator<Item = &'a EncodedKey>,
Get or create RowNumbers for a batch of keys Returns Vec<(RowNumber, is_new)> in the same order as input keys where is_new indicates if the row number was newly created
Sourcepub async fn get_or_create_row_number(
&self,
txn: &mut FlowTransaction,
key: &EncodedKey,
) -> Result<(RowNumber, bool)>
pub async fn get_or_create_row_number( &self, txn: &mut FlowTransaction, key: &EncodedKey, ) -> Result<(RowNumber, bool)>
Get or create a RowNumber for a given key Returns (RowNumber, is_new) where is_new indicates if it was newly created
Sourcepub async fn get_key_for_row_number(
&self,
txn: &mut FlowTransaction,
row_number: RowNumber,
) -> Result<Option<EncodedKey>>
pub async fn get_key_for_row_number( &self, txn: &mut FlowTransaction, row_number: RowNumber, ) -> Result<Option<EncodedKey>>
Get the original key for a given row number (reverse lookup)
Sourcepub async fn remove_by_prefix(
&self,
txn: &mut FlowTransaction,
key_prefix: &[u8],
) -> Result<()>
pub async fn remove_by_prefix( &self, txn: &mut FlowTransaction, key_prefix: &[u8], ) -> Result<()>
Remove all encoded number mappings with the given prefix This is useful for cleaning up all join results from a specific left encoded