2
0
mirror of https://github.com/FluuxIO/go-xmpp synced 2024-11-17 15:29:37 +00:00
go-xmpp/stanza/fifo_queue.go

35 lines
1.3 KiB
Go
Raw Normal View History

2020-03-06 15:44:01 +00:00
package stanza
// FIFO queue for string contents
// Implementations have no guarantee regarding thread safety !
type FifoQueue interface {
2020-03-09 16:12:32 +00:00
// Pop returns the first inserted element still in queue and deletes it from queue. If queue is empty, returns nil
2020-03-06 15:44:01 +00:00
// No guarantee regarding thread safety !
Pop() Queueable
2020-03-09 16:12:32 +00:00
// PopN returns the N first inserted elements still in queue and deletes them from queue. If queue is empty or i<=0, returns nil
// If number to pop is greater than queue length, returns all queue elements
2020-03-06 15:44:01 +00:00
// No guarantee regarding thread safety !
PopN(i int) []Queueable
2020-03-09 16:12:32 +00:00
// Peek returns a copy of the first inserted element in queue without deleting it. If queue is empty, returns nil
2020-03-06 15:44:01 +00:00
// No guarantee regarding thread safety !
Peek() Queueable
2020-03-09 16:12:32 +00:00
// Peek returns a copy of the first inserted element in queue without deleting it. If queue is empty or i<=0, returns nil.
// If number to peek is greater than queue length, returns all queue elements
2020-03-06 15:44:01 +00:00
// No guarantee regarding thread safety !
PeekN() []Queueable
// Push adds an element to the queue
// No guarantee regarding thread safety !
Push(s Queueable) error
// Empty returns true if queue is empty
// No guarantee regarding thread safety !
Empty() bool
}
type Queueable interface {
QueueableName() string
}