(
&self,
task: &ExecutionTask,
tid: u64,
collection: &str,
keys: &[Vec<u8>],
)
| 12 | |
| 13 | impl CoreLoop { |
| 14 | pub(in crate::data::executor) fn execute_kv_batch_get( |
| 15 | &self, |
| 16 | task: &ExecutionTask, |
| 17 | tid: u64, |
| 18 | collection: &str, |
| 19 | keys: &[Vec<u8>], |
| 20 | ) -> Response { |
| 21 | debug!(core = self.core_id, %collection, count = keys.len(), "kv batch get"); |
| 22 | let now_ms = current_ms(); |
| 23 | let results = self.kv_engine.batch_get(tid, collection, keys, now_ms); |
| 24 | |
| 25 | let json_results: Vec<serde_json::Value> = results |
| 26 | .into_iter() |
| 27 | .map(|opt| match opt { |
| 28 | Some(v) => serde_json::Value::String(base64::Engine::encode( |
| 29 | &base64::engine::general_purpose::STANDARD, |
| 30 | &v, |
| 31 | )), |
| 32 | None => serde_json::Value::Null, |
| 33 | }) |
| 34 | .collect(); |
| 35 | match response_codec::encode_json_vec(&json_results) { |
| 36 | Ok(payload) => self.response_with_payload(task, payload), |
| 37 | Err(e) => self.response_error( |
| 38 | task, |
| 39 | ErrorCode::Internal { |
| 40 | detail: e.to_string(), |
| 41 | }, |
| 42 | ), |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | pub(in crate::data::executor) fn execute_kv_batch_put( |
| 47 | &mut self, |
no test coverage detected