20
20
#pragma once
21
21
22
22
#include " eckit/io/s3/S3Config.h"
23
- #include " eckit/memory/NonCopyable.h"
24
23
24
+ #include < cstdint>
25
+ #include < iosfwd>
25
26
#include < memory>
27
+ #include < string>
26
28
#include < vector>
27
29
28
30
namespace eckit {
@@ -31,15 +33,19 @@ class S3Context;
31
33
32
34
// ----------------------------------------------------------------------------------------------------------------------
33
35
34
- class S3Client : private NonCopyable {
36
+ class S3Client {
35
37
public: // methods
36
- virtual ~S3Client ();
37
-
38
- static auto makeShared (const S3Config& config) -> std::shared_ptr<S3Client>;
38
+ S3Client (const S3Client&) = delete ;
39
+ S3Client& operator =(const S3Client&) = delete ;
40
+ S3Client (S3Client&&) = default ;
41
+ S3Client& operator =(S3Client&&) = default ;
42
+ virtual ~S3Client () = default ;
39
43
40
44
static auto makeUnique (const S3Config& config) -> std::unique_ptr<S3Client>;
41
45
42
- virtual auto endpoint () const -> const net::Endpoint&;
46
+ static auto makeShared (const S3Config& config) -> std::shared_ptr<S3Client> { return makeUnique (config); }
47
+
48
+ auto config () const -> const S3Config& { return config_; }
43
49
44
50
virtual void createBucket (const std::string& bucket) const = 0;
45
51
@@ -51,11 +57,16 @@ class S3Client: private NonCopyable {
51
57
52
58
virtual auto listBuckets () const -> std::vector<std::string> = 0;
53
59
54
- virtual auto putObject (const std::string& bucket, const std::string& object, const void * buffer,
55
- uint64_t length) const -> long long = 0;
60
+ virtual auto putObject (const std::string& bucket,
61
+ const std::string& object,
62
+ const void * buffer,
63
+ uint64_t length) const -> long long = 0;
56
64
57
- virtual auto getObject (const std::string& bucket, const std::string& object, void * buffer, uint64_t offset,
58
- uint64_t length) const -> long long = 0;
65
+ virtual auto getObject (const std::string& bucket,
66
+ const std::string& object,
67
+ void * buffer,
68
+ uint64_t offset,
69
+ uint64_t length) const -> long long = 0;
59
70
60
71
virtual void deleteObject (const std::string& bucket, const std::string& object) const = 0;
61
72
@@ -67,16 +78,15 @@ class S3Client: private NonCopyable {
67
78
68
79
virtual auto objectSize (const std::string& bucket, const std::string& object) const -> long long = 0;
69
80
70
- friend std::ostream& operator <<(std::ostream& out, const S3Client& client) {
71
- client.print (out);
72
- return out;
73
- }
74
-
75
81
protected: // methods
76
- explicit S3Client (const S3Config& config);
82
+ S3Client ();
83
+
84
+ explicit S3Client (S3Config config);
77
85
78
86
virtual void print (std::ostream& out) const ;
79
87
88
+ friend std::ostream& operator <<(std::ostream& out, const S3Client& client);
89
+
80
90
private: // members
81
91
S3Config config_;
82
92
};
0 commit comments