jeudi 12 septembre 2019

C++ Aws S3 IOStream Gets destroyed when passing it around. Is there anyway to prevent this?

So my getObject function looks somthing like is:

    Aws::S3::S3Client s3_client;
    Aws::S3::Model::GetObjectRequest object_request;
    object_request.SetBucket(bucket_name);
    object_request.SetKey(object_name);

    // Get the object
    auto get_object_outcome = s3_client.GetObject(object_request);

    // Get an Aws::IOStream reference to the retrieved file
    auto &retrieved_file = get_object_outcome.GetResultWithOwnership().GetBody();

    return retrieved_file 

The retrieved_file is an AWS::IOStream, but the data in the stream is lost after the calling function gets this object back.

Is there anyway to prevent this?

Aucun commentaire:

Enregistrer un commentaire