Documentation
¶
Index ¶
- Constants
- type DMStore
- func (s *DMStore) CleanupExpiredMessages() error
- func (s *DMStore) DeleteDMForUser(messageID, userID string) error
- func (s *DMStore) DeleteDMsBetweenUsers(user1, user2 string) error
- func (s *DMStore) GetDMsBetweenUsers(userID1, userID2 string, limit int) ([]models.EncryptedDM, error)
- func (s *DMStore) GetDMsForUser(userID string, messageType string, limit int) ([]models.EncryptedDM, error)
- func (s *DMStore) GetUnreadCount(userID string) (int64, error)
- func (s *DMStore) MarkDMAsRead(messageID, userID string) error
- func (s *DMStore) SaveDM(dm models.EncryptedDM) error
- func (s *DMStore) SubscribeToDMs(userID string) *redis.PubSub
Constants ¶
View Source
const ( // TTL for different message types KeyDistributionTTL = 24 * time.Hour // Key distribution messages expire after 24 hours RegularDMTTL = 7 * 24 * time.Hour // Regular DMs expire after 7 days )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DMStore ¶
type DMStore struct {
// contains filtered or unexported fields
}
func NewDMStore ¶
func NewDMStore(rdb *redis.Client) *DMStore
func (*DMStore) CleanupExpiredMessages ¶
CleanupExpiredMessages removes expired message IDs from queues This should be run periodically as a background job
func (*DMStore) DeleteDMForUser ¶
DeleteDMForUser removes a message from user's queue
func (*DMStore) DeleteDMsBetweenUsers ¶
func (*DMStore) GetDMsBetweenUsers ¶
func (s *DMStore) GetDMsBetweenUsers(userID1, userID2 string, limit int) ([]models.EncryptedDM, error)
GetDMsBetweenUsers retrieves conversation between two users
func (*DMStore) GetDMsForUser ¶
func (s *DMStore) GetDMsForUser(userID string, messageType string, limit int) ([]models.EncryptedDM, error)
GetDMsForUser retrieves DMs for a user from their queue
func (*DMStore) GetUnreadCount ¶
GetUnreadCount returns the number of unread messages for a user
func (*DMStore) MarkDMAsRead ¶
MarkDMAsRead marks a message as read
func (*DMStore) SaveDM ¶
func (s *DMStore) SaveDM(dm models.EncryptedDM) error
SaveDM stores an encrypted DM in Redis with appropriate TTL
func (*DMStore) SubscribeToDMs ¶
SubscribeToDMs subscribes to real-time DM notifications for a user
Click to show internal directories.
Click to hide internal directories.