summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/bulk_write_common.h
diff options
context:
space:
mode:
authorLingzhi Deng <lingzhi.deng@mongodb.com>2023-04-11 23:54:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-12 04:52:53 +0000
commit3cd6a9bc6def4936c489f8f9dffeebc98390b6f5 (patch)
tree4d8e8b580e214f031c8054585a0b052a57c57606 /src/mongo/db/commands/bulk_write_common.h
parent7d08c1b07913e26982499e9ea6051e815d7cf7e6 (diff)
downloadmongo-3cd6a9bc6def4936c489f8f9dffeebc98390b6f5.tar.gz
SERVER-75928: Move common bulkWrite helpers between mongod and mongos into one place
Diffstat (limited to 'src/mongo/db/commands/bulk_write_common.h')
-rw-r--r--src/mongo/db/commands/bulk_write_common.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/mongo/db/commands/bulk_write_common.h b/src/mongo/db/commands/bulk_write_common.h
new file mode 100644
index 00000000000..9beb9956092
--- /dev/null
+++ b/src/mongo/db/commands/bulk_write_common.h
@@ -0,0 +1,53 @@
+/**
+ * Copyright (C) 2023-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#pragma once
+
+#include "mongo/db/commands/bulk_write_gen.h"
+#include "mongo/db/commands/bulk_write_parser.h"
+
+/**
+ * Contains common functionality shared between the bulkWrite command in mongos and mongod.
+ */
+
+namespace mongo {
+namespace bulk_write_common {
+
+/**
+ * Validates the given bulkWrite command request and throws if the request is malformed.
+ */
+void validateRequest(const BulkWriteCommandRequest& req);
+
+/**
+ * Get the privileges needed to perform the given bulkWrite command.
+ */
+std::vector<Privilege> getPrivileges(const BulkWriteCommandRequest& req);
+
+} // namespace bulk_write_common
+} // namespace mongo