def batch_copy(src_cobjs: List[CloudObject], dest_prefix: str, *, storage: Storage): # If Lithops' storage supported Copy Object operations, this could be easily optimized. # Not sure if it's worth the effort yet result_cobjs = [] for i, data in enumerate( iter_cobjects_with_prefetch(storage, src_cobjs)): dest_key = f'{dest_prefix}/{i:06}' result_cobjs.append( storage.put_cloudobject(data, dest_bucket, dest_key)) return result_cobjs
def save_cobj(storage: Storage, obj: TItem, bucket: str = None, key: str = None) -> CObj[TItem]: return storage.put_cloudobject(serialize(obj), bucket, key)