From 2586476a576d45755b83e6e3002705b4c635baed Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 6 Feb 2019 17:18:01 -0800 Subject: [PATCH] ircd::m::dbs: Fix prefix related for event_refs column. --- include/ircd/m/dbs.h | 2 +- ircd/m_dbs.cc | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/ircd/m/dbs.h b/include/ircd/m/dbs.h index 5f4ab688f..95cafe37c 100644 --- a/include/ircd/m/dbs.h +++ b/include/ircd/m/dbs.h @@ -44,7 +44,7 @@ namespace ircd::m::dbs // Lowlevel util constexpr size_t EVENT_REFS_KEY_MAX_SIZE {sizeof(event::idx) + sizeof(event::idx)}; string_view event_refs_key(const mutable_buffer &out, const event::idx &tgt, const event::idx &referer); - std::pair event_refs_key(const string_view &amalgam); + std::tuple event_refs_key(const string_view &amalgam); constexpr size_t ROOM_HEAD_KEY_MAX_SIZE {id::MAX_SIZE + 1 + id::MAX_SIZE}; string_view room_head_key(const mutable_buffer &out, const id::room &, const id::event &); diff --git a/ircd/m_dbs.cc b/ircd/m_dbs.cc index d5e461ff2..f4275fd55 100644 --- a/ircd/m_dbs.cc +++ b/ircd/m_dbs.cc @@ -1063,18 +1063,17 @@ ircd::m::dbs::event_refs_key(const mutable_buffer &out, }; } -std::pair +std::tuple ircd::m::dbs::event_refs_key(const string_view &amalgam) { - assert(size(amalgam) >= sizeof(event::idx) * 2); - const event::idx *const &key + const byte_view key { - reinterpret_cast(data(amalgam)) + amalgam }; return { - key[0], key[1] + key }; } @@ -1115,7 +1114,7 @@ ircd::m::dbs::desc::events__event_refs {}, // prefix transform - {}, + events__event_refs__pfx, // drop column false,