Documentation
¶
Index ¶
- type NotificationMessage
- type RingBuffer
- func (b *RingBuffer) Drain() []NotificationMessage
- func (b *RingBuffer) DrainByAgent(agent string) []NotificationMessage
- func (b *RingBuffer) DrainByPriority(priorities []string) []NotificationMessage
- func (b *RingBuffer) MaxSize() int
- func (b *RingBuffer) Peek(n int) []NotificationMessage
- func (b *RingBuffer) PeekByAgent(n int, agent string) []NotificationMessage
- func (b *RingBuffer) PeekByPriority(n int, priorities []string) []NotificationMessage
- func (b *RingBuffer) Push(msg NotificationMessage)
- func (b *RingBuffer) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NotificationMessage ¶
type NotificationMessage struct {
ID string `json:"id"`
RoomID string `json:"roomId"`
RoomTitle string `json:"roomTitle"`
PersonID string `json:"personId"`
PersonEmail string `json:"personEmail"`
PersonName string `json:"personName"`
Text string `json:"text"`
Created time.Time `json:"created"`
Priority string `json:"priority"`
RoutedAgent string `json:"routedAgent"`
Mentions []string `json:"mentions,omitempty"`
}
NotificationMessage represents a buffered inbound Webex message.
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a thread-safe bounded buffer for notification messages. When full, the oldest message is dropped on Push.
func (*RingBuffer) Drain ¶
func (b *RingBuffer) Drain() []NotificationMessage
Drain removes and returns all messages from the buffer, newest first.
func (*RingBuffer) DrainByAgent ¶ added in v0.7.0
func (b *RingBuffer) DrainByAgent(agent string) []NotificationMessage
DrainByAgent removes and returns only messages routed to the given agent, newest first. If agent is empty, all messages are returned (same as Drain).
func (*RingBuffer) DrainByPriority ¶
func (b *RingBuffer) DrainByPriority(priorities []string) []NotificationMessage
DrainByPriority removes and returns only messages matching the given priorities, newest first.
func (*RingBuffer) MaxSize ¶
func (b *RingBuffer) MaxSize() int
MaxSize returns the buffer capacity.
func (*RingBuffer) Peek ¶
func (b *RingBuffer) Peek(n int) []NotificationMessage
Peek returns the most recent n messages without removing them, newest first.
func (*RingBuffer) PeekByAgent ¶ added in v0.7.0
func (b *RingBuffer) PeekByAgent(n int, agent string) []NotificationMessage
PeekByAgent returns the most recent n messages for a specific agent without removing them.
func (*RingBuffer) PeekByPriority ¶ added in v0.9.0
func (b *RingBuffer) PeekByPriority(n int, priorities []string) []NotificationMessage
PeekByPriority returns the most recent messages matching the given priorities without removing them, newest first. If priorities is empty, returns nothing. n caps the number scanned from newest backwards.
func (*RingBuffer) Push ¶
func (b *RingBuffer) Push(msg NotificationMessage)
Push adds a message to the buffer. If at capacity, the oldest message is dropped.
func (*RingBuffer) Size ¶
func (b *RingBuffer) Size() int
Size returns the current number of buffered messages.