Documentation
¶
Overview ¶
Package memory provides an in-process ReplayBuffer backend for single-pod deployments (dev / replica=1), where a reconnect lands on the same pod so cross-pod sharing is unnecessary. It satisfies the same core/interfaces.ReplayBuffer contract as the Redis backend, so selecting it is a config change (replay backend = memory), never a logic edit.
Index ¶
- type Buffer
- func (b *Buffer) Append(_ context.Context, key, msgID string, payload []byte) error
- func (b *Buffer) Delete(_ context.Context, key string) error
- func (b *Buffer) Prune(_ context.Context, key, upToMsgID string) error
- func (b *Buffer) ReplayAfter(_ context.Context, key, afterMsgID string) ([]interfaces.BufferedMessage, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is an in-process ReplayBuffer: a mutex-guarded map of key → an ordered, bounded, TTL'd list of retained messages.
func New ¶
New returns an in-process ReplayBuffer bounded to maxSize entries per key with the given TTL.
func (*Buffer) Append ¶
Append records payload under key, evicting the oldest past maxSize and refreshing the TTL.
func (*Buffer) Prune ¶
Prune drops entries up to and including upToMsgID, recording it as the low-water mark.
func (*Buffer) ReplayAfter ¶
func (b *Buffer) ReplayAfter( _ context.Context, key, afterMsgID string, ) ([]interfaces.BufferedMessage, bool, error)
ReplayAfter returns the retained tail strictly after afterMsgID; see the interface doc for the complete-flag semantics.