change the first part of the UID to make comparisons cheaper
This commit is contained in:
parent
ead17d6a7f
commit
9313e490aa
|
@ -85,7 +85,20 @@ struct StorageServerInterface {
|
||||||
// versioned carefully!
|
// versioned carefully!
|
||||||
|
|
||||||
if (ar.protocolVersion().hasSmallEndpoints()) {
|
if (ar.protocolVersion().hasSmallEndpoints()) {
|
||||||
serializer(ar, uniqueID, locality, getValue, getKey, getKeyValues, getShardState, waitMetrics, splitMetrics, getStorageMetrics, waitFailure, getQueuingMetrics, getKeyValueStoreType, watchValue, getReadHotRanges);
|
serializer(ar, uniqueID, locality, getValue);
|
||||||
|
if( Ar::isDeserializing ) {
|
||||||
|
getKey = RequestStream<struct GetKeyRequest>( base.getAdjustedEndpoint(1) );
|
||||||
|
getKeyValues = RequestStream<struct GetKeyValuesRequest>( base.getAdjustedEndpoint(2) );
|
||||||
|
getShardState = RequestStream<struct GetShardStateRequest>( base.getAdjustedEndpoint(3) );
|
||||||
|
waitMetrics = RequestStream<struct WaitMetricsRequest>( base.getAdjustedEndpoint(4) );
|
||||||
|
splitMetrics = RequestStream<struct SplitMetricsRequest>( base.getAdjustedEndpoint(5) );
|
||||||
|
getStorageMetrics = RequestStream<struct GetStorageMetricsRequest>( base.getAdjustedEndpoint(6) );
|
||||||
|
waitFailure = RequestStream<ReplyPromise<Void>>( base.getAdjustedEndpoint(7) );
|
||||||
|
getQueuingMetrics = RequestStream<struct StorageQueuingMetricsRequest>( base.getAdjustedEndpoint(8) );
|
||||||
|
getKeyValueStoreType = RequestStream<ReplyPromise<KeyValueStoreType>>( base.getAdjustedEndpoint(9) );
|
||||||
|
watchValue = RequestStream<struct WatchValueRequest>( base.getAdjustedEndpoint(10) );
|
||||||
|
getReadHotRanges = RequestStream<struct ReadHotSubRangeRequest>( base.getAdjustedEndpoint(11) );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ASSERT(Ar::isDeserializing);
|
ASSERT(Ar::isDeserializing);
|
||||||
if constexpr (is_fb_function<Ar>) {
|
if constexpr (is_fb_function<Ar>) {
|
||||||
|
|
|
@ -124,8 +124,8 @@ const Endpoint& EndpointMap::insert( NetworkAddressList localAddresses, std::vec
|
||||||
UID base = deterministicRandom()->randomUniqueID();
|
UID base = deterministicRandom()->randomUniqueID();
|
||||||
for(int i=0; i<streams.size(); i++) {
|
for(int i=0; i<streams.size(); i++) {
|
||||||
int index = adjacentStart+i;
|
int index = adjacentStart+i;
|
||||||
streams[i].first->setEndpoint( Endpoint( localAddresses, UID( base.first() | TOKEN_STREAM_FLAG, (base.second()&0xffffffff00000000LL) | index) ) );
|
streams[i].first->setEndpoint( Endpoint( localAddresses, UID( (base.first()+(2*index)) | TOKEN_STREAM_FLAG, (base.second()&0xffffffff00000000LL) | index) ) );
|
||||||
data[index].token() = Endpoint::Token( base.first() | TOKEN_STREAM_FLAG, (base.second()&0xffffffff00000000LL) | static_cast<uint32_t>(streams[i].second) );
|
data[index].token() = Endpoint::Token( (base.first()+(2*index)) | TOKEN_STREAM_FLAG, (base.second()&0xffffffff00000000LL) | static_cast<uint32_t>(streams[i].second) );
|
||||||
data[index].receiver = (NetworkMessageReceiver*) streams[i].first;
|
data[index].receiver = (NetworkMessageReceiver*) streams[i].first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
Endpoint getAdjustedEndpoint( uint32_t index ) {
|
Endpoint getAdjustedEndpoint( uint32_t index ) {
|
||||||
uint32_t newIndex = token.second();
|
uint32_t newIndex = token.second();
|
||||||
newIndex += index;
|
newIndex += index;
|
||||||
return Endpoint( addresses, UID(token.first(), (token.second()&0xffffffff00000000LL) | newIndex) );
|
return Endpoint( addresses, UID(token.first()+(2*newIndex), (token.second()&0xffffffff00000000LL) | newIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator == (Endpoint const& r) const {
|
bool operator == (Endpoint const& r) const {
|
||||||
|
|
Loading…
Reference in New Issue