Documentation
¶
Index ¶
- func NewInCache(db messaging.Store) messaging.Store
- type Cache
- func (c *Cache) AddReaction(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId, ...) (*messaging.Reaction, bool, bool, error)
- func (c *Cache) AdvancePointer(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId, ...) (*messagingpb.Pointer, bool, error)
- func (c *Cache) DeleteMessage(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId, ...) (*messaging.Message, error)
- func (c *Cache) EditMessage(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId, ...) (*messaging.Message, error)
- func (c *Cache) GetEventDelta(ctx context.Context, chatID *commonpb.ChatId, ...) ([]*messaging.Message, uint64, error)
- func (c *Cache) GetLatestEventSequence(ctx context.Context, chatID *commonpb.ChatId) (uint64, error)
- func (c *Cache) GetLatestEventSequencesForChats(ctx context.Context, chatIDs []*commonpb.ChatId) (map[string]uint64, error)
- func (c *Cache) GetMessage(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId) (*messaging.Message, error)
- func (c *Cache) GetMessages(ctx context.Context, chatID *commonpb.ChatId, opts ...database.QueryOption) ([]*messaging.Message, error)
- func (c *Cache) GetMessagesByRefs(ctx context.Context, refs []messaging.MessageRef) ([]*messaging.Message, error)
- func (c *Cache) GetPointers(ctx context.Context, chatID *commonpb.ChatId) ([]*messagingpb.Pointer, error)
- func (c *Cache) GetPointersForChats(ctx context.Context, refs []messaging.PointerRef) (map[string][]*messagingpb.Pointer, error)
- func (c *Cache) GetReactionSummaries(ctx context.Context, chatID *commonpb.ChatId, opts ...database.QueryOption) ([]*messaging.ReactionSummary, error)
- func (c *Cache) GetReactionSummariesByRefs(ctx context.Context, chatID *commonpb.ChatId, ...) ([]*messaging.ReactionSummary, error)
- func (c *Cache) GetReactionSummary(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId) ([]*messaging.Reaction, error)
- func (c *Cache) GetReactors(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId, ...) ([]*messaging.Reactor, bool, error)
- func (c *Cache) GetSelfReactions(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId, ...) ([]messaging.ReactionRef, error)
- func (c *Cache) MessageExists(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId) (bool, error)
- func (c *Cache) PutMessage(ctx context.Context, chatID *commonpb.ChatId, senderID *commonpb.UserId, ...) (*messaging.Message, bool, error)
- func (c *Cache) RemoveReaction(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId, ...) (*messaging.Reaction, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache wraps a messaging.Store, caching the largest message ID seen per chat to short-circuit existence checks. Each chat has its own gapless message ID sequence starting at 1, and messages are never removed (a deletion is a tombstone, still a real message). So if id <= the largest known ID, every ID up to it — including id — exists, and MessageExists can answer true without touching the backing store.
The cached value is only ever a lower bound on the true maximum: it is seeded from IDs the backing store has confirmed (a PutMessage result, or a positive MessageExists), so a true cache answer is always correct even across multiple server instances. A miss (id above the cached bound, or no entry yet) falls through to the backing store, and a confirmed existing id then raises the bound. The rest of the store is passed straight through.
func (*Cache) AddReaction ¶
func (*Cache) AdvancePointer ¶
func (c *Cache) AdvancePointer( ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId, pointerType messagingpb.Pointer_Type, newValue *messagingpb.MessageId, ) (*messagingpb.Pointer, bool, error)
func (*Cache) DeleteMessage ¶
func (*Cache) EditMessage ¶ added in v1.19.0
func (*Cache) GetEventDelta ¶
func (*Cache) GetLatestEventSequence ¶
func (*Cache) GetLatestEventSequencesForChats ¶ added in v1.19.0
func (*Cache) GetMessage ¶
func (*Cache) GetMessages ¶
func (*Cache) GetMessagesByRefs ¶
func (*Cache) GetPointers ¶
func (*Cache) GetPointersForChats ¶
func (c *Cache) GetPointersForChats(ctx context.Context, refs []messaging.PointerRef) (map[string][]*messagingpb.Pointer, error)
func (*Cache) GetReactionSummaries ¶
func (c *Cache) GetReactionSummaries( ctx context.Context, chatID *commonpb.ChatId, opts ...database.QueryOption, ) ([]*messaging.ReactionSummary, error)
func (*Cache) GetReactionSummariesByRefs ¶
func (c *Cache) GetReactionSummariesByRefs( ctx context.Context, chatID *commonpb.ChatId, messageIDs []*messagingpb.MessageId, ) ([]*messaging.ReactionSummary, error)