To support unfinalized appendable objects in the testbench, the blob (metadata size, media, etc) needs to be updated in the database within Upload.process_bidi_write_object_grpc, which mainly handles the bidi write business logic.
Below is an example of how blob.media and blob.metadata.size could be updated to the database. This would support test cases where size or data needs to read back for unfinalized appendable objects.
Testbench implementaton details should be decided based on the internal design doc and needed test cases.
upload.media += content
# ...
# Update appendable blob size and media here, as an example.
# TODO: (1) Update_time, size and crc are updated in object metadata.
# TODO: (2) Whether the testbench checks for flush or/and performs a background force-close.
if is_appendable:
def update_appendable_blob(blob, unused_generation):
blob.media = upload.media
blob.metadata.size = len(upload.media)
return blob
blob = db.do_update_object(
upload.bucket.name,
upload.metadata.name,
update_fn=update_appendable_blob,
context=context,
generation=upload.metadata.generation,
)
|
# Currently, the testbench will always checkpoint and flush data for testing purposes, |
|
# instead of the 15 seconds interval used in the GCS server. |
|
# TODO(#592): Refactor testbench checkpointing to more closely follow GCS server behavior. |
|
upload.media += content |
To support unfinalized appendable objects in the testbench, the blob (metadata size, media, etc) needs to be updated in the database within
Upload.process_bidi_write_object_grpc, which mainly handles the bidi write business logic.Below is an example of how
blob.mediaandblob.metadata.sizecould be updated to the database. This would support test cases where size or data needs to read back for unfinalized appendable objects.Testbench implementaton details should be decided based on the internal design doc and needed test cases.
storage-testbench/gcs/upload.py
Lines 504 to 507 in 9a8ca66