mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 17:24:21 +01:00
Merge 'Clean up conversion between InsnFunctionStepResult and StepResult' from Diego Reis
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #2332
This commit is contained in:
@@ -123,6 +123,18 @@ pub enum InsnFunctionStepResult {
|
||||
Step,
|
||||
}
|
||||
|
||||
impl From<StepResult> for InsnFunctionStepResult {
|
||||
fn from(value: StepResult) -> Self {
|
||||
match value {
|
||||
super::StepResult::Done => Self::Done,
|
||||
super::StepResult::IO => Self::IO,
|
||||
super::StepResult::Row => Self::Row,
|
||||
super::StepResult::Interrupt => Self::Interrupt,
|
||||
super::StepResult::Busy => Self::Busy,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn op_init(
|
||||
_program: &Program,
|
||||
state: &mut ProgramState,
|
||||
@@ -2035,13 +2047,9 @@ pub fn op_auto_commit(
|
||||
};
|
||||
let conn = program.connection.clone();
|
||||
if state.commit_state == CommitState::Committing {
|
||||
return match program.commit_txn(pager.clone(), state, mv_store, *rollback)? {
|
||||
super::StepResult::Done => Ok(InsnFunctionStepResult::Done),
|
||||
super::StepResult::IO => Ok(InsnFunctionStepResult::IO),
|
||||
super::StepResult::Row => Ok(InsnFunctionStepResult::Row),
|
||||
super::StepResult::Interrupt => Ok(InsnFunctionStepResult::Interrupt),
|
||||
super::StepResult::Busy => Ok(InsnFunctionStepResult::Busy),
|
||||
};
|
||||
return program
|
||||
.commit_txn(pager.clone(), state, mv_store, *rollback)
|
||||
.map(Into::into);
|
||||
}
|
||||
let schema_did_change =
|
||||
if let TransactionState::Write { schema_did_change } = conn.transaction_state.get() {
|
||||
@@ -2071,13 +2079,9 @@ pub fn op_auto_commit(
|
||||
"cannot commit - no transaction is active".to_string(),
|
||||
));
|
||||
}
|
||||
match program.commit_txn(pager.clone(), state, mv_store, *rollback)? {
|
||||
super::StepResult::Done => Ok(InsnFunctionStepResult::Done),
|
||||
super::StepResult::IO => Ok(InsnFunctionStepResult::IO),
|
||||
super::StepResult::Row => Ok(InsnFunctionStepResult::Row),
|
||||
super::StepResult::Interrupt => Ok(InsnFunctionStepResult::Interrupt),
|
||||
super::StepResult::Busy => Ok(InsnFunctionStepResult::Busy),
|
||||
}
|
||||
program
|
||||
.commit_txn(pager.clone(), state, mv_store, *rollback)
|
||||
.map(Into::into)
|
||||
}
|
||||
|
||||
pub fn op_goto(
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//! The instruction set of the VDBE is similar to SQLite's instruction set,
|
||||
//! but with the exception that bytecodes that perform I/O operations are
|
||||
//! return execution back to the caller instead of blocking. This is because
|
||||
//! Limbo is designed for applications that need high concurrency such as
|
||||
//! Turso is designed for applications that need high concurrency such as
|
||||
//! serverless runtimes. In addition, asynchronous I/O makes storage
|
||||
//! disaggregation easier.
|
||||
//!
|
||||
|
||||
Reference in New Issue
Block a user