Weiyun1025's picture
Upload folder using huggingface_hub
2abfccb verified
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <aws/s3/model/ListObjectsRequest.h>
#include <aws/s3/model/Object.h>
#include <aws/s3/S3Client.h>
#include <aws/core/Aws.h>
#include <chrono>
#include <list>
#include <vector>
#include <string>
#include <fstream>
#include <aws/s3/model/CompletedPart.h>
#include <aws/transfer/TransferManager.h>
class S3Client
{
public:
S3Client(const std::string &ak, const std::string &sk, const std::string &endpoint, bool verify_ssl, bool enable_https, bool use_dual_stack, int threads_num);
~S3Client();
int get_object(const std::string &bucket, const std::string &key, int &error_type, std::string &error_message, std::string &result, std::string &range);
int multipart_download_concurrency(const std::string &bucket, const std::string &key, const std::string &filename, int &error_type, std::string &error_message);
int put_object(const std::string &bucket, const std::string &key, const std::string &data, int &error_type, std::string &error_message);
int multipart_upload_concurrency(const std::string bucket, const std::string key, const std::string filename, int &error_type, std::string &error_message);
int delete_obj(const std::string &bucket, const std::string &key, int error_type, std::string &error_message);
int contains(const std::string &bucket, const std::string &key, int error_type, std::string &error_message);
std::vector<std::string> list(const std::string &bucket, const std::string &key, int error_type, std::string &error_message);
private:
std::shared_ptr<Aws::S3::S3Client> client;
int threads_num;
};
void init_api(const std::string &level);
void shutdown_api();
std::list<std::pair<int, std::string>> get_error_list();