Decode a single [`ObjectRecord`] into a protobuf message, hydrating `resource_version` from the authoritative DB row. Extracted to avoid repeating the identical decode-and-hydrate block across `get_message`, `get_message_by_name`, `list_messages`, and `list_messages_with_selector`.
(
record: ObjectRecord,
)
| 143 | /// `get_message`, `get_message_by_name`, `list_messages`, and |
| 144 | /// `list_messages_with_selector`. |
| 145 | fn decode_record<T: Message + Default + SetResourceVersion>( |
| 146 | record: ObjectRecord, |
| 147 | ) -> PersistenceResult<T> { |
| 148 | let mut message = T::decode(record.payload.as_slice()) |
| 149 | .map_err(|e| PersistenceError::Decode(format!("protobuf decode error: {e}")))?; |
| 150 | message.set_resource_version(record.resource_version); |
| 151 | Ok(message) |
| 152 | } |
| 153 | |
| 154 | /// Dispatch a method call to the underlying store implementation. |
| 155 | /// |
nothing calls this directly
no test coverage detected