Skip to content

Commit

Permalink
Document invariants for the MessageCache
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Jan 19, 2025
1 parent 9cd15a5 commit 921d17e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cache/message_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ use super::{CacheRef, ChannelId, ChannelMessagesRef, Message, MessageId, Message
/// A wrapper for implementing high level operations for message cache in a centralised place.
#[derive(Debug, Default)]
pub(super) struct MessageCache {
// Invariants:
// - VecDeque is no larger than the Cache's max_messages setting
// - VecDeque is ordered via the Message ID (debug checked in MessageCache::update_message)
// - VecDeque does not contain duplicate messages identified by their ID
storage: DashMap<ChannelId, VecDeque<Message>, BuildHasher>,
}

Expand Down

0 comments on commit 921d17e

Please sign in to comment.