mirror of
https://github.com/matrix-construct/construct
synced 2025-02-27 06:00:16 +01:00
ircd:Ⓜ️:dbs: Fix the _room_state_space comparator.
This commit is contained in:
parent
493bd85c11
commit
bb36a2c398
1 changed files with 33 additions and 5 deletions
|
@ -3235,10 +3235,38 @@ ircd::m::dbs::desc::events__room_state_space__cmp
|
||||||
if(empty(post[1]))
|
if(empty(post[1]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Perform standard comparison over the typed tuple.
|
// Decompose the postfix of the key for granular sorting
|
||||||
const auto _a(room_state_space_key(post[0]));
|
const room_state_space_key_parts k[2]
|
||||||
const auto _b(room_state_space_key(post[1]));
|
{
|
||||||
return _a < _b;
|
room_state_space_key(post[0]),
|
||||||
|
room_state_space_key(post[1])
|
||||||
|
};
|
||||||
|
|
||||||
|
// type
|
||||||
|
if(std::get<0>(k[0]) < std::get<0>(k[1]))
|
||||||
|
return true;
|
||||||
|
else if(std::get<0>(k[0]) > std::get<0>(k[1]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// state_key
|
||||||
|
if(std::get<1>(k[0]) < std::get<1>(k[1]))
|
||||||
|
return true;
|
||||||
|
else if(std::get<1>(k[0]) > std::get<1>(k[1]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// depth (ORDER IS DESCENDING!)
|
||||||
|
if(std::get<2>(k[0]) > std::get<2>(k[1]))
|
||||||
|
return true;
|
||||||
|
else if(std::get<2>(k[0]) < std::get<2>(k[1]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// event_idx (ORDER IS DESCENDING!)
|
||||||
|
if(std::get<3>(k[0]) > std::get<3>(k[1]))
|
||||||
|
return true;
|
||||||
|
else if(std::get<3>(k[0]) < std::get<3>(k[1]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
// equal
|
// equal
|
||||||
|
@ -3268,7 +3296,7 @@ ircd::m::dbs::desc::events__room_state_space
|
||||||
{},
|
{},
|
||||||
|
|
||||||
// comparator
|
// comparator
|
||||||
{},
|
events__room_state_space__cmp,
|
||||||
|
|
||||||
// prefix transform
|
// prefix transform
|
||||||
events__room_state_space__pfx,
|
events__room_state_space__pfx,
|
||||||
|
|
Loading…
Add table
Reference in a new issue