Insert a new container record. Args: container_id: Docker container ID container_name: Container name image_name: Docker image name owner_pid: Process ID of owner config_hash: Hash of container configuration platform_ty
(
self,
container_id: str,
container_name: str,
image_name: str,
owner_pid: int,
config_hash: str = "",
platform_type: str = "",
)
| 174 | conn.close() |
| 175 | |
| 176 | def insert( |
| 177 | self, |
| 178 | container_id: str, |
| 179 | container_name: str, |
| 180 | image_name: str, |
| 181 | owner_pid: int, |
| 182 | config_hash: str = "", |
| 183 | platform_type: str = "", |
| 184 | ) -> None: |
| 185 | """Insert a new container record. |
| 186 | |
| 187 | Args: |
| 188 | container_id: Docker container ID |
| 189 | container_name: Container name |
| 190 | image_name: Docker image name |
| 191 | owner_pid: Process ID of owner |
| 192 | config_hash: Hash of container configuration |
| 193 | platform_type: Platform family (e.g., "avr", "esp-32s3") |
| 194 | """ |
| 195 | conn = self._get_connection() |
| 196 | try: |
| 197 | cursor = conn.cursor() |
| 198 | cursor.execute( |
| 199 | """ |
| 200 | INSERT INTO containers (container_id, container_name, image_name, owner_pid, created_at, config_hash, platform_type) |
| 201 | VALUES (?, ?, ?, ?, ?, ?, ?) |
| 202 | """, |
| 203 | ( |
| 204 | container_id, |
| 205 | container_name, |
| 206 | image_name, |
| 207 | owner_pid, |
| 208 | int(time.time()), |
| 209 | config_hash, |
| 210 | platform_type, |
| 211 | ), |
| 212 | ) |
| 213 | conn.commit() |
| 214 | finally: |
| 215 | conn.close() |
| 216 | |
| 217 | def delete_by_id(self, container_id: str) -> None: |
| 218 | """Delete container record by ID. |