buildgrid.server.s3.s3utils module
- class buildgrid.server.s3.s3utils.S3Object(bucket: str, key: str)
Bases:
object- property response_headers: dict[str, str]
- reset() None
Reset the state mutated by sent requests to prepare for a retry
- class buildgrid.server.s3.s3utils.UploadPart(upload_id: str, number: int, file: IO[bytes], eof: int, size: int, offset: int)
Bases:
BufferedIOBase- property upload_id: str
- property number: int
- property response: BinaryIO
- readable() bool
Return whether object was opened for reading.
If False, read() will raise OSError.
- seekable() bool
Return whether object supports random access.
If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().
- writable() bool
Return whether object was opened for writing.
If False, write() will raise OSError.
- read(size: int | None = -1) bytes
Read and return up to n bytes.
If the size argument is omitted, None, or negative, read and return all data until EOF.
If the size argument is positive, and the underlying raw stream is not ‘interactive’, multiple raw reads may be issued to satisfy the byte count (unless EOF is reached first). However, for interactive raw streams (as well as sockets and pipes), at most one raw read will be issued, and a short result does not imply that EOF is imminent.
Return an empty bytes object on EOF.
Return None if the underlying raw stream was open in non-blocking mode and no data is available at the moment.
- write(b: bytes) int
Write buffer b to the IO stream.
Return the number of bytes written, which is always the length of b in bytes.
Raise BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment.
- buildgrid.server.s3.s3utils.set_s3_timeout(c: Curl, s3object: S3Object, timeout_seconds_per_kilobyte: float | None, timeout_min_seconds: float) None
- buildgrid.server.s3.s3utils.get_objects(s3: S3Client, objects: Sequence[S3Object], timeout_seconds_per_kilobyte: float | None = None, timeout_min_seconds: float = 120, headers: Mapping[str, str] | None = None) None
- buildgrid.server.s3.s3utils.get_object(s3: S3Client, s3object: S3Object, timeout_seconds_per_kilobyte: float | None = None, timeout_min_seconds: float = 120, headers: Mapping[str, str] | None = None) None
- buildgrid.server.s3.s3utils.put_objects(s3: S3Client, objects: Sequence[S3Object], timeout_seconds_per_kilobyte: float | None = None, timeout_min_seconds: float = 120) None
- buildgrid.server.s3.s3utils.put_object(s3: S3Client, s3object: S3Object, timeout_seconds_per_kilobyte: float | None = None, timeout_min_seconds: float = 120) None
- buildgrid.server.s3.s3utils.upload_parts(s3: S3Client, s3object: S3Object, parts: Sequence[UploadPart]) dict[int, str]
- buildgrid.server.s3.s3utils.complete_multipart_upload(s3: S3Client, s3object: S3Object, upload_id: str, parts: Mapping[int, str]) dict[str, str | dict[str, str | int | dict[str, str]]]