(
&mut self,
task: &ExecutionTask,
array_id: &ArrayId,
schema_msgpack: &[u8],
schema_hash: u64,
prefix_bits: u8,
)
| 14 | |
| 15 | impl CoreLoop { |
| 16 | pub(in crate::data::executor) fn handle_array_open( |
| 17 | &mut self, |
| 18 | task: &ExecutionTask, |
| 19 | array_id: &ArrayId, |
| 20 | schema_msgpack: &[u8], |
| 21 | schema_hash: u64, |
| 22 | prefix_bits: u8, |
| 23 | ) -> Response { |
| 24 | // Verify-or-register against the in-memory catalog. Persistence |
| 25 | // into `_system.arrays` is owned by the Control-Plane DDL path |
| 26 | // (`SystemCatalog::put_array`), not the Data Plane — redb is |
| 27 | // Control-Plane-only. |
| 28 | { |
| 29 | let cat = match self.array_catalog.read() { |
| 30 | Ok(g) => g, |
| 31 | Err(_) => { |
| 32 | return self.response_error( |
| 33 | task, |
| 34 | ErrorCode::Internal { |
| 35 | detail: "array catalog lock poisoned".to_string(), |
| 36 | }, |
| 37 | ); |
| 38 | } |
| 39 | }; |
| 40 | if let Some(existing) = cat.lookup_by_name(&array_id.name) { |
| 41 | if existing.schema_hash != schema_hash { |
| 42 | return self.response_error( |
| 43 | task, |
| 44 | ErrorCode::Unsupported { |
| 45 | detail: format!( |
| 46 | "array '{}' already registered with different schema hash ({:#x} != {:#x})", |
| 47 | array_id.name, existing.schema_hash, schema_hash |
| 48 | ), |
| 49 | }, |
| 50 | ); |
| 51 | } |
| 52 | } else { |
| 53 | drop(cat); |
| 54 | let entry = ArrayCatalogEntry { |
| 55 | array_id: array_id.clone(), |
| 56 | name: array_id.name.clone(), |
| 57 | schema_msgpack: schema_msgpack.to_vec(), |
| 58 | schema_hash, |
| 59 | created_at_ms: now_epoch_ms(), |
| 60 | prefix_bits, |
| 61 | audit_retain_ms: None, |
| 62 | minimum_audit_retain_ms: None, |
| 63 | }; |
| 64 | let mut cat = match self.array_catalog.write() { |
| 65 | Ok(g) => g, |
| 66 | Err(_) => { |
| 67 | return self.response_error( |
| 68 | task, |
| 69 | ErrorCode::Internal { |
| 70 | detail: "array catalog lock poisoned".to_string(), |
| 71 | }, |
| 72 | ); |
| 73 | } |
no test coverage detected