buildgrid.server.s3.s3utils module

class buildgrid.server.s3.s3utils.S3Object(bucket: str, key: str)

Bases: object

property response_headers: Dict[str, str]
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 argument is omitted, None, or negative, reads and returns all data until EOF.

If the 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). But 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.

Returns an empty bytes object on EOF.

Returns 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 the given buffer to the IO stream.

Returns the number of bytes written, which is always the length of b in bytes.

Raises BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment.

buildgrid.server.s3.s3utils.c_s3ojb(c: Curl) S3Object
buildgrid.server.s3.s3utils.head_objects(s3: S3Client, objects: Sequence[S3Object]) None
buildgrid.server.s3.s3utils.head_object(s3: S3Client, s3object: S3Object) None
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) None
buildgrid.server.s3.s3utils.get_object(s3: S3Client, s3object: S3Object, timeout_seconds_per_kilobyte: float | None = None, timeout_min_seconds: float = 120) 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.start_multipart_upload(s3: S3Client, s3object: S3Object) str
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]]]
buildgrid.server.s3.s3utils.abort_multipart_upload(s3: S3Client, s3object: S3Object, upload_id: str) None
buildgrid.server.s3.s3utils.multipart_upload(s3: S3Client, s3object: S3Object) None