Compare commits
2 Commits
9ed2a81dd3
...
af197dd58f
Author | SHA1 | Date |
---|---|---|
projectmoon | af197dd58f | |
projectmoon | 551f21a49a |
|
@ -115,7 +115,7 @@ mod hashset_tree {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Functions that specifically relate to the "timestamp index" tree,
|
/// Functions that specifically relate to the "timestamp index" tree,
|
||||||
/// which is stored on the Room sinstance as a tree called
|
/// which is stored on the Rooms instance as a tree called
|
||||||
/// roomtimestamp_eventid. Tightly coupled to the event watcher in the
|
/// roomtimestamp_eventid. Tightly coupled to the event watcher in the
|
||||||
/// Rooms impl, and only factored out for unit testing.
|
/// Rooms impl, and only factored out for unit testing.
|
||||||
mod timestamp_index {
|
mod timestamp_index {
|
||||||
|
@ -135,12 +135,10 @@ mod timestamp_index {
|
||||||
let parts: Vec<&[u8]> = key.split(|&b| b == 0xff).collect();
|
let parts: Vec<&[u8]> = key.split(|&b| b == 0xff).collect();
|
||||||
if let [room_id, event_id] = parts[..] {
|
if let [room_id, event_id] = parts[..] {
|
||||||
let event_id = str::from_utf8(event_id)?;
|
let event_id = str::from_utf8(event_id)?;
|
||||||
debug!("Adding event ID {} to timestamp index", event_id);
|
|
||||||
|
|
||||||
let mut ts_key = room_id.to_vec();
|
let mut ts_key = room_id.to_vec();
|
||||||
ts_key.push(0xff);
|
ts_key.push(0xff);
|
||||||
ts_key.extend_from_slice(×tamp_bytes);
|
ts_key.extend_from_slice(×tamp_bytes);
|
||||||
trace_index_record(room_id, event_id, ×tamp_bytes);
|
log_index_record(room_id, event_id, ×tamp_bytes);
|
||||||
|
|
||||||
hashset_tree::add_to_set(roomtimestamp_eventid, &ts_key, event_id.to_owned())?;
|
hashset_tree::add_to_set(roomtimestamp_eventid, &ts_key, event_id.to_owned())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -149,10 +147,10 @@ mod timestamp_index {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Log a trace message.
|
/// Log a debug message.
|
||||||
fn trace_index_record(room_id: &[u8], event_id: &[u8], timestamp: &[u8]) {
|
fn log_index_record(room_id: &[u8], event_id: &[u8], timestamp: &[u8]) {
|
||||||
if log_enabled!(log::Level::Trace) {
|
if log_enabled!(log::Level::Debug) {
|
||||||
trace!(
|
debug!(
|
||||||
"Recording event {} | {} received at {} in timestamp index.",
|
"Recording event {} | {} received at {} in timestamp index.",
|
||||||
str::from_utf8(room_id).unwrap_or("[invalid room id]"),
|
str::from_utf8(room_id).unwrap_or("[invalid room id]"),
|
||||||
str::from_utf8(event_id).unwrap_or("[invalid event id]"),
|
str::from_utf8(event_id).unwrap_or("[invalid event id]"),
|
||||||
|
|
Loading…
Reference in New Issue