summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/database.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/database.h')
-rw-r--r--src/mongo/db/catalog/database.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/database.h b/src/mongo/db/catalog/database.h
index 06b7456c81c..bd8ea3dbed1 100644
--- a/src/mongo/db/catalog/database.h
+++ b/src/mongo/db/catalog/database.h
@@ -35,6 +35,7 @@
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/collection_catalog.h"
#include "mongo/db/catalog/collection_options.h"
+#include "mongo/db/catalog/virtual_collection_options.h"
#include "mongo/db/database_name.h"
#include "mongo/db/dbcommands_gen.h"
#include "mongo/db/namespace_string.h"
@@ -64,6 +65,14 @@ public:
const BSONObj& idIndex = BSONObj(),
bool fromMigrate = false) const = 0;
+ /**
+ * Creates the virtual namespace 'fullns' according to 'opts' and 'vopts'.
+ */
+ virtual Status userCreateVirtualNS(OperationContext* opCtx,
+ const NamespaceString& fullns,
+ CollectionOptions opts,
+ const VirtualCollectionOptions& vopts) const = 0;
+
Database() = default;
// must call close first
@@ -133,6 +142,19 @@ public:
const BSONObj& idIndex = BSONObj(),
bool fromMigrate = false) const = 0;
+ /**
+ * A MODE_IX collection lock must be held for this call. Throws a WriteConflictException error
+ * if the collection already exists (say if another thread raced to create it).
+ *
+ * Surrounding writeConflictRetry loops must encompass checking that the collection exists as
+ * well as creating it. Otherwise the loop will endlessly throw WCEs: the caller must check that
+ * the collection exists to break free.
+ */
+ virtual Collection* createVirtualCollection(OperationContext* opCtx,
+ const NamespaceString& nss,
+ const CollectionOptions& opts,
+ const VirtualCollectionOptions& vopts) const = 0;
+
virtual Status createView(OperationContext* opCtx,
const NamespaceString& viewName,
const CollectionOptions& options) const = 0;