Get all container records. Returns: List of ContainerRecord objects
(self)
| 247 | conn.close() |
| 248 | |
| 249 | def get_all(self) -> list[ContainerRecord]: |
| 250 | """Get all container records. |
| 251 | |
| 252 | Returns: |
| 253 | List of ContainerRecord objects |
| 254 | """ |
| 255 | conn = self._get_connection() |
| 256 | try: |
| 257 | cursor = conn.cursor() |
| 258 | cursor.execute( |
| 259 | "SELECT container_id, container_name, image_name, owner_pid, created_at, config_hash, platform_type FROM containers" |
| 260 | ) |
| 261 | rows = cursor.fetchall() |
| 262 | return [ |
| 263 | ContainerRecord( |
| 264 | container_id=row[0], |
| 265 | container_name=row[1], |
| 266 | image_name=row[2], |
| 267 | owner_pid=row[3], |
| 268 | created_at=row[4], |
| 269 | config_hash=row[5] if len(row) > 5 else "", |
| 270 | platform_type=row[6] if len(row) > 6 else "", |
| 271 | ) |
| 272 | for row in rows |
| 273 | ] |
| 274 | finally: |
| 275 | conn.close() |
| 276 | |
| 277 | def get_by_config_hash(self, config_hash: str) -> Optional[ContainerRecord]: |
| 278 | """Get container record by configuration hash. |