summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/backup_block.h
diff options
context:
space:
mode:
authorMatt Kneiser <matt.kneiser@mongodb.com>2022-02-02 21:33:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-11 06:17:14 +0000
commit98171115a000d2a9174a9289f4db5713c1c6d162 (patch)
treed9b8f5c5d5208e7370ef8cae0e06a3e3cf05fdc0 /src/mongo/db/storage/backup_block.h
parent6fe9f677add123bfb1a0fb62f3d95f9fd61794f7 (diff)
downloadmongo-98171115a000d2a9174a9289f4db5713c1c6d162.tar.gz
SERVER-62427 Return namespace with backupCursor
Diffstat (limited to 'src/mongo/db/storage/backup_block.h')
-rw-r--r--src/mongo/db/storage/backup_block.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/src/mongo/db/storage/backup_block.h b/src/mongo/db/storage/backup_block.h
index 9578fd19a39..d084c981d34 100644
--- a/src/mongo/db/storage/backup_block.h
+++ b/src/mongo/db/storage/backup_block.h
@@ -29,8 +29,12 @@
#pragma once
+#include <boost/filesystem.hpp>
#include <string>
+#include "mongo/db/namespace_string.h"
+#include "mongo/db/operation_context.h"
+
namespace mongo {
/**
@@ -47,16 +51,26 @@ namespace mongo {
*/
class BackupBlock final {
public:
- explicit BackupBlock(std::string filename,
+ explicit BackupBlock(OperationContext* opCtx,
+ std::string filePath,
std::uint64_t offset = 0,
std::uint64_t length = 0,
- std::uint64_t fileSize = 0)
- : _filename(filename), _offset(offset), _length(length), _fileSize(fileSize) {}
+ std::uint64_t fileSize = 0);
~BackupBlock() = default;
- std::string filename() const {
- return _filename;
+ std::string filePath() const {
+ return _filePath;
+ }
+
+ std::string ns() const {
+ // Remove "system.buckets." from time-series collection namespaces since it is an
+ // internal detail that is not intended to be visible externally.
+ if (_nss.isTimeseriesBucketsCollection()) {
+ return _nss.getTimeseriesViewNamespace().toString();
+ }
+
+ return _nss.toString();
}
std::uint64_t offset() const {
@@ -77,9 +91,20 @@ public:
bool isRequired() const;
private:
- const std::string _filename;
+ /**
+ * Sets '_nss' for:
+ * - collections
+ * - indexes, to the NSS of their respective collection
+ * A null opCtx is ignored. A null opCtx is exercised by FCBIS unit tests.
+ */
+ void _setNamespaceString(OperationContext* opCtx);
+
+ const std::string _filePath;
const std::uint64_t _offset;
const std::uint64_t _length;
const std::uint64_t _fileSize;
+
+ std::string _filenameStem;
+ NamespaceString _nss;
};
} // namespace mongo