aistore.sdk.batch.batch
Module Contents
Classes
Data
API
Batch (Get-Batch) API - Direct mapping to Go’s MOSS (Multi-Object Streaming Service).
Builds and executes Get-Batch requests to retrieve multiple objects, archived files, or byte ranges in a single efficient operation.
Return the list of MossIn requests in the batch.
Number of objects in batch.
Returns: int
Number of objects in the batch
String representation of the Batch object.
Returns: str
String representation showing number of objects and format
Internal helper to add objects in bulk. Supports strings, Object instances, or lists of either.
Extract from multipart response (with metadata). Returns actual MossOut with size, errors, etc.
Parameters:
HTTP response object
Whether to decode multipart as stream
Snapshot of the request for this batch
Returns: BatchResult
Generator yielding (MossOut, content) tuples
Extract from streaming response (no metadata). Infer MossOut from request data.
Parameters:
HTTP response object
Snapshot of the request for this batch
Returns: BatchResult
Generator yielding (MossOut, content) tuples
Add object with advanced parameters (archpath, byte ranges, opaque data).
For simple objects, prefer passing them to init instead.
Note: if objects are specified as raw names (str), default bucket must be provided in init
Parameters:
Object or object name string
User-provided binary identifier (returned unchanged)
Extract file from archive (e.g., “images/photo.jpg”)
Byte range start offset
Byte range length
Returns: Batch
Self for method chaining
Clear all objects from the batch request.
This allows reusing the same batch instance for multiple requests without creating a new Batch object.
Returns: Batch
Self for method chaining
Execute the Get-Batch request.
After execution, the batch is automatically cleared to allow reuse. You can add new objects and call get() again on the same instance.
Parameters:
Return raw HTTP response stream. User must close the stream
Stream multipart decoding (memory efficient)
Whether to clear the batch after execution.
- True (default): Automatically clears all objects from the batch after running get(), enabling reuse with new objects.
- False: Retains the batch objects, allowing repeated get() calls or adding more objects before execution.
Returns: Union[BatchResult, HTTPResponse]
Union[BatchResult, HTTPResponse]:
- If raw=True: HTTPResponse object (caller must close)
- If raw=False: Generator yielding (MossOut, file_content) tuples
Raises:
ValueError: If no objects added to batch