use crate::bridge::envelope::{ErrorCode, Response};
use crate::data::executor::core_loop::CoreLoop;
use crate::data::executor::task::ExecutionTask;
impl CoreLoop {
pub(in crate::data::executor) fn execute_rename_collection(
&mut self,
task: &ExecutionTask,
tenant_id: u64,
old_collection: &str,
new_collection: &str,
) -> Response {
if let Err(e) = self
.sparse
.rename_collection(tenant_id, old_collection, new_collection)
{
return self.response_error(
task,
ErrorCode::Internal {
detail: format!(
"rename_collection sparse ({old_collection} -> {new_collection}): {e}"
),
},
);
}
self.kv_engine
.rename_collection(tenant_id, old_collection, new_collection);
self.response_ok(task)
}
}