1 /* 2 * ClientDBInfo.h 3 * 4 * This source file is part of the FoundationDB open source project 5 * 6 * Copyright 2013-2018 Apple Inc. and the FoundationDB project authors 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 #ifndef FDBCLIENT_CLIENTDBINFO_H 22 #define FDBCLIENT_CLIENTDBINFO_H 23 #pragma once 24 25 #include "fdbclient/MasterProxyInterface.h" 26 27 // ClientDBInfo is all the information needed by a database client to access the database 28 // It is returned (and kept up to date) by the OpenDatabaseRequest interface of ClusterInterface 29 struct ClientDBInfo { 30 UID id; // Changes each time anything else changes 31 vector< MasterProxyInterface > proxies; 32 double clientTxnInfoSampleRate; 33 int64_t clientTxnInfoSizeLimit; ClientDBInfoClientDBInfo34 ClientDBInfo() : clientTxnInfoSampleRate(std::numeric_limits<double>::infinity()), clientTxnInfoSizeLimit(-1) {} 35 36 bool operator == (ClientDBInfo const& r) const { return id == r.id; } 37 bool operator != (ClientDBInfo const& r) const { return id != r.id; } 38 39 template <class Archive> serializeClientDBInfo40 void serialize(Archive& ar) { 41 ASSERT( ar.protocolVersion() >= 0x0FDB00A200040001LL ); 42 serializer(ar, proxies, id, clientTxnInfoSampleRate, clientTxnInfoSizeLimit); 43 } 44 }; 45 46 #endif 47