Encode a worker management message. Args: request_id: Request identifier op: Management operation (MANAGE_OP_ADD or MANAGE_OP_REMOVE) count: Number of workers to add/remove Returns: bytes: Complete message (header + payload)
(request_id: int, op: int, count: int = 1)
| 302 | |
| 303 | @staticmethod |
| 304 | def encode_manage(request_id: int, op: int, count: int = 1) -> bytes: |
| 305 | """ |
| 306 | Encode a worker management message. |
| 307 | |
| 308 | Args: |
| 309 | request_id: Request identifier |
| 310 | op: Management operation (MANAGE_OP_ADD or MANAGE_OP_REMOVE) |
| 311 | count: Number of workers to add/remove |
| 312 | |
| 313 | Returns: |
| 314 | bytes: Complete message (header + payload) |
| 315 | """ |
| 316 | payload_dict = { |
| 317 | "op": op, |
| 318 | "count": count, |
| 319 | } |
| 320 | payload = TLVEncoder.encode(payload_dict) |
| 321 | header = BinaryProtocol.encode_header(MSG_TYPE_MANAGE, request_id, |
| 322 | len(payload)) |
| 323 | return header + payload |
| 324 | |
| 325 | @staticmethod |
| 326 | def encode_stash(request_id: int, op: int, table: str, |
no test coverage detected