SERVER-98435 Add initial metadata for modular API tooling (#30311)

GitOrigin-RevId: 63fa33e183d8f3c44c4074ff524d91d080d11eb5
This commit is contained in:
Mathias Stearn 2024-12-18 16:48:30 +01:00 committed by MongoDB Bot
parent 2c76a5e75f
commit becb80ca06
6 changed files with 208 additions and 6 deletions

134
modules_poc/modules.yaml Normal file
View File

@ -0,0 +1,134 @@
core:
- src/mongo/bson/
- src/mongo/base/
- src/mongo/platform/
- src/mongo/stdx/
- src/mongo/util/
query:
- src/mongo/db/commands/query_cmd/
- src/mongo/db/exec/
- src/mongo/db/fts/
- src/mongo/db/geo/
- src/mongo/db/index/ # mostly query, except index_access_method owned by storex
- src/mongo/db/matcher/
- src/mongo/db/modules/enterprise/src/fle/query_analysis
- src/mongo/db/pipeline/
- src/mongo/db/query/
- src/mongo/db/s/query_analysis* # note the filename pattern
- src/mongo/db/s/*query*analyzer* # note the filename pattern
- src/mongo/db/stats/
- src/mongo/db/update/
- src/mongo/db/views/
catalog:
- src/mongo/db/catalog/
replication:
- src/mongo/db/repl/ # excluding ./dbcheck*
- src/mongo/db/transaction/
- src/mongo/db/op_observer/op_observer_impl* # specific files
- src/mongo/db/op_observer/fcv_op_observer* # specific files
- src/mongo/db/op_observer/find_and_modify_images_op_observer* # specific files
storage_engine:
- src/third_party/wiredtiger/
access_control:
- src/mongo/db/auth/
admission:
- src/mongo/db/admission/
security:
- src/mongo/crypto
- src/mongo/db/modules/enterprise/src/audit
- src/mongo/db/modules/enterprise/src/encryptdb
- src/mongo/db/modules/enterprise/src/fips
- src/mongo/db/modules/enterprise/src/kerberos
- src/mongo/db/modules/enterprise/src/kmip
- src/mongo/db/modules/enterprise/src/ldap
- src/mongo/db/modules/enterprise/src/sasl
router_role:
- src/mongo/s/
shard_role:
- src/mongo/db/s/
data_movement:
- src/mongo/db/s/migration* # note the filename pattern
- src/mongo/db/s/resharding
logging:
- src/mongo/logv2/
networking:
- src/mongo/db/rpc/
- src/mongo/util/net
timeseries_bucket_catalog: # authoritative: @10gen/server-timeseries-bucket-catalog
- src/mongo/db/timeseries/bucket_catalog
collection_write_path: # authoritative: @10gen/server-collection-write-path
- src/mongo/db/collection_crud
- src/mongo/db/timeseries # excluding ./bucket_catalog
- src/mongo/db/commands/collection_to_capped* # specific files
bsoncolumn: # authoritative: @10gen/server-bsoncolumn
- src/mongo/bson/column
external_sorter: # authoritative: @10gen/server-external-sorter
- src/mongo/db/sorter
index_builds: # authoritative: @10gen/server-index-builds
- src/mongo/db/index_builds
- src/mongo/db/index/index_access_methods* # specific files
- src/mongo/db/catalog/index_key_validate* # specific files
- src/mongo/db/catalog/index_spec_validate* # specific files
- src/mongo/db/commands/create_indexes* # specific files
- src/mongo/db/commands/set_index_commit_quorum* # specific files
- src/mongo/db/commands/vote*index_build* # specific files
- src/mongo/dbtests/indexupdatetests.cpp # specific file
key_string: # authoritative: @10gen/server-key-string
- src/mongo/db/storage/key_string
storage_engine_integration: # authoritative: @10gen/server-storage-engine-integration
- src/mongo/db/storage # excluding ./key_string
- src/mongo/db/record_id* # specific files
- src/mongo/db/repair* # specific files
- src/mongo/db/prepare_conflict_tracker* # specific files
- src/mongo/db/repl_set_member_in_standalone_mode* # specific files
- src/mongo/db/server_recovery* # specific files
- src/mongo/db/mongod_options_storage.idl # specific file
- src/mongo/db/dbhelpers* # specific files
- src/mongo/db/dbcommands.idl # specific file
- src/mongo/db/catalog/import* # specific files
- src/mongo/db/catalog/index_repair* # specific files
- src/mongo/db/commands/fsync* # specific files
- src/mongo/db/commands/dbcommands* # specific files
- src/mongo/db/commands/resize_oplog* # specific files
- src/mongo/db/op_observer/batched_write* # specific files
- src/mongo/db/stats/storage_stats* # specific files
- src/mongo/db/stats/*resource_consumption* # specific files
- src/mongo/dbtests/storage_debug_util* # specific files
validate: # authoritative: @10gen/server-validate
- src/mongo/db/catalog/validate
- src/mongo/db/catalog/collection_validation* # specific files
- src/mongo/db/catalog/throttle_cursor* # specific files
- src/mongo/db/commands/validate.cpp # specific file
- src/mongo/dbtests/validate.cpp # specific file
dbcheck: # authoritative: @10gen/server-dbcheck
- src/mongo/db/catalog/health_log* # specific files
- src/mongo/db/commands/dbcheck* # specific files
- src/mongo/db/concurrency/deferred_writer* # specific files
- src/mongo/db/repl/dbcheck* # specific files
ttl: # authoritative: @10gen/server-ttl
- src/mongo/db/ttl
tracking_allocators: # authoritative: @10gen/server-tracking-allocators
- src/mongo/util/tracking

View File

@ -361,6 +361,7 @@ mongo_cc_library(
"//src/mongo/util:itoa.h",
"//src/mongo/util:lockable_adapter.h",
"//src/mongo/util:memory_usage_tracker.h",
"//src/mongo/util:modules.h",
"//src/mongo/util:murmur3.h",
"//src/mongo/util:optional_util.h",
"//src/mongo/util:out_of_line_executor.h",

View File

@ -66,6 +66,7 @@
#include "mongo/platform/compiler.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/bufreader.h"
#include "mongo/util/modules.h"
#include "mongo/util/shared_buffer.h"
#include "mongo/util/string_map.h"
@ -117,7 +118,7 @@ class LegacyStrictGenerator;
Code With Scope: <total size><String><Object>
\endcode
*/
class BSONObj {
class MONGO_MOD_PUB BSONObj {
public:
struct DefaultSizeTrait {
constexpr static int MaxSize = BSONObjMaxInternalSize;

View File

@ -44,7 +44,7 @@
#include "mongo/util/intrusive_counter.h"
#include "mongo/util/out_of_line_executor.h"
namespace mongo {
namespace MONGO_MOD_PUB mongo {
/**
* SemiFuture<T> is logically a possibly-deferred StatusWith<T> (or Status when T is void).
@ -263,7 +263,7 @@ public:
* WARNING: Do not use this unless you're extremely sure of what you're doing, as callbacks
* chained to the resulting Future may run in unexpected places.
*/
Future<T> unsafeToInlineFuture() && noexcept;
MONGO_MOD_UNFORTUNATELY_PUB Future<T> unsafeToInlineFuture() && noexcept;
private:
friend class Promise<T>;
@ -1133,7 +1133,7 @@ public:
* WARNING: Do not use this unless you're extremely sure of what you're doing, as callbacks
* chained to the resulting Future may run in unexpected places.
*/
Future<T> unsafeToInlineFuture() const noexcept {
MONGO_MOD_UNFORTUNATELY_PUB Future<T> unsafeToInlineFuture() const noexcept {
return Future<T>(toFutureImpl());
}
@ -1356,11 +1356,13 @@ auto makeReadyFutureWith(Func&& func) -> Future<FutureContinuationResult<Func&&>
} catch (const DBException& ex) {
return ex.toStatus();
}
} // namespace mongo
//
// Implementations of methods that couldn't be defined in the class due to ordering requirements.
// In a separate namespace block since they shouldn't be marked with MONGO_MOD_PUB.
//
namespace mongo {
template <typename T>
template <typename UniqueFunc>
auto ExecutorFuture<T>::_wrapCBHelper(ExecutorPtr exec, UniqueFunc&& func) {

View File

@ -49,6 +49,7 @@
#include "mongo/util/hierarchical_acquisition.h"
#include "mongo/util/interruptible.h"
#include "mongo/util/intrusive_counter.h"
#include "mongo/util/modules.h"
#include "mongo/util/scopeguard.h"
namespace mongo {
@ -112,7 +113,7 @@ class SharedPromise;
template <typename T>
class SharedSemiFuture;
namespace future_details {
namespace MONGO_MOD_PRIVATE future_details {
template <typename T>
class FutureImpl;

63
src/mongo/util/modules.h Normal file
View File

@ -0,0 +1,63 @@
/**
* Copyright (C) 2024-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/platform/compiler.h"
/** Marks a declaration and everything inside as public to other modules */
#define MONGO_MOD_PUB MONGO_MOD_ATTR_(public)
/** Marks a declaration and everything inside as unfortunately public to other modules */
#define MONGO_MOD_UNFORTUNATELY_PUB MONGO_MOD_ATTR_(unfortunately_public)
/** Marks a declaration and everything inside as private from other modules */
#define MONGO_MOD_PRIVATE MONGO_MOD_ATTR_(private)
/**
* Marks a declaration as public but not the insides,
* eg to allow fine-grained control over a class.
*/
#define MONGO_MOD_SHALLOW_PUB MONGO_MOD_ATTR_(shallow::public)
/**
* Marks a declaration as unfortunately public but not the insides,
* eg to allow fine-grained control over a class.
*/
#define MONGO_MOD_SHALLOW_UNFORTUNATELY_PUB MONGO_MOD_ATTR_(shallow::unfortunately_public)
//
// Implementation details for MONGO_MOD macros
//
#if MONGO_COMPILER_HAS_ATTRIBUTE(clang::annotate)
#define MONGO_MOD_ATTR_(attr) [[clang::annotate("mongo::mod::" #attr)]]
#else
#define MONGO_MOD_ATTR_(attr)
#endif