Skip to content

Commit

Permalink
feat(S3): added compare operator
Browse files Browse the repository at this point in the history
  • Loading branch information
mcakircali committed Dec 30, 2024
1 parent 25d98c7 commit 50e3a25
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/eckit/io/s3/S3BucketName.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ class S3BucketName : public S3Name {

auto path() const -> const S3BucketPath& { return path_; }

auto bucket() const -> const std::string& { return path_.bucket; }

/// @todo return S3 object iterator but first add prefix
auto listObjects() const -> std::vector<std::string>;

Expand Down
4 changes: 4 additions & 0 deletions src/eckit/io/s3/S3BucketPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ struct S3BucketPath {

operator std::string() const { return asString(); }

bool operator==(const S3BucketPath& other) const { return bucket == other.bucket; }

bool operator!=(const S3BucketPath& other) const { return !(*this == other); }

friend std::ostream& operator<<(std::ostream& out, const S3BucketPath& path) {
out << "bucket=" << path.bucket;
return out;
Expand Down
4 changes: 0 additions & 4 deletions src/eckit/io/s3/S3ObjectName.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class S3ObjectName : public S3Name {

auto path() const -> const S3ObjectPath& { return path_; }

auto name() const -> const std::string& { return path_.object; }

auto bucket() const -> const std::string& { return path_.bucket; }

auto bucketExists() const -> bool;

// modifiers
Expand Down
4 changes: 4 additions & 0 deletions src/eckit/io/s3/S3ObjectPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ struct S3ObjectPath {

operator std::string() const { return asString(); }

bool operator==(const S3ObjectPath& other) const { return bucket == other.bucket && object == other.object; }

bool operator!=(const S3ObjectPath& other) const { return !(*this == other); }

friend std::ostream& operator<<(std::ostream& out, const S3ObjectPath& path) {
out << "bucket=" << path.bucket << ",object=" << path.object;
return out;
Expand Down

0 comments on commit 50e3a25

Please sign in to comment.