diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2021-11-12 15:46:14 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-13 01:59:49 +0000 |
commit | b4517954a706b9f49b17d423f179113aa8632565 (patch) | |
tree | ecf797ef397130c95f817e252636ad6d89996f59 /src/mongo/db/multitenancy.h | |
parent | 81a1605fc1443bfd87c9d9aa3bfb1b34ec332fef (diff) | |
download | mongo-b4517954a706b9f49b17d423f179113aa8632565.tar.gz |
SERVER-61450 Create a unique OID for System Tenant
Diffstat (limited to 'src/mongo/db/multitenancy.h')
-rw-r--r-- | src/mongo/db/multitenancy.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mongo/db/multitenancy.h b/src/mongo/db/multitenancy.h new file mode 100644 index 00000000000..fdd00a2c1a4 --- /dev/null +++ b/src/mongo/db/multitenancy.h @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2021-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/bson/oid.h" + +namespace mongo { + +/** + * kSystemTenantID must be unique across all possible tenant IDs. + * Since the first four bytes of an OID are a unix epoch timestamp, + * we can simply select a value prior to the inception of MongoDB, + * and be guaranteed to never have a collision with a value + * produced by OID::gen(). + */ +const OID kSystemTenantID( + "15650000" /* timestamp: 1981-05-17 */ + "0102030405" /* process id */ + "060708" /* counter */); + +} // namespace mongo |