|
@@ -36,6 +36,34 @@ int compare_keys<UidKey>(const void* a, const void* b)
|
|
|
return oselect_uint32_t(-1, 1, alarge);
|
|
|
}
|
|
|
|
|
|
+template<>
|
|
|
+int compare_keys<UidPriorityKey>(const void* a, const void* b)
|
|
|
+{
|
|
|
+ uint64_t aup = ((const UidPriorityKey*)a)->uid_priority;
|
|
|
+ uint64_t bup = ((const UidPriorityKey*)b)->uid_priority;
|
|
|
+ uint32_t aidx = ((const UidPriorityKey*)a)->idx;
|
|
|
+ uint32_t bidx = ((const UidPriorityKey*)b)->idx;
|
|
|
+ bool auplarge = (aup > bup);
|
|
|
+ bool aupeq = (aup == bup);
|
|
|
+ bool aidxlarge = (aidx > bidx);
|
|
|
+ bool alarge = auplarge | (aupeq & aidxlarge);
|
|
|
+ return oselect_uint32_t(-1, 1, alarge);
|
|
|
+}
|
|
|
+
|
|
|
+template<>
|
|
|
+int compare_keys<NidPriorityKey>(const void* a, const void* b)
|
|
|
+{
|
|
|
+ uint64_t anp = ((const NidPriorityKey*)a)->nid_priority;
|
|
|
+ uint64_t bnp = ((const NidPriorityKey*)b)->nid_priority;
|
|
|
+ uint32_t aidx = ((const NidPriorityKey*)a)->idx;
|
|
|
+ uint32_t bidx = ((const NidPriorityKey*)b)->idx;
|
|
|
+ bool anplarge = (anp > bnp);
|
|
|
+ bool anpeq = (anp == bnp);
|
|
|
+ bool aidxlarge = (aidx > bidx);
|
|
|
+ bool alarge = anplarge | (anpeq & aidxlarge);
|
|
|
+ return oselect_uint32_t(-1, 1, alarge);
|
|
|
+}
|
|
|
+
|
|
|
// Perform the sort using up to nthreads threads. The items to sort are
|
|
|
// byte arrays of size msg_size. The key is the 10-bit storage server
|
|
|
// id concatenated with the 22-bit uid at the storage server.
|