diff options
author | Etienne Petrel <etienne.petrel@mongodb.com> | 2023-01-24 04:53:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-24 05:27:31 +0000 |
commit | b5799b4daa1fdcba19a5fe222beea4339d1edc39 (patch) | |
tree | d2fd291d3a508e61d405306d2f8ae7979f3e8430 /src/third_party/wiredtiger | |
parent | f8fdf2b2887252e11569396840a76c63fcb80834 (diff) | |
download | mongo-b5799b4daa1fdcba19a5fe222beea4339d1edc39.tar.gz |
Import wiredtiger: df7f8415abb54939e7b07bb95c7a6d46de640902 from branch mongodb-master
ref: af997aede4..df7f8415ab
for: 6.3.0-rc0
WT-10352 Implement delete_object() in connection class for Azure
Diffstat (limited to 'src/third_party/wiredtiger')
3 files changed, 16 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/ext/storage_sources/azure_store/azure_connection.cpp b/src/third_party/wiredtiger/ext/storage_sources/azure_store/azure_connection.cpp index 442033c40c1..5ce5be2ebe5 100644 --- a/src/third_party/wiredtiger/ext/storage_sources/azure_store/azure_connection.cpp +++ b/src/third_party/wiredtiger/ext/storage_sources/azure_store/azure_connection.cpp @@ -72,9 +72,21 @@ azure_connection::put_object(const std::string &object_key, const std::string &f return 0; } +// Delete an object in the bucket given the object name. int -azure_connection::delete_object() const +azure_connection::delete_object(const std::string &object_key) const { + std::string obj = _object_prefix + object_key; + + auto object_client = _azure_client.GetBlobClient(obj); + auto delete_blob_response = object_client.DeleteIfExists(); + + // Returns false if obj doesn't exist. + if (!delete_blob_response.Value.Deleted) { + std::cerr << obj + " : No such object file exists in the bucket." << std::endl; + return -1; + } + return 0; } diff --git a/src/third_party/wiredtiger/ext/storage_sources/azure_store/azure_connection.h b/src/third_party/wiredtiger/ext/storage_sources/azure_store/azure_connection.h index 7704c3c0b6f..7bfd6342f13 100644 --- a/src/third_party/wiredtiger/ext/storage_sources/azure_store/azure_connection.h +++ b/src/third_party/wiredtiger/ext/storage_sources/azure_store/azure_connection.h @@ -33,6 +33,7 @@ #include <string> #include <vector> +#include <iostream> /* * This class represents an active connection to the Azure endpoint and allows for interaction with @@ -49,7 +50,7 @@ class azure_connection { int list_objects( const std::string &prefix, std::vector<std::string> &objects, bool list_single) const; int put_object(const std::string &object_key, const std::string &file_path) const; - int delete_object() const; + int delete_object(const std::string &object_key) const; int get_object(const std::string &path) const; private: diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 5feb6d6c24f..f33bdcf743a 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "af997aede40e887e9514d0148b504cc193fd0053" + "commit": "df7f8415abb54939e7b07bb95c7a6d46de640902" } |