aports/community/tiledb/60-stringstream.patch
2024-08-04 05:43:30 +00:00

91 lines
3.3 KiB
Diff

Author: Holger Jaekel <holger.jaekel@gmx.de>
Summary: convert Aws::StringStream to std::string
----
--- a/tiledb/sm/filesystem/s3.h
+++ b/tiledb/sm/filesystem/s3.h
@@ -67,6 +67,7 @@
#include <aws/core/utils/ratelimiter/DefaultRateLimiter.h>
#include <aws/core/utils/stream/PreallocatedStreamBuf.h>
#include <aws/core/utils/threading/Executor.h>
+#include <aws/crt/Allocator.h>
#include <aws/identity-management/auth/STSAssumeRoleCredentialsProvider.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/CompleteMultipartUploadRequest.h>
@@ -148,7 +149,7 @@
ss << " : " << err.GetMessage();
- return ss.str();
+ return ss.str().c_str();
}
} // namespace
@@ -380,7 +381,7 @@
// Set header from S3Parameters custom headers
for (auto& [key, val] : params_.custom_headers_) {
- httpRequest->SetHeaderValue(key, val);
+ httpRequest->SetHeaderValue(Aws::String(key), Aws::String(val));
}
}
@@ -423,9 +424,9 @@
class S3Scanner : public LsScanner<F, D> {
public:
/** Declare LsScanIterator as a friend class for access to call next(). */
- template <class scanner_type, class T>
+ template <class scanner_type, class T, class Allocator>
friend class LsScanIterator;
- using Iterator = LsScanIterator<S3Scanner<F, D>, Aws::S3::Model::Object>;
+ using Iterator = LsScanIterator<S3Scanner<F, D>, Aws::S3::Model::Object, Aws::Crt::StlAllocator< Aws::S3::Model::Object >>;
/** Constructor. */
S3Scanner(
@@ -923,7 +924,7 @@
LsObjects objects;
for (auto object : s3_scanner) {
- objects.emplace_back(prefix + "/" + object.GetKey(), object.GetSize());
+ objects.emplace_back(Aws::String(prefix) + Aws::String("/") + Aws::String(object.GetKey()), object.GetSize());
}
return objects;
}
@@ -1658,7 +1659,7 @@
}
list_objects_request_.SetBucket(aws_uri.GetAuthority());
- const std::string aws_uri_str(S3::remove_front_slash(aws_uri.GetPath()));
+ const std::string aws_uri_str(S3::remove_front_slash(aws_uri.GetPath().c_str()));
list_objects_request_.SetPrefix(aws_uri_str.c_str());
// Empty delimiter returns recursive results from S3.
list_objects_request_.SetDelimiter(delimiter_.c_str());
@@ -1682,8 +1683,8 @@
while (ptr != end_) {
auto object = *ptr;
uint64_t size = object.GetSize();
- std::string path = "s3://" + list_objects_request_.GetBucket() +
- S3::add_front_slash(object.GetKey());
+ std::string path = (Aws::String("s3://") + list_objects_request_.GetBucket() +
+ Aws::String(S3::add_front_slash(object.GetKey().c_str()))).c_str();
// TODO: Add support for directory pruning.
if (this->file_filter_(path, size)) {
--- a/tiledb/sm/filesystem/ls_scanner.h
+++ b/tiledb/sm/filesystem/ls_scanner.h
@@ -130,12 +130,12 @@
* @tparam T The data type stored by this iterator.
* TODO: Discuss using T for iterator type instead of underlying data type.
*/
-template <class scanner_type, class T>
+template <class scanner_type, class T, class Allocator = std::allocator<T>>
class LsScanIterator {
public:
using value_type = T;
using difference_type = ptrdiff_t;
- using pointer = typename std::vector<T>::const_iterator;
+ using pointer = typename std::vector<T, Allocator>::const_iterator;
using reference = const T&;
using iterator_category = std::input_iterator_tag;