Build a stash operation message dict. Args: request_id: Unique request identifier (int or str) op: Stash operation code (STASH_OP_*) table: Table name key: Optional key for put/get/delete operations value: Optional value for put operation pat
(request_id, op: int, table: str,
key=None, value=None, pattern=None)
| 760 | |
| 761 | |
| 762 | def make_stash_message(request_id, op: int, table: str, |
| 763 | key=None, value=None, pattern=None) -> dict: |
| 764 | """ |
| 765 | Build a stash operation message dict. |
| 766 | |
| 767 | Args: |
| 768 | request_id: Unique request identifier (int or str) |
| 769 | op: Stash operation code (STASH_OP_*) |
| 770 | table: Table name |
| 771 | key: Optional key for put/get/delete operations |
| 772 | value: Optional value for put operation |
| 773 | pattern: Optional pattern for keys operation |
| 774 | |
| 775 | Returns: |
| 776 | dict: Stash message dict |
| 777 | """ |
| 778 | msg = { |
| 779 | "type": DirtyProtocol.MSG_TYPE_STASH, |
| 780 | "id": request_id, |
| 781 | "op": op, |
| 782 | "table": table, |
| 783 | } |
| 784 | if key is not None: |
| 785 | msg["key"] = key |
| 786 | if value is not None: |
| 787 | msg["value"] = value |
| 788 | if pattern is not None: |
| 789 | msg["pattern"] = pattern |
| 790 | return msg |
| 791 | |
| 792 | |
| 793 | def make_manage_message(request_id, op: int, count: int = 1) -> dict: |
no outgoing calls