Represents a batch of write operations.
| 42 | |
| 43 | |
| 44 | class _Run: |
| 45 | """Represents a batch of write operations.""" |
| 46 | |
| 47 | def __init__(self, op_type: int) -> None: |
| 48 | """Initialize a new Run object.""" |
| 49 | self.op_type: int = op_type |
| 50 | self.index_map: list[int] = [] |
| 51 | self.ops: list[Any] = [] |
| 52 | self.idx_offset: int = 0 |
| 53 | |
| 54 | def index(self, idx: int) -> int: |
| 55 | """Get the original index of an operation in this run. |
| 56 | |
| 57 | :param idx: The Run index that maps to the original index. |
| 58 | """ |
| 59 | return self.index_map[idx] |
| 60 | |
| 61 | def add(self, original_index: int, operation: Any) -> None: |
| 62 | """Add an operation to this Run instance. |
| 63 | |
| 64 | :param original_index: The original index of this operation |
| 65 | within a larger bulk operation. |
| 66 | :param operation: The operation document. |
| 67 | """ |
| 68 | self.index_map.append(original_index) |
| 69 | self.ops.append(operation) |
| 70 | |
| 71 | |
| 72 | def _merge_command( |
no outgoing calls
no test coverage detected