-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jin Hai <[email protected]>
- Loading branch information
Showing
9 changed files
with
182 additions
and
1,244 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
module; | ||
|
||
import stl; | ||
#include <miniocpp/client.h> | ||
|
||
export module s3_client; | ||
|
||
import stl; | ||
import status; | ||
|
||
namespace infinity { | ||
|
||
export class S3Client { | ||
public: | ||
S3Client(String _url = "http://localhost:9000", | ||
bool _https = false, | ||
String _access_key = "minioadmin", | ||
String _secret_key = "minioadmin") : url(_url), https(_https), access_key(_access_key), secret_key(_secret_key) {} | ||
public: | ||
S3Client(String _url = "http://localhost:9000", bool _https = false, String _access_key = "minioadmin", String _secret_key = "minioadmin") | ||
: url(_url), https(_https), access_key(_access_key), secret_key(_secret_key) {} | ||
|
||
~S3Client() = default; | ||
virtual ~S3Client() = default; | ||
|
||
virtual void DownloadObject(const String & bucket_name, const String &object_name, const String &file_path)=0; | ||
virtual Status DownloadObject(const String &bucket_name, const String &object_name, const String &file_path) = 0; | ||
|
||
virtual void UploadObject(const String & bucket_name, const String &object_name, const String &file_path)=0; | ||
virtual Status UploadObject(const String &bucket_name, const String &object_name, const String &file_path) = 0; | ||
|
||
virtual void RemoveObject(const String & bucket_name, const String &object_name)=0; | ||
virtual Status RemoveObject(const String &bucket_name, const String &object_name) = 0; | ||
|
||
virtual void CopyObject(const String & src_bucket_name, const String &src_object_name, const String & dst_bucket_name, const String &dst_object_name)=0; | ||
virtual Status | ||
CopyObject(const String &src_bucket_name, const String &src_object_name, const String &dst_bucket_name, const String &dst_object_name) = 0; | ||
|
||
protected: | ||
String url; | ||
bool https; | ||
String access_key; | ||
String secret_key; | ||
protected: | ||
String url; | ||
bool https; | ||
String access_key; | ||
String secret_key; | ||
}; | ||
} | ||
} // namespace infinity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
module; | ||
|
||
import stl; | ||
import s3_client; | ||
#include <miniocpp/client.h> | ||
|
||
export module s3_client_minio; | ||
|
||
import stl; | ||
import s3_client; | ||
import status; | ||
|
||
namespace infinity { | ||
|
||
class S3ClientMinio final: public S3Client { | ||
public: | ||
S3ClientMinio(String _url = "http://localhost:9000", | ||
bool _https = false, | ||
String _access_key = "minioadmin", | ||
String _secret_key = "minioadmin") : S3Client(_url, _https, _access_key, _secret_key), | ||
base_url(_url, _https), | ||
provider(_access_key, _secret_key) {} | ||
export class S3ClientMinio final : public S3Client { | ||
public: | ||
S3ClientMinio(String _url = "http://localhost:9000", bool _https = false, String _access_key = "minioadmin", String _secret_key = "minioadmin") | ||
: S3Client(_url, _https, _access_key, _secret_key), base_url(_url, _https), provider(_access_key, _secret_key) {} | ||
|
||
~S3ClientMinio() = default; | ||
~S3ClientMinio() = default; | ||
|
||
void DownloadObject(const String & bucket_name, const String &object_name, const String &file_path); | ||
Status DownloadObject(const String &bucket_name, const String &object_name, const String &file_path); | ||
|
||
void UploadObject(const String & bucket_name, const String &object_name, const String &file_path); | ||
Status UploadObject(const String &bucket_name, const String &object_name, const String &file_path); | ||
|
||
void RemoveObject(const String & bucket_name, const String &object_name); | ||
Status RemoveObject(const String &bucket_name, const String &object_name); | ||
|
||
void CopyObject(const String & src_bucket_name, const String &src_object_name, const String & dst_bucket_name, const String &dst_object_name); | ||
Status CopyObject(const String &src_bucket_name, const String &src_object_name, const String &dst_bucket_name, const String &dst_object_name); | ||
|
||
minio::s3::Client GetClient() { return minio::s3::Client(base_url, &provider); } | ||
minio::s3::Client GetClient() { return minio::s3::Client(base_url, &provider); } | ||
|
||
private: | ||
minio::s3::BaseUrl base_url; | ||
minio::creds::StaticProvider provider; | ||
private: | ||
minio::s3::BaseUrl base_url; | ||
minio::creds::StaticProvider provider; | ||
}; | ||
} | ||
} // namespace infinity |
Oops, something went wrong.