feat(chat): implement sequence pre-allocation, versioned sync, and push worker
Introduce several performance and synchronization enhancements: - Implement `SeqBufferManager` to allow sequence number pre-allocation via Redis Lua scripts, reducing atomic increment overhead. - Add `PushWorker` to handle asynchronous message pushing using Redis Streams. - Implement incremental conversation synchronization via `ConversationVersionLog` to allow clients to fetch only recent changes. - Add support for Gzip compression in WebSocket communications to reduce bandwidth usage. - Update dependency injection and configuration to support these new components.
This commit is contained in:
13
internal/model/conversation_version_log.go
Normal file
13
internal/model/conversation_version_log.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// ConversationVersionLog 会话版本日志(用于增量同步)
|
||||
type ConversationVersionLog struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement"`
|
||||
UserID string `gorm:"not null;size:36;index:idx_vlog_user_version,priority:1"`
|
||||
ConversationID string `gorm:"not null;size:20;index:idx_vlog_conv"`
|
||||
Version int64 `gorm:"not null;index:idx_vlog_user_version,priority:2"`
|
||||
ChangeType string `gorm:"not null;type:varchar(20)"` // new_msg, read, pin, unpin, mute, unmute, hide, group_update
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
}
|
||||
Reference in New Issue
Block a user