Replace & operator with variadic function

This commit is contained in:
anoyes 2018-12-28 10:49:26 -08:00
parent 9881b1d074
commit 6a4d87802b
52 changed files with 235 additions and 306 deletions

View File

@ -87,7 +87,7 @@ namespace FDB {
template <class Ar>
void serialize( Ar& ar ) {
ar & key & orEqual & offset;
serializer(ar, key, orEqual, offset);
}
};
inline bool operator == (const KeySelectorRef& lhs, const KeySelectorRef& rhs) { return lhs.key == rhs.key && lhs.orEqual==rhs.orEqual && lhs.offset==rhs.offset; }
@ -123,7 +123,7 @@ namespace FDB {
int expectedSize() const { return key.expectedSize() + value.expectedSize(); }
template <class Ar>
force_inline void serialize(Ar& ar) { ar & key & value; }
force_inline void serialize(Ar& ar) { serializer(ar, key, value); }
struct OrderByKey {
bool operator()(KeyValueRef const& a, KeyValueRef const& b) const {
@ -171,7 +171,7 @@ namespace FDB {
template <class Ar>
void serialize( Ar& ar ) {
ar & ((VectorRef<KeyValueRef>&)*this) & more & readThrough & readToBegin & readThroughEnd;
serializer(ar, ((VectorRef<KeyValueRef>&)*this), more, readThrough, readToBegin, readThroughEnd);
}
};
@ -234,7 +234,7 @@ namespace FDB {
template <class Ar>
force_inline void serialize(Ar& ar) {
ar & const_cast<KeyRef&>(begin) & const_cast<KeyRef&>(end);
serializer(ar, const_cast<KeyRef&>(begin), const_cast<KeyRef&>(end));
if( begin > end ) {
throw inverted_range();
};

View File

@ -415,7 +415,7 @@ struct RCGroup {
template <class Ar>
void serialize(Ar& ar) {
ar & items & version & groupKey;
serializer(ar, items, version, groupKey);
}
};

View File

@ -39,8 +39,8 @@ struct ClientDBInfo {
template <class Archive>
void serialize(Archive& ar) {
ASSERT( ar.protocolVersion() >= 0x0FDB00A200040001LL );
ar & proxies & id & clientTxnInfoSampleRate & clientTxnInfoSizeLimit;
serializer(ar, proxies, id, clientTxnInfoSampleRate, clientTxnInfoSizeLimit);
}
};
#endif
#endif

View File

@ -39,7 +39,7 @@ namespace FdbClientLogEvents {
Event(EventType t, double ts) : type(t), startTs(ts) { }
Event() { }
template <typename Ar> Ar& serialize(Ar &ar) { return ar & type & startTs; }
template <typename Ar> Ar& serialize(Ar &ar) { return serializer(ar, type, startTs); }
EventType type{ EVENTTYPEEND };
double startTs{ 0 };
@ -53,9 +53,9 @@ namespace FdbClientLogEvents {
template <typename Ar> Ar& serialize(Ar &ar) {
if (!ar.isDeserializing)
return Event::serialize(ar) & latency;
return serializer(Event::serialize(ar), latency);
else
return ar & latency;
return serializer(ar, latency);
}
double latency;
@ -71,9 +71,9 @@ namespace FdbClientLogEvents {
template <typename Ar> Ar& serialize(Ar &ar) {
if (!ar.isDeserializing)
return Event::serialize(ar) & latency & valueSize & key;
return serializer(Event::serialize(ar), latency, valueSize, key);
else
return ar & latency & valueSize & key;
return serializer(ar, latency, valueSize, key);
}
double latency;
@ -91,9 +91,9 @@ namespace FdbClientLogEvents {
template <typename Ar> Ar& serialize(Ar &ar) {
if (!ar.isDeserializing)
return Event::serialize(ar) & latency & rangeSize & startKey & endKey;
return serializer(Event::serialize(ar), latency, rangeSize, startKey, endKey);
else
return ar & latency & rangeSize & startKey & endKey;
return serializer(ar, latency, rangeSize, startKey, endKey);
}
double latency;
@ -112,9 +112,9 @@ namespace FdbClientLogEvents {
template <typename Ar> Ar& serialize(Ar &ar) {
if (!ar.isDeserializing)
return Event::serialize(ar) & latency & numMutations & commitBytes & req.transaction & req.arena;
return serializer(Event::serialize(ar), latency, numMutations, commitBytes, req.transaction, req.arena);
else
return ar & latency & numMutations & commitBytes & req.transaction & req.arena;
return serializer(ar, latency, numMutations, commitBytes, req.transaction, req.arena);
}
double latency;
@ -145,9 +145,9 @@ namespace FdbClientLogEvents {
template <typename Ar> Ar& serialize(Ar &ar) {
if (!ar.isDeserializing)
return Event::serialize(ar) & errCode & key;
return serializer(Event::serialize(ar), errCode, key);
else
return ar & errCode & key;
return serializer(ar, errCode, key);
}
int errCode;
@ -164,9 +164,9 @@ namespace FdbClientLogEvents {
template <typename Ar> Ar& serialize(Ar &ar) {
if (!ar.isDeserializing)
return Event::serialize(ar) & errCode & startKey & endKey;
return serializer(Event::serialize(ar), errCode, startKey, endKey);
else
return ar & errCode & startKey & endKey;
return serializer(ar, errCode, startKey, endKey);
}
int errCode;
@ -184,9 +184,9 @@ namespace FdbClientLogEvents {
template <typename Ar> Ar& serialize(Ar &ar) {
if (!ar.isDeserializing)
return Event::serialize(ar) & errCode & req.transaction & req.arena;
return serializer(Event::serialize(ar), errCode, req.transaction, req.arena);
else
return ar & errCode & req.transaction & req.arena;
return serializer(ar, errCode, req.transaction, req.arena);
}
int errCode;

View File

@ -40,7 +40,7 @@ struct ClientWorkerInterface {
template <class Ar>
void serialize( Ar& ar ) {
ar & reboot & profiler;
serializer(ar, reboot, profiler);
}
};
@ -52,7 +52,7 @@ struct RebootRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & deleteData & checkData;
serializer(ar, deleteData, checkData);
}
};
@ -77,7 +77,7 @@ struct ProfilerRequest {
template<class Ar>
void serialize( Ar& ar ) {
ar & reply & type & action & duration & outputFile;
serializer(ar, reply, type, action, duration, outputFile);
}
};
BINARY_SERIALIZABLE( ProfilerRequest::Type );

View File

@ -52,7 +52,7 @@ struct ClusterInterface {
template <class Ar>
void serialize( Ar& ar ) {
ar & openDatabase & failureMonitoring & databaseStatus & ping & getClientWorkers & forceRecovery;
serializer(ar, openDatabase, failureMonitoring, databaseStatus, ping, getClientWorkers, forceRecovery);
}
};
@ -93,7 +93,7 @@ struct ClientVersionRef {
template <class Ar>
void serialize(Ar& ar) {
ar & clientVersion & sourceVersion & protocolVersion;
serializer(ar, clientVersion, sourceVersion, protocolVersion);
}
size_t expectedSize() const { return clientVersion.size() + sourceVersion.size() + protocolVersion.size(); }
@ -125,7 +125,7 @@ struct OpenDatabaseRequest {
template <class Ar>
void serialize(Ar& ar) {
ASSERT( ar.protocolVersion() >= 0x0FDB00A400040001LL );
ar & issues & supportedVersions & traceLogGroup & knownClientInfoID & reply & arena;
serializer(ar, issues, supportedVersions, traceLogGroup, knownClientInfoID, reply, arena);
}
};
@ -138,7 +138,7 @@ struct SystemFailureStatus {
template <class Ar>
void serialize(Ar& ar) {
ar & address & status;
serializer(ar, address, status);
}
};
@ -159,7 +159,7 @@ struct FailureMonitoringRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & senderStatus & failureInformationVersion & reply;
serializer(ar, senderStatus, failureInformationVersion, reply);
}
};
@ -173,7 +173,7 @@ struct FailureMonitoringReply {
template <class Ar>
void serialize(Ar& ar) {
ar & changes & failureInformationVersion & allOthersFailed & clientRequestIntervalMS & considerServerFailedTimeoutMS & arena;
serializer(ar, changes, failureInformationVersion, allOthersFailed, clientRequestIntervalMS, considerServerFailedTimeoutMS, arena);
}
};
@ -182,7 +182,7 @@ struct StatusRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & reply;
serializer(ar, reply);
}
};
@ -196,7 +196,7 @@ struct StatusReply {
template <class Ar>
void serialize(Ar& ar) {
ar & statusStr;
serializer(ar, statusStr);
if( ar.isDeserializing ) {
json_spirit::mValue mv;
if(g_network->isSimulated()) {
@ -218,7 +218,7 @@ struct GetClientWorkersRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & reply;
serializer(ar, reply);
}
};
@ -229,7 +229,7 @@ struct ForceRecoveryRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & reply;
serializer(ar, reply);
}
};

View File

@ -50,7 +50,7 @@ struct MutationRef {
template <class Ar>
void serialize( Ar& ar ) {
ar & type & param1 & param2;
serializer(ar, type, param1, param2);
}
// These masks define which mutation types have particular properties (they are used to implement isSingleKeyMutation() etc)
@ -101,7 +101,7 @@ struct CommitTransactionRef {
template <class Ar>
force_inline void serialize( Ar& ar ) {
ar & read_conflict_ranges & write_conflict_ranges & mutations & read_snapshot;
serializer(ar, read_conflict_ranges, write_conflict_ranges, mutations, read_snapshot);
}
// Convenience for internal code required to manipulate these without the Native API

View File

@ -122,7 +122,7 @@ struct LeaderInfo {
template <class Ar>
void serialize(Ar& ar) {
ar & changeID & serializedInfo & forward;
serializer(ar, changeID, serializedInfo, forward);
}
};
@ -136,7 +136,7 @@ struct GetLeaderRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & key & knownLeader & reply;
serializer(ar, key, knownLeader, reply);
}
};

View File

@ -41,7 +41,7 @@ struct SatelliteInfo {
template <class Ar>
void serialize(Ar& ar) {
ar & dcId & priority;
serializer(ar, dcId, priority);
}
};
@ -71,8 +71,8 @@ struct RegionInfo {
template <class Ar>
void serialize(Ar& ar) {
ar & dcId & priority & satelliteTLogPolicy & satelliteDesiredTLogCount & satelliteTLogReplicationFactor & satelliteTLogWriteAntiQuorum & satelliteTLogUsableDcs &
satelliteTLogPolicyFallback & satelliteTLogReplicationFactorFallback & satelliteTLogWriteAntiQuorumFallback & satelliteTLogUsableDcsFallback & satellites;
serializer(ar, dcId, priority, satelliteTLogPolicy, satelliteDesiredTLogCount, satelliteTLogReplicationFactor, satelliteTLogWriteAntiQuorum, satelliteTLogUsableDcs,
satelliteTLogPolicyFallback, satelliteTLogReplicationFactorFallback, satelliteTLogWriteAntiQuorumFallback, satelliteTLogUsableDcsFallback, satellites);
}
};
@ -203,7 +203,7 @@ struct DatabaseConfiguration {
template <class Ar>
void serialize(Ar& ar) {
if (!ar.isDeserializing) makeConfigurationImmutable();
ar & rawConfiguration;
serializer(ar, rawConfiguration);
if (ar.isDeserializing) {
for(auto c=rawConfiguration.begin(); c!=rawConfiguration.end(); ++c)
setInternal(c->key, c->value);

View File

@ -53,7 +53,7 @@ struct Tag {
template <class Ar>
force_inline void serialize_unversioned(Ar& ar) {
ar & locality & id;
serializer(ar, locality, id);
}
};
#pragma pack(pop)
@ -193,7 +193,7 @@ struct KeyRangeRef {
template <class Ar>
force_inline void serialize(Ar& ar) {
ar & const_cast<KeyRef&>(begin) & const_cast<KeyRef&>(end);
serializer(ar, const_cast<KeyRef&>(begin), const_cast<KeyRef&>(end));
if( begin > end ) {
throw inverted_range();
};
@ -227,7 +227,7 @@ struct KeyValueRef {
int expectedSize() const { return key.expectedSize() + value.expectedSize(); }
template <class Ar>
force_inline void serialize(Ar& ar) { ar & key & value; }
force_inline void serialize(Ar& ar) { serializer(ar, key, value); }
struct OrderByKey {
bool operator()(KeyValueRef const& a, KeyValueRef const& b) const {
@ -385,7 +385,7 @@ public:
template <class Ar>
void serialize( Ar& ar ) {
ar & key & orEqual & offset;
serializer(ar, key, orEqual, offset);
}
};
@ -418,7 +418,7 @@ struct KeyRangeWith : KeyRange {
template <class Ar>
void serialize( Ar& ar ) {
ar & ((KeyRange&)*this) & value;
serializer(ar, ((KeyRange&)*this), value);
}
};
template <class Val>
@ -470,7 +470,7 @@ struct RangeResultRef : VectorRef<KeyValueRef> {
template <class Ar>
void serialize( Ar& ar ) {
ar & ((VectorRef<KeyValueRef>&)*this) & more & readThrough & readToBegin & readThroughEnd;
serializer(ar, ((VectorRef<KeyValueRef>&)*this), more, readThrough, readToBegin, readThroughEnd);
}
};
@ -492,7 +492,7 @@ struct KeyValueStoreType {
operator StoreType() const { return StoreType(type); }
template <class Ar>
void serialize(Ar& ar) { ar & type; }
void serialize(Ar& ar) { serializer(ar, type); }
std::string toString() const {
switch( type ) {
@ -520,7 +520,7 @@ struct StorageBytes {
template <class Ar>
void serialize(Ar& ar) {
ar & free & total & used & available;
serializer(ar, free, total, used, available);
}
};
@ -639,7 +639,7 @@ struct ClusterControllerPriorityInfo {
template <class Ar>
void serialize(Ar& ar) {
ar & processClassFitness & isExcluded & dcFitness;
serializer(ar, processClassFitness, isExcluded, dcFitness);
}
};

View File

@ -50,7 +50,7 @@ struct MasterProxyInterface {
template <class Archive>
void serialize(Archive& ar) {
ar & locality & commit & getConsistentReadVersion & getKeyServersLocations & waitFailure & getStorageServerRejoinInfo & getRawCommittedVersion & txnState;
serializer(ar, locality, commit, getConsistentReadVersion, getKeyServersLocations, waitFailure, getStorageServerRejoinInfo, getRawCommittedVersion, txnState);
}
void initEndpoints() {
@ -67,7 +67,7 @@ struct CommitID {
template <class Ar>
void serialize(Ar& ar) {
ar & version & txnBatchId;
serializer(ar, version, txnBatchId);
}
CommitID() : version(invalidVersion), txnBatchId(0) {}
@ -93,7 +93,7 @@ struct CommitTransactionRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & transaction & reply & arena & flags & debugID;
serializer(ar, transaction, reply, arena, flags, debugID);
}
};
@ -116,7 +116,7 @@ struct GetReadVersionReply {
template <class Ar>
void serialize(Ar& ar) {
ar & version & locked;
serializer(ar, version, locked);
}
};
@ -144,7 +144,7 @@ struct GetReadVersionRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & transactionCount & flags & debugID & reply;
serializer(ar, transactionCount, flags, debugID, reply);
}
};
@ -154,7 +154,7 @@ struct GetKeyServerLocationsReply {
template <class Ar>
void serialize(Ar& ar) {
ar & results & arena;
serializer(ar, results, arena);
}
};
@ -171,7 +171,7 @@ struct GetKeyServerLocationsRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & begin & end & limit & reverse & reply & arena;
serializer(ar, begin, end, limit, reverse, reply, arena);
}
};
@ -183,7 +183,7 @@ struct GetRawCommittedVersionRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & debugID & reply;
serializer(ar, debugID, reply);
}
};
@ -196,7 +196,7 @@ struct GetStorageServerRejoinInfoReply {
template <class Ar>
void serialize(Ar& ar) {
ar & version & tag & newTag & newLocality & history;
serializer(ar, version, tag, newTag, newLocality, history);
}
};
@ -210,7 +210,7 @@ struct GetStorageServerRejoinInfoRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & id & dcId & reply;
serializer(ar, id, dcId, reply);
}
};
@ -223,7 +223,7 @@ struct TxnStateRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & data & sequence & last & reply & arena;
serializer(ar, data, sequence, last, reply, arena);
}
};

View File

@ -132,7 +132,7 @@ public:
template <class Ar>
void serialize_load( Ar& ar ) {
ar & totalBytes;
serializer(ar, totalBytes);
if(totalBytes > 0) {
blob_begin = blob_end = new (ar.arena()) Blob;
@ -142,7 +142,7 @@ public:
}
template <class Ar>
void serialize_save( Ar& ar ) const {
ar & totalBytes;
serializer(ar, totalBytes);
for(auto b = blob_begin; b; b=b->next)
ar.serializeBytes(b->data);
}

View File

@ -68,11 +68,11 @@ struct StorageServerInterface {
void serialize( Ar& ar ) {
// StorageServerInterface is persisted in the database and in the tLog's data structures, so changes here have to be
// versioned carefully!
ar & uniqueID & locality & getVersion & getValue & getKey & getKeyValues & getShardState & waitMetrics
& splitMetrics & getPhysicalMetrics & waitFailure & getQueuingMetrics & getKeyValueStoreType;
serializer(ar, uniqueID, locality, getVersion, getValue, getKey, getKeyValues, getShardState, waitMetrics,
splitMetrics, getPhysicalMetrics, waitFailure, getQueuingMetrics, getKeyValueStoreType);
if( ar.protocolVersion() >= 0x0FDB00A200090001LL )
ar & watchValue;
serializer(ar, watchValue);
}
bool operator == (StorageServerInterface const& s) const { return uniqueID == s.uniqueID; }
bool operator < (StorageServerInterface const& s) const { return uniqueID < s.uniqueID; }
@ -103,7 +103,7 @@ struct GetValueReply : public LoadBalancedReply {
template <class Ar>
void serialize( Ar& ar ) {
ar & *(LoadBalancedReply*)this & value;
serializer(ar, *(LoadBalancedReply*)this, value);
}
};
@ -118,7 +118,7 @@ struct GetValueRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & key & version & debugID & reply;
serializer(ar, key, version, debugID, reply);
}
};
@ -134,7 +134,7 @@ struct WatchValueRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & key & value & version & debugID & reply;
serializer(ar, key, value, version, debugID, reply);
}
};
@ -146,7 +146,7 @@ struct GetKeyValuesReply : public LoadBalancedReply {
template <class Ar>
void serialize( Ar& ar ) {
ar & *(LoadBalancedReply*)this & data & version & more & arena;
serializer(ar, *(LoadBalancedReply*)this, data, version, more, arena);
}
};
@ -162,7 +162,7 @@ struct GetKeyValuesRequest {
// GetKeyValuesRequest(const KeySelectorRef& begin, const KeySelectorRef& end, Version version, int limit, int limitBytes, Optional<UID> debugID) : begin(begin), end(end), version(version), limit(limit), limitBytes(limitBytes) {}
template <class Ar>
void serialize( Ar& ar ) {
ar & begin & end & version & limit & limitBytes & debugID & reply & arena;
serializer(ar, begin, end, version, limit, limitBytes, debugID, reply, arena);
}
};
@ -174,7 +174,7 @@ struct GetKeyReply : public LoadBalancedReply {
template <class Ar>
void serialize( Ar& ar ) {
ar & *(LoadBalancedReply*)this & sel;
serializer(ar, *(LoadBalancedReply*)this, sel);
}
};
@ -189,7 +189,7 @@ struct GetKeyRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & sel & version & reply & arena;
serializer(ar, sel, version, reply, arena);
}
};
@ -208,7 +208,7 @@ struct GetShardStateRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & keys & mode & reply;
serializer(ar, keys, mode, reply);
}
};
@ -244,7 +244,7 @@ struct StorageMetrics {
template <class Ar>
void serialize( Ar& ar ) {
ar & bytes & bytesPerKSecond & iosPerKSecond;
serializer(ar, bytes, bytesPerKSecond, iosPerKSecond);
}
void negate() { operator*=(-1.0); }
@ -278,7 +278,7 @@ struct WaitMetricsRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & keys & min & max & reply & arena;
serializer(ar, keys, min, max, reply, arena);
}
};
@ -288,7 +288,7 @@ struct SplitMetricsReply {
template <class Ar>
void serialize( Ar& ar ) {
ar & splits & used;
serializer(ar, splits, used);
}
};
@ -306,7 +306,7 @@ struct SplitMetricsRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & keys & limits & used & estimated & isLastShard & reply & arena;
serializer(ar, keys, limits, used, estimated, isLastShard, reply, arena);
}
};
@ -317,7 +317,7 @@ struct GetPhysicalMetricsReply {
template <class Ar>
void serialize(Ar& ar) {
ar & load & free & capacity;
serializer(ar, load, free, capacity);
}
};
@ -326,7 +326,7 @@ struct GetPhysicalMetricsRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & reply;
serializer(ar, reply);
}
};
@ -336,7 +336,7 @@ struct StorageQueuingMetricsRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & reply;
serializer(ar, reply);
}
};
@ -349,7 +349,7 @@ struct StorageQueuingMetricsReply {
template <class Ar>
void serialize(Ar& ar) {
ar & localTime & instanceID & bytesDurable & bytesInput & v & storageBytes;
serializer(ar, localTime, instanceID, bytesDurable, bytesInput, v, storageBytes);
}
};

View File

@ -1,74 +0,0 @@
/*
* EndpointGroup.h
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FLOW_ENDPOINT_GROUP_H
#define FLOW_ENDPOINT_GROUP_H
#pragma once
#include "fdbrpc/flow.h"
// EndpointGroup makes it easier to implement backward compatibility for interface serialization
// It also provides a central place to implement more compact serialization for a group of related endpoints in the future.
/* Typical usage:
template <class Ar>
void serialize(Ar& ar) {
auto endpoints = endpointGroup(ar);
endpoints.require( ar.protocolVersion() <= currentProtocolVersion );
endpoints & apple & banana;
endpoints.require( ar.protocolVersion() >= 0xabc ); // Following endpoints added in this version
endpoints & cherry;
endpoints.require( ar.protocolVersion() >= 0xdef ); // .. and then some more were added
endpoints & date;
}
*/
template <class Ar>
struct EndpointGroup : NonCopyable {
Ar& ar;
bool enabled;
explicit EndpointGroup( Ar& ar ) : ar(ar), enabled(true) {
ASSERT( ar.protocolVersion() != 0 );
}
EndpointGroup( EndpointGroup&& g ) : ar(g.ar), enabled(g.enabled) {}
EndpointGroup& require( bool condition ) {
enabled = enabled && condition;
return *this;
}
template <class T>
EndpointGroup& operator & (PromiseStream<T>& stream) {
if (enabled)
ar & stream;
else if (Ar::isDeserializing)
stream.sendError( incompatible_protocol_version() );
return *this;
}
};
template <class Ar>
EndpointGroup<Ar> endpointGroup( Ar& ar ) { return EndpointGroup<Ar>(ar); }
#endif

View File

@ -74,7 +74,7 @@ struct FailureStatus {
bool operator != (FailureStatus const& r) const { return failed != r.failed; }
template <class Ar>
void serialize(Ar& ar) {
ar & failed;
serializer(ar, failed);
}
};
@ -141,4 +141,4 @@ private:
friend class OnStateChangedActorActor;
};
#endif
#endif

View File

@ -71,7 +71,7 @@ struct LoadBalancedReply {
template <class Ar>
void serialize(Ar &ar) {
ar & penalty;
serializer(ar, penalty);
}
};

View File

@ -110,7 +110,7 @@ public:
template <class Ar>
void serialize(Ar& ar) {
ar & _class & _source;
serializer(ar, _class, _source);
}
};
@ -188,10 +188,10 @@ public:
Standalone<StringRef> key;
Optional<Standalone<StringRef>> value;
uint64_t mapSize = (uint64_t)_data.size();
ar & mapSize;
serializer(ar, mapSize);
if (ar.isDeserializing) {
for (size_t i = 0; i < mapSize; i++) {
ar & key & value;
serializer(ar, key, value);
_data[key] = value;
}
}
@ -199,24 +199,24 @@ public:
for (auto it = _data.begin(); it != _data.end(); it++) {
key = it->first;
value = it->second;
ar & key & value;
serializer(ar, key, value);
}
}
}
else {
ASSERT(ar.isDeserializing);
UID zoneId, dcId, processId;
ar & zoneId & dcId;
serializer(ar, zoneId, dcId);
set(keyZoneId, Standalone<StringRef>(zoneId.toString()));
set(keyDcId, Standalone<StringRef>(dcId.toString()));
if (ar.protocolVersion() >= 0x0FDB00A340000001LL) {
ar & processId;
serializer(ar, processId);
set(keyProcessId, Standalone<StringRef>(processId.toString()));
}
else {
int _machineClass = ProcessClass::UnsetClass;
ar & _machineClass;
serializer(ar, _machineClass);
}
}
}
@ -258,7 +258,7 @@ struct ProcessData {
template <class Ar>
void serialize(Ar& ar) {
ar & locality & processClass & address;
serializer(ar, locality, processClass, address);
}
struct sort_by_address {

View File

@ -43,7 +43,7 @@ struct PerfMetric {
template <class Ar>
void serialize( Ar& ar ) {
ar & m_name & m_format_code & m_value & m_averaged;
serializer(ar, m_name, m_format_code, m_value, m_averaged);
}
private:
@ -106,4 +106,4 @@ struct GlobalCounters {
extern GlobalCounters g_counters;
#endif
#endif

View File

@ -136,7 +136,7 @@ struct PolicyAcross : IReplicationPolicy, public ReferenceCounted<PolicyAcross>
template <class Ar>
void serialize(Ar& ar) {
ar & _attribKey & _count;
serializer(ar, _attribKey, _count);
serializeReplicationPolicy(ar, _policy);
}
@ -207,7 +207,7 @@ struct PolicyAnd : IReplicationPolicy, public ReferenceCounted<PolicyAnd> {
template <class Ar>
void serialize(Ar& ar) {
int count = _policies.size();
ar & count;
serializer(ar, count);
_policies.resize(count);
for(int i = 0; i < count; i++) {
serializeReplicationPolicy(ar, _policies[i]);
@ -233,7 +233,7 @@ template <class Ar>
void serializeReplicationPolicy(Ar& ar, IRepPolicyRef& policy) {
if(Ar::isDeserializing) {
StringRef name;
ar & name;
serializer(ar, name);
if(name == LiteralStringRef("One")) {
PolicyOne* pointer = new PolicyOne();
@ -261,7 +261,7 @@ void serializeReplicationPolicy(Ar& ar, IRepPolicyRef& policy) {
else {
std::string name = policy ? policy->name() : "None";
Standalone<StringRef> nameRef = StringRef(name);
ar & nameRef;
serializer(ar, nameRef);
if(name == "One") {
((PolicyOne*)policy.getPtr())->serialize(ar);
}

View File

@ -925,7 +925,7 @@ struct AddReply {
template <class Ar>
void serialize(Ar& ar) {
ar & sum;
serializer(ar, sum);
}
};
@ -938,7 +938,7 @@ struct AddRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & a & b & reply;
serializer(ar, a, b, reply);
}
};

View File

@ -74,7 +74,6 @@
<ClInclude Include="AsyncFileWriteChecker.h" />
<ClInclude Include="ContinuousSample.h" />
<ClInclude Include="crc32c.h" />
<ClInclude Include="EndpointGroup.h" />
<ClInclude Include="FailureMonitor.h" />
<ActorCompiler Include="LoadBalance.actor.h">
<EnableCompile>false</EnableCompile>

View File

@ -137,7 +137,6 @@
<ClInclude Include="Platform.h" />
<ClInclude Include="ActorFuzz.h" />
<ClInclude Include="ContinuousSample.h" />
<ClInclude Include="EndpointGroup.h" />
<ClInclude Include="fdbrpc.h" />
<ClInclude Include="MultiInterface.h" />
<ClInclude Include="PerfMetric.h" />

View File

@ -61,7 +61,7 @@ struct ClusterControllerFullInterface {
template <class Ar>
void serialize( Ar& ar ) {
ASSERT( ar.protocolVersion() >= 0x0FDB00A200040001LL );
ar & clientInterface & recruitFromConfiguration & recruitRemoteFromConfiguration & recruitStorage & registerWorker & getWorkers & registerMaster & getServerDBInfo;
serializer(ar, clientInterface, recruitFromConfiguration, recruitRemoteFromConfiguration, recruitStorage, registerWorker, getWorkers, registerMaster, getServerDBInfo);
}
};
@ -77,7 +77,7 @@ struct RecruitFromConfigurationRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & configuration & recruitSeedServers & maxOldLogRouters & reply;
serializer(ar, configuration, recruitSeedServers, maxOldLogRouters, reply);
}
};
@ -95,7 +95,7 @@ struct RecruitFromConfigurationReply {
template <class Ar>
void serialize( Ar& ar ) {
ar & tLogs & satelliteTLogs & proxies & resolvers & storageServers & oldLogRouters & dcId & satelliteFallback;
serializer(ar, tLogs, satelliteTLogs, proxies, resolvers, storageServers, oldLogRouters, dcId, satelliteFallback);
}
};
@ -110,7 +110,7 @@ struct RecruitRemoteFromConfigurationRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & configuration & dcId & logRouterCount & reply;
serializer(ar, configuration, dcId, logRouterCount, reply);
}
};
@ -120,7 +120,7 @@ struct RecruitRemoteFromConfigurationReply {
template <class Ar>
void serialize( Ar& ar ) {
ar & remoteTLogs & logRouters;
serializer(ar, remoteTLogs, logRouters);
}
};
@ -130,7 +130,7 @@ struct RecruitStorageReply {
template <class Ar>
void serialize( Ar& ar ) {
ar & worker & processClass;
serializer(ar, worker, processClass);
}
};
@ -143,7 +143,7 @@ struct RecruitStorageRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & excludeMachines & excludeAddresses & includeDCs & criticalRecruitment & reply;
serializer(ar, excludeMachines, excludeAddresses, includeDCs, criticalRecruitment, reply);
}
};
@ -156,7 +156,7 @@ struct RegisterWorkerReply {
template <class Ar>
void serialize( Ar& ar ) {
ar & processClass & priorityInfo;
serializer(ar, processClass, priorityInfo);
}
};
@ -174,7 +174,7 @@ struct RegisterWorkerRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & wi & initialClass & processClass & priorityInfo & generation & reply;
serializer(ar, wi, initialClass, processClass, priorityInfo, generation, reply);
}
};
@ -189,7 +189,7 @@ struct GetWorkersRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & flags & reply;
serializer(ar, flags, reply);
}
};
@ -213,7 +213,7 @@ struct RegisterMasterRequest {
template <class Ar>
void serialize( Ar& ar ) {
ASSERT( ar.protocolVersion() >= 0x0FDB00A200040001LL );
ar & id & mi & logSystemConfig & proxies & resolvers & recoveryCount & registrationCount & configuration & priorCommittedLogServers & recoveryState & recoveryStalled & reply;
serializer(ar, id, mi, logSystemConfig, proxies, resolvers, recoveryCount, registrationCount, configuration, priorCommittedLogServers, recoveryState, recoveryStalled, reply);
}
};
@ -225,7 +225,7 @@ struct GetServerDBInfoRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & knownServerInfoID & issues & incompatiblePeers & reply;
serializer(ar, knownServerInfoID, issues, incompatiblePeers, reply);
}
};

View File

@ -208,7 +208,7 @@ struct MovableValue {
template <class Ar>
void serialize(Ar& ar) {
ASSERT( ar.protocolVersion() >= 0x0FDB00A2000D0001LL );
ar & value & mode & other;
serializer(ar, value, mode, other);
}
};
@ -316,4 +316,4 @@ MovableCoordinatedState::~MovableCoordinatedState() {
Future<Value> MovableCoordinatedState::read() { return MovableCoordinatedStateImpl::read(impl); }
Future<Void> MovableCoordinatedState::onConflict() { return impl->onConflict(); }
Future<Void> MovableCoordinatedState::setExclusive(Value v) { return impl->setExclusive(v); }
Future<Void> MovableCoordinatedState::move( ClusterConnectionString const& nc ) { return MovableCoordinatedStateImpl::move(impl, nc); }
Future<Void> MovableCoordinatedState::move( ClusterConnectionString const& nc ) { return MovableCoordinatedStateImpl::move(impl, nc); }

View File

@ -33,7 +33,7 @@ struct GenerationRegVal {
Optional<Value> val;
template <class Ar>
void serialize(Ar& ar) {
ar & readGen & writeGen & val;
serializer(ar, readGen, writeGen, val);
}
};

View File

@ -66,7 +66,7 @@ struct UniqueGeneration {
}
template <class Ar>
void serialize(Ar& ar) {
ar & generation & uid;
serializer(ar, generation, uid);
}
};
@ -78,7 +78,7 @@ struct GenerationRegReadRequest {
GenerationRegReadRequest( Key key, UniqueGeneration gen ) : key(key), gen(gen) {}
template <class Ar>
void serialize(Ar& ar) {
ar & key & gen & reply;
serializer(ar, key, gen, reply);
}
};
@ -89,7 +89,7 @@ struct GenerationRegReadReply {
GenerationRegReadReply( Optional<Value> value, UniqueGeneration gen, UniqueGeneration rgen ) : value(value), gen(gen), rgen(rgen) {}
template <class Ar>
void serialize(Ar& ar) {
ar & value & gen & rgen;
serializer(ar, value, gen, rgen);
}
};
@ -101,7 +101,7 @@ struct GenerationRegWriteRequest {
GenerationRegWriteRequest(KeyValue kv, UniqueGeneration gen) : kv(kv), gen(gen) {}
template <class Ar>
void serialize(Ar& ar) {
ar & kv & gen & reply;
serializer(ar, kv, gen, reply);
}
};
@ -126,7 +126,7 @@ struct CandidacyRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & key & myInfo & knownLeader & prevChangeID & reply;
serializer(ar, key, myInfo, knownLeader, prevChangeID, reply);
}
};
@ -141,7 +141,7 @@ struct LeaderHeartbeatRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & key & myInfo & prevChangeID & reply;
serializer(ar, key, myInfo, prevChangeID, reply);
}
};
@ -155,7 +155,7 @@ struct ForwardRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & key & conn & reply;
serializer(ar, key, conn, reply);
}
};
@ -169,4 +169,4 @@ public:
Future<Void> coordinationServer( std::string const& dataFolder );
#endif
#endif

View File

@ -54,7 +54,7 @@ struct CoreTLogSet {
template <class Archive>
void serialize(Archive& ar) {
ar & tLogs & tLogWriteAntiQuorum & tLogReplicationFactor & tLogPolicy & tLogLocalities & isLocal & locality & startVersion & satelliteTagLocations;
serializer(ar, tLogs, tLogWriteAntiQuorum, tLogReplicationFactor, tLogPolicy, tLogLocalities, isLocal, locality, startVersion, satelliteTagLocations);
}
};
@ -72,11 +72,11 @@ struct OldTLogCoreData {
template <class Archive>
void serialize(Archive& ar) {
if( ar.protocolVersion() >= 0x0FDB00A560010001LL) {
ar & tLogs & logRouterTags & epochEnd;
serializer(ar, tLogs, logRouterTags, epochEnd);
}
else if(ar.isDeserializing) {
tLogs.push_back(CoreTLogSet());
ar & tLogs[0].tLogs & tLogs[0].tLogWriteAntiQuorum & tLogs[0].tLogReplicationFactor & tLogs[0].tLogPolicy & epochEnd & tLogs[0].tLogLocalities;
serializer(ar, tLogs[0].tLogs, tLogs[0].tLogWriteAntiQuorum, tLogs[0].tLogReplicationFactor, tLogs[0].tLogPolicy, epochEnd, tLogs[0].tLogLocalities);
}
}
};
@ -122,18 +122,18 @@ struct DBCoreState {
ASSERT(ar.protocolVersion() >= 0x0FDB00A460010001LL);
if(ar.protocolVersion() >= 0x0FDB00A560010001LL) {
ar & tLogs & logRouterTags & oldTLogData & recoveryCount & logSystemType;
serializer(ar, tLogs, logRouterTags, oldTLogData, recoveryCount, logSystemType);
} else if(ar.isDeserializing) {
tLogs.push_back(CoreTLogSet());
ar & tLogs[0].tLogs & tLogs[0].tLogWriteAntiQuorum & recoveryCount & tLogs[0].tLogReplicationFactor & logSystemType;
serializer(ar, tLogs[0].tLogs, tLogs[0].tLogWriteAntiQuorum, recoveryCount, tLogs[0].tLogReplicationFactor, logSystemType);
uint64_t tLocalitySize = (uint64_t)tLogs[0].tLogLocalities.size();
ar & oldTLogData & tLogs[0].tLogPolicy & tLocalitySize;
serializer(ar, oldTLogData, tLogs[0].tLogPolicy, tLocalitySize);
if (ar.isDeserializing) {
tLogs[0].tLogLocalities.reserve(tLocalitySize);
for (size_t i = 0; i < tLocalitySize; i++) {
LocalityData locality;
ar & locality;
serializer(ar, locality);
tLogs[0].tLogLocalities.push_back(locality);
}

View File

@ -60,7 +60,7 @@ struct LogProtocolMessage {
template <class Ar>
void serialize(Ar& ar) {
uint8_t poly = MutationRef::Reserved_For_LogProtocolMessage;
ar & poly;
serializer(ar, poly);
applyVersionStartingHere(ar, IncludeVersion());
}
@ -70,4 +70,4 @@ struct LogProtocolMessage {
template <class Ar> static bool isNextIn(Ar& ar) { return startsLogProtocolMessage(*(const uint8_t*)ar.peekBytes(1)); }
};
#endif
#endif

View File

@ -45,8 +45,8 @@ struct OptionalInterface {
template <class Ar>
void serialize( Ar& ar ) {
ar & iface;
if( !iface.present() ) ar & ident;
serializer(ar, iface);
if( !iface.present() ) serializer(ar, ident);
else ident = iface.get().id();
}
@ -111,7 +111,7 @@ struct TLogSet {
template <class Ar>
void serialize( Ar& ar ) {
ar & tLogs & logRouters & tLogWriteAntiQuorum & tLogReplicationFactor & tLogPolicy & tLogLocalities & isLocal & locality & startVersion & satelliteTagLocations;
serializer(ar, tLogs, logRouters, tLogWriteAntiQuorum, tLogReplicationFactor, tLogPolicy, tLogLocalities, isLocal, locality, startVersion, satelliteTagLocations);
}
};
@ -144,7 +144,7 @@ struct OldTLogConf {
template <class Ar>
void serialize( Ar& ar ) {
ar & tLogs & epochEnd & logRouterTags;
serializer(ar, tLogs, epochEnd, logRouterTags);
}
};
@ -304,7 +304,7 @@ struct LogSystemConfig {
template <class Ar>
void serialize( Ar& ar ) {
ar & logSystemType & tLogs & logRouterTags & oldTLogs & expectedLogSets & recruitmentID & stopped & recoveredAt;
serializer(ar, logSystemType, tLogs, logRouterTags, oldTLogs, expectedLogSets, recruitmentID, stopped, recoveredAt);
}
};

View File

@ -43,7 +43,7 @@ struct MasterInterface {
template <class Archive>
void serialize(Archive& ar) {
ASSERT( ar.protocolVersion() >= 0x0FDB00A200040001LL );
ar & locality & waitFailure & getRateInfo & tlogRejoin & changeCoordinators & getCommitVersion;
serializer(ar, locality, waitFailure, getRateInfo, tlogRejoin, changeCoordinators, getCommitVersion);
}
void initEndpoints() {
@ -61,7 +61,7 @@ struct GetRateInfoRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & requesterID & totalReleasedTransactions & reply;
serializer(ar, requesterID, totalReleasedTransactions, reply);
}
};
@ -71,7 +71,7 @@ struct GetRateInfoReply {
template <class Ar>
void serialize(Ar& ar) {
ar & transactionRate & leaseDuration;
serializer(ar, transactionRate, leaseDuration);
}
};
@ -83,7 +83,7 @@ struct TLogRejoinRequest {
explicit TLogRejoinRequest(const TLogInterface &interf) : myInterface(interf) { }
template <class Ar>
void serialize(Ar& ar) {
ar & myInterface & reply;
serializer(ar, myInterface, reply);
}
};
@ -96,7 +96,7 @@ struct ChangeCoordinatorsRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & newConnectionString & reply;
serializer(ar, newConnectionString, reply);
}
};
@ -121,7 +121,7 @@ struct ResolverMoveRef {
template <class Ar>
void serialize( Ar& ar ) {
ar & range & dest;
serializer(ar, range, dest);
}
};
@ -137,7 +137,7 @@ struct GetCommitVersionReply {
template <class Ar>
void serialize(Ar& ar) {
ar & resolverChanges & resolverChangesVersion & version & prevVersion & requestNum;
serializer(ar, resolverChanges, resolverChangesVersion, version, prevVersion, requestNum);
}
};
@ -153,7 +153,7 @@ struct GetCommitVersionRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & requestNum & mostRecentProcessedRequestNum & requestingProxy & reply;
serializer(ar, requestNum, mostRecentProcessedRequestNum, requestingProxy, reply);
}
};
@ -175,8 +175,8 @@ struct LifetimeToken {
template <class Ar>
void serialize(Ar& ar) {
ar & ccID & count;
serializer(ar, ccID, count);
}
};
#endif
#endif

View File

@ -30,7 +30,7 @@
struct MoveKeysLock {
UID prevOwner, myOwner, prevWrite;
template <class Ar>
void serialize(Ar& ar) { ar & prevOwner & myOwner & prevWrite; }
void serialize(Ar& ar) { serializer(ar, prevOwner, myOwner, prevWrite); }
};
Future<MoveKeysLock> takeMoveKeysLock( Database const& cx, UID const& masterId );
@ -86,4 +86,4 @@ Future<bool> canRemoveStorageServer( Transaction* const& tr, UID const& serverID
// Returns true if the given storage server has no keys assigned to it and may be safely removed
// Obviously that could change later!
#endif
#endif

View File

@ -40,7 +40,7 @@ struct NetworkTestRequest {
NetworkTestRequest( Key key, uint32_t replySize ) : key(key), replySize(replySize) {}
template <class Ar>
void serialize(Ar& ar) {
ar & key & replySize & reply;
serializer(ar, key, replySize, reply);
}
};
@ -50,7 +50,7 @@ struct NetworkTestReply {
NetworkTestReply( Value value ) : value(value) {}
template <class Ar>
void serialize(Ar& ar) {
ar & value;
serializer(ar, value);
}
};
@ -58,4 +58,4 @@ Future<Void> networkTestServer();
Future<Void> networkTestClient( std:: string const& testServers );
#endif
#endif

View File

@ -74,7 +74,7 @@ namespace oldTLog {
template <class Ar>
void serialize(Ar& ar) {
ar & tag & messageOffsets;
serializer(ar, tag, messageOffsets);
}
};
@ -93,9 +93,9 @@ namespace oldTLog {
template <class Ar>
void serialize(Ar& ar) {
if( ar.protocolVersion() >= 0x0FDB00A460010001) {
ar & version & messages & tags & knownCommittedVersion & id;
serializer(ar, version, messages, tags, knownCommittedVersion, id);
} else if(ar.isDeserializing) {
ar & version & messages & tags;
serializer(ar, version, messages, tags);
knownCommittedVersion = 0;
id = UID();
}

View File

@ -49,7 +49,7 @@ struct ResolverInterface {
template <class Ar>
void serialize( Ar& ar ) {
ar & uniqueID & locality & resolve & metrics & split & waitFailure;
serializer(ar, uniqueID, locality, resolve, metrics, split, waitFailure);
}
};
@ -65,7 +65,7 @@ struct StateTransactionRef {
template <class Archive>
void serialize(Archive& ar) {
ar & committed & mutations;
serializer(ar, committed, mutations);
}
};
@ -77,7 +77,7 @@ struct ResolveTransactionBatchReply {
template <class Archive>
void serialize(Archive& ar) {
ar & committed & stateMutations & arena & debugID;
serializer(ar, committed, stateMutations, arena, debugID);
}
};
@ -95,7 +95,7 @@ struct ResolveTransactionBatchRequest {
template <class Archive>
void serialize(Archive& ar) {
ar & prevVersion & version & lastReceivedVersion & transactions & txnStateTransactions & reply & arena & debugID;
serializer(ar, prevVersion, version, lastReceivedVersion, transactions, txnStateTransactions, reply, arena, debugID);
}
};
@ -104,7 +104,7 @@ struct ResolutionMetricsRequest {
template <class Archive>
void serialize(Archive& ar) {
ar & reply;
serializer(ar, reply);
}
};
@ -113,7 +113,7 @@ struct ResolutionSplitReply {
int64_t used;
template <class Archive>
void serialize(Archive& ar) {
ar & key & used;
serializer(ar, key, used);
}
};
@ -126,7 +126,7 @@ struct ResolutionSplitRequest {
template <class Archive>
void serialize(Archive& ar) {
ar & range & offset & front & reply;
serializer(ar, range, offset, front, reply);
}
};

View File

@ -41,7 +41,7 @@ struct RestoreInterface {
template <class Ar>
void serialize( Ar& ar ) {
ar & test;
serializer(ar, test);
}
};
@ -54,7 +54,7 @@ struct TestRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & testData & reply;
serializer(ar, testData, reply);
}
};
@ -66,7 +66,7 @@ struct TestReply {
template <class Ar>
void serialize(Ar& ar) {
ar & replyData;
serializer(ar, replyData);
}
};

View File

@ -51,7 +51,7 @@ struct ServerDBInfo {
template <class Ar>
void serialize( Ar& ar ) {
ar & id & clusterInterface & client & master & resolvers & recoveryCount & masterLifetime & logSystemConfig & priorCommittedLogServers & recoveryState;
serializer(ar, id, clusterInterface, client, master, resolvers, recoveryCount, masterLifetime, logSystemConfig, priorCommittedLogServers, recoveryState);
}
};

View File

@ -65,8 +65,8 @@ struct TLogInterface {
template <class Ar>
void serialize( Ar& ar ) {
ASSERT(ar.isDeserializing || uniqueID != UID());
ar & uniqueID & sharedTLogID & locality & peekMessages & popMessages
& commit & lock & getQueuingMetrics & confirmRunning & waitFailure & recoveryFinished;
serializer(ar, uniqueID, sharedTLogID, locality, peekMessages, popMessages
, commit, lock, getQueuingMetrics, confirmRunning, waitFailure, recoveryFinished);
}
};
@ -77,7 +77,7 @@ struct TLogRecoveryFinishedRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & reply;
serializer(ar, reply);
}
};
@ -87,7 +87,7 @@ struct TLogLockResult {
template <class Ar>
void serialize( Ar& ar ) {
ar & end & knownCommittedVersion;
serializer(ar, end, knownCommittedVersion);
}
};
@ -100,7 +100,7 @@ struct TLogConfirmRunningRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & debugID & reply;
serializer(ar, debugID, reply);
}
};
@ -116,7 +116,7 @@ struct VersionUpdateRef {
template <class Ar>
void serialize( Ar& ar ) {
ar & version & mutations & isPrivateData;
serializer(ar, version, mutations, isPrivateData);
}
};
@ -131,7 +131,7 @@ struct VerUpdateRef {
template <class Ar>
void serialize( Ar& ar ) {
ar & version & mutations & isPrivateData;
serializer(ar, version, mutations, isPrivateData);
}
};
@ -146,7 +146,7 @@ struct TLogPeekReply {
template <class Ar>
void serialize(Ar& ar) {
ar & arena & messages & end & popped & maxKnownVersion & minKnownCommittedVersion & begin;
serializer(ar, arena, messages, end, popped, maxKnownVersion, minKnownCommittedVersion, begin);
}
};
@ -163,7 +163,7 @@ struct TLogPeekRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & arena & begin & tag & returnIfBlocked & sequence & reply;
serializer(ar, arena, begin, tag, returnIfBlocked, sequence, reply);
}
};
@ -179,7 +179,7 @@ struct TLogPopRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & arena & to & durableKnownCommittedVersion & tag & reply;
serializer(ar, arena, to, durableKnownCommittedVersion, tag, reply);
}
};
@ -196,7 +196,7 @@ struct TagMessagesRef {
template <class Ar>
void serialize(Ar& ar) {
ar & tag & messageOffsets;
serializer(ar, tag, messageOffsets);
}
};
@ -214,7 +214,7 @@ struct TLogCommitRequest {
: arena(a), prevVersion(prevVersion), version(version), knownCommittedVersion(knownCommittedVersion), minKnownCommittedVersion(minKnownCommittedVersion), messages(messages), debugID(debugID) {}
template <class Ar>
void serialize( Ar& ar ) {
ar & prevVersion & version & knownCommittedVersion & minKnownCommittedVersion & messages & reply & arena & debugID;
serializer(ar, prevVersion, version, knownCommittedVersion, minKnownCommittedVersion, messages, reply, arena, debugID);
}
};
@ -223,7 +223,7 @@ struct TLogQueuingMetricsRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & reply;
serializer(ar, reply);
}
};
@ -236,7 +236,7 @@ struct TLogQueuingMetricsReply {
template <class Ar>
void serialize(Ar& ar) {
ar & localTime & instanceID & bytesDurable & bytesInput & storageBytes & v;
serializer(ar, localTime, instanceID, bytesDurable, bytesInput, storageBytes, v);
}
};

View File

@ -57,7 +57,7 @@ struct TLogQueueEntryRef {
template <class Ar>
void serialize(Ar& ar) {
ar & version & messages & knownCommittedVersion & id;
serializer(ar, version, messages, knownCommittedVersion, id);
}
size_t expectedSize() const {
return messages.expectedSize();
@ -76,11 +76,11 @@ struct AlternativeTLogQueueEntryRef {
void serialize(Ar& ar) {
ASSERT(!ar.isDeserializing && alternativeMessages);
uint32_t msgSize = expectedSize();
ar & version & msgSize;
serializer(ar, version, msgSize);
for(auto& msg : *alternativeMessages) {
ar.serializeBytes( msg.message );
}
ar & knownCommittedVersion & id;
serializer(ar, knownCommittedVersion, id);
}
uint32_t expectedSize() const {

View File

@ -37,7 +37,7 @@ struct WorkloadInterface {
template <class Ar>
void serialize( Ar& ar ) {
ar & setup & start & check & metrics & stop;
serializer(ar, setup, start, check, metrics, stop);
}
};
@ -68,7 +68,7 @@ struct WorkloadRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & title & timeout & databasePingDelay & sharedRandomNumber & useDatabase & options & clientId & clientCount & reply & arena;
serializer(ar, title, timeout, databasePingDelay, sharedRandomNumber, useDatabase, options, clientId, clientCount, reply, arena);
}
};
@ -79,7 +79,7 @@ struct TesterInterface {
template <class Ar>
void serialize(Ar& ar) {
ar & recruitments;
serializer(ar, recruitments);
}
};

View File

@ -62,7 +62,7 @@ struct WorkerInterface {
template <class Ar>
void serialize(Ar& ar) {
ar & clientInterface & locality & tLog & master & masterProxy & resolver & storage & logRouter & debugPing & coordinationPing & waitFailure & setMetricsRate & eventLogRequest & traceBatchDumpRequest & testerInterface & diskStoreRequest;
serializer(ar, clientInterface, locality, tLog, master, masterProxy, resolver, storage, logRouter, debugPing, coordinationPing, waitFailure, setMetricsRate, eventLogRequest, traceBatchDumpRequest, testerInterface, diskStoreRequest);
}
};
@ -87,7 +87,7 @@ struct InitializeTLogRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & recruitmentID & recoverFrom & recoverAt & knownCommittedVersion & epoch & recoverTags & allTags & storeType & remoteTag & locality & isPrimary & startVersion & logRouterTags & reply;
serializer(ar, recruitmentID, recoverFrom, recoverAt, knownCommittedVersion, epoch, recoverTags, allTags, storeType, remoteTag, locality, isPrimary, startVersion, logRouterTags, reply);
}
};
@ -102,7 +102,7 @@ struct InitializeLogRouterRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & recoveryCount & routerTag & startVersion & tLogLocalities & tLogPolicy & locality & reply;
serializer(ar, recoveryCount, routerTag, startVersion, tLogLocalities, tLogPolicy, locality, reply);
}
};
@ -116,7 +116,7 @@ struct RecruitMasterRequest {
template <class Ar>
void serialize(Ar& ar) {
ASSERT( ar.protocolVersion() >= 0x0FDB00A200040001LL );
ar & lifetime & forceRecovery & reply & arena;
serializer(ar, lifetime, forceRecovery, reply, arena);
}
};
@ -129,7 +129,7 @@ struct InitializeMasterProxyRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & master & recoveryCount & recoveryTransactionVersion & firstProxy & reply;
serializer(ar, master, recoveryCount, recoveryTransactionVersion, firstProxy, reply);
}
};
@ -141,7 +141,7 @@ struct InitializeResolverRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & recoveryCount & proxyCount & resolverCount & reply;
serializer(ar, recoveryCount, proxyCount, resolverCount, reply);
}
};
@ -151,7 +151,7 @@ struct InitializeStorageReply {
template <class Ar>
void serialize(Ar& ar) {
ar & interf & addedVersion;
serializer(ar, interf, addedVersion);
}
};
@ -164,7 +164,7 @@ struct InitializeStorageRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & seedTag & reqId & interfaceId & storeType & reply;
serializer(ar, seedTag, reqId, interfaceId, storeType, reply);
}
};
@ -173,7 +173,7 @@ struct TraceBatchDumpRequest {
template <class Ar>
void serialize( Ar& ar ) {
ar & reply;
serializer(ar, reply);
}
};
@ -183,7 +183,7 @@ struct LoadedReply {
template <class Ar>
void serialize(Ar& ar) {
ar & payload & id;
serializer(ar, payload, id);
}
};
@ -195,7 +195,7 @@ struct LoadedPingRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & id & loadReply & payload & reply;
serializer(ar, id, loadReply, payload, reply);
}
};
@ -208,7 +208,7 @@ struct CoordinationPingMessage {
template <class Ar>
void serialize(Ar& ar) {
ar & clusterControllerId & timeStep;
serializer(ar, clusterControllerId, timeStep);
}
};
@ -220,7 +220,7 @@ struct SetMetricsLogRateRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & metricsLogsPerSecond;
serializer(ar, metricsLogsPerSecond);
}
};
@ -234,7 +234,7 @@ struct EventLogRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & getLastError & eventName & reply;
serializer(ar, getLastError, eventName, reply);
}
};
@ -254,7 +254,7 @@ struct DebugEntryRef {
template <class Ar>
void serialize(Ar& ar) {
ar & time & address & context & version & mutation;
serializer(ar, time, address, context, version, mutation);
}
};
@ -266,7 +266,7 @@ struct DiskStoreRequest {
template <class Ar>
void serialize(Ar& ar) {
ar & includePartialStores & reply;
serializer(ar, includePartialStores, reply);
}
};

View File

@ -69,7 +69,7 @@ public:
template <class Ar>
void serialize( Ar& ar ) {
ar & originatorFeed & messageId & data & data.arena();
serializer(ar, originatorFeed, messageId, data, data.arena());
}
};

View File

@ -34,7 +34,7 @@ struct PingWorkloadInterface {
template <class Ar>
void serialize( Ar& ar ) {
ar & payloadPing;
serializer(ar, payloadPing);
}
};

View File

@ -32,7 +32,7 @@ struct SidebandMessage {
template <class Ar>
void serialize( Ar& ar ) {
ar & key & commitVersion;
serializer(ar, key, commitVersion);
}
};
@ -43,7 +43,7 @@ struct SidebandInterface {
template <class Ar>
void serialize( Ar& ar ) {
ar & updates;
serializer(ar, updates);
}
};

View File

@ -375,7 +375,7 @@ public:
//T tmp;
//ar >> tmp;
//*this = tmp;
ar & (*(T*)this) & arena();
serializer(ar, (*(T*)this), arena());
}
/*static Standalone<T> fakeStandalone( const T& t ) {

View File

@ -51,7 +51,7 @@ struct CompressedInt {
template <class Ar> void serialize(Ar &ar) {
if(ar.isDeserializing) {
uint8_t b;
ar & b;
serializer(ar, b);
int bytesToRead = 0; // Additional bytes to read after the required first byte
bool positive = (b & 0x80) != 0; // Sign bit
if(!positive)
@ -62,7 +62,7 @@ struct CompressedInt {
// Scan the unary len bits across multiple bytes if needed
while(1) {
if(hb == 0) { // Go to next byte if needed
ar & b; // Read byte
serializer(ar, b); // Read byte
if(!positive)
b = ~b; // Negative, so invert bytes read
@ -78,7 +78,7 @@ struct CompressedInt {
value = b; // b contains the highest byte of value
while(bytesToRead-- != 0) {
ar & b; // Read byte
serializer(ar, b); // Read byte
if(!positive)
b = ~b; // Negative, so invert bytes read
value <<= 8; // Shift value up to make room for new byte

View File

@ -48,7 +48,7 @@ public:
template <class Ar>
void serialize( Ar& ar ) {
ar & error_code;
serializer(ar, error_code);
}
Error() : error_code(invalid_error_code), flags(0) {}

View File

@ -51,7 +51,7 @@ public:
template <class Ar>
void serialize_unversioned(Ar& ar) { // Changing this serialization format will affect key definitions, so can't simply be versioned!
ar & part[0] & part[1];
serializer(ar, part[0], part[1]);
}
};

View File

@ -1023,7 +1023,7 @@ struct TestGVR {
template <class Ar>
void serialize( Ar& ar ) {
ar & key & version & debugID & reply;
serializer(ar, key, version, debugID, reply);
}
};

View File

@ -240,7 +240,7 @@ struct CountingServerInterface {
// serialization code required for use on a network
template <class Ar>
void serialize( Ar& ar ) {
ar & addCount & subtractCount & getCount;
serializer(ar, addCount, subtractCount, getCount);
}
};
```

View File

@ -338,9 +338,9 @@ struct FieldHeader {
sum += v;
}
template<class Ar> void serialize(Ar &ar) {
ar & version;
serializer(ar, version);
ASSERT(version == 1);
ar & count & sum;
serializer(ar, count, sum);
}
};
@ -1126,9 +1126,9 @@ struct FieldHeader<TimeAndValue<T>> {
previous_time = v.time;
}
template<class Ar> void serialize(Ar &ar) {
ar & version;
serializer(ar, version);
ASSERT(version == 1);
ar & count & area;
serializer(ar, count, area);
}
};

View File

@ -170,10 +170,10 @@ public:
// SOMEDAY: specialize for space efficiency?
if (valid && Ar::isDeserializing)
(*(T *)&value).~T();
ar & valid;
serializer(ar, valid);
if (valid) {
if (Ar::isDeserializing) new (&value) T();
ar & *(T*)&value;
serializer(ar, *(T*)&value);
}
}
@ -247,10 +247,10 @@ public:
template <class Ar>
void serialize(Ar& ar) {
// SOMEDAY: specialize for space efficiency?
ar & error;
serializer(ar, error);
if (present()) {
if (Ar::isDeserializing) new (&value) T();
ar & *(T*)&value;
serializer(ar, *(T*)&value);
}
}

View File

@ -62,15 +62,20 @@ inline typename Archive::READER& operator >> (Archive& ar, Item& item ) {
return ar;
}
template <class Archive, class Item>
inline typename Archive::WRITER& operator & (Archive& ar, Item& item ) {
template <class Archive>
void serializer(Archive& ar) {}
template <class Archive, class Item, class... Items>
typename Archive::WRITER& serializer(Archive& ar, const Item& item, const Items&... items) {
save(ar, item);
serializer(ar, items...);
return ar;
}
template <class Archive, class Item>
inline typename Archive::READER& operator & (Archive& ar, Item& item ) {
template <class Archive, class Item, class... Items>
typename Archive::READER& serializer(Archive& ar, Item& item, Items&... items) {
load(ar, item);
serializer(ar, items...);
return ar;
}
@ -121,7 +126,7 @@ template <class Archive, class T1, class T2>
class Serializer< Archive, std::pair<T1,T2>, void > {
public:
static void serialize( Archive& ar, std::pair<T1, T2>& p ) {
ar & p.first & p.second;
serializer(ar, p.first, p.second);
}
};