From f9eca3884bbf687bf428f3bea85606e87575c561 Mon Sep 17 00:00:00 2001 From: Markus Pilman Date: Tue, 12 Apr 2022 12:02:43 -0600 Subject: [PATCH 0001/1244] implemented base logic --- fdbclient/NativeAPI.actor.cpp | 6 ++- fdbclient/StorageServerInterface.h | 17 +------ fdbclient/Tenant.h | 6 +-- fdbclient/vexillographer/fdb.options | 4 ++ fdbrpc/FlowTransport.actor.cpp | 31 +++++++++--- fdbrpc/FlowTransport.h | 2 + fdbrpc/TenantAuth.h | 4 ++ fdbrpc/TenantInfo.actor.h | 70 ++++++++++++++++++++++++++++ fdbrpc/TenantInfo.h | 52 ++++++--------------- fdbrpc/TokenSign.cpp | 10 ---- fdbrpc/TokenSign.h | 8 ++-- fdbrpc/fdbrpc.h | 6 ++- 12 files changed, 137 insertions(+), 79 deletions(-) create mode 100644 fdbrpc/TenantAuth.h create mode 100644 fdbrpc/TenantInfo.actor.h diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index ab8c957d53..c24bfb50ce 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -2449,6 +2449,10 @@ void setNetworkOption(FDBNetworkOptions::Option option, Optional valu case FDBNetworkOptions::EXTERNAL_CLIENT: networkOptions.primaryClient = false; break; + case FDBNetworkOptions::AUTHORIZATION_TOKEN_ADD: + validateOptionValuePresent(value); + FlowTransport::transport().authorizationTokenAdd(value.get()); + break; default: break; } @@ -9389,4 +9393,4 @@ ACTOR Future waitPurgeGranulesCompleteActor(Reference db, Future DatabaseContext::waitPurgeGranulesComplete(Key purgeKey) { return waitPurgeGranulesCompleteActor(Reference::addRef(this), purgeKey); -} \ No newline at end of file +} diff --git a/fdbclient/StorageServerInterface.h b/fdbclient/StorageServerInterface.h index 13ba8f1e18..d99697782f 100644 --- a/fdbclient/StorageServerInterface.h +++ b/fdbclient/StorageServerInterface.h @@ -240,21 +240,6 @@ struct ServerCacheInfo { } }; -struct TenantInfo { - static const int64_t INVALID_TENANT = -1; - - Optional name; - int64_t tenantId; - - TenantInfo() : tenantId(INVALID_TENANT) {} - TenantInfo(TenantName name, int64_t tenantId) : name(name), tenantId(tenantId) {} - - template - void serialize(Ar& ar) { - serializer(ar, name, tenantId); - } -}; - struct GetValueReply : public LoadBalancedReply { constexpr static FileIdentifier file_identifier = 1378929; Optional value; @@ -282,6 +267,8 @@ struct GetValueRequest : TimedRequest { // to this client, of all storage replicas that // serve the given key + bool verify() const { return tenantInfo.verified; } + GetValueRequest() {} GetValueRequest(SpanID spanContext, const TenantInfo& tenantInfo, diff --git a/fdbclient/Tenant.h b/fdbclient/Tenant.h index 221ae451bb..dc05dc003c 100644 --- a/fdbclient/Tenant.h +++ b/fdbclient/Tenant.h @@ -24,11 +24,9 @@ #include "fdbclient/FDBTypes.h" #include "fdbclient/VersionedMap.h" +#include "fdbrpc/TenantInfo.h" #include "flow/flat_buffers.h" -typedef StringRef TenantNameRef; -typedef Standalone TenantName; - struct TenantMapEntry { constexpr static FileIdentifier file_identifier = 12247338; @@ -83,4 +81,4 @@ public: typedef VersionedMap TenantMap; typedef VersionedMap TenantPrefixIndex; -#endif \ No newline at end of file +#endif diff --git a/fdbclient/vexillographer/fdb.options b/fdbclient/vexillographer/fdb.options index 9f2f9e52f9..bfe95457fe 100644 --- a/fdbclient/vexillographer/fdb.options +++ b/fdbclient/vexillographer/fdb.options @@ -145,6 +145,10 @@ description is not currently required but encouraged. description="This option tells a child on a multiversion client what transport ID to use." paramType="Int" paramDescription="Transport ID for the child connection" hidden="true" /> +