Documentation
¶
Index ¶
- Variables
- type UniqueQueue
- func (q *UniqueQueue) Clear()
- func (q *UniqueQueue) FirstEncounter(item string) bool
- func (q *UniqueQueue) GetMapValue(key string) (bool, error)
- func (q *UniqueQueue) Insert(item string) (success bool)
- func (q *UniqueQueue) InsertForce(item string)
- func (q *UniqueQueue) IsEmpty() bool
- func (q *UniqueQueue) Remove() (string, error)
- func (q *UniqueQueue) SetMapValue(key string, value bool)
- func (q *UniqueQueue) Size() int
- func (q *UniqueQueue) View(n int) (string, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type UniqueQueue ¶
type UniqueQueue struct {
// contains filtered or unexported fields
}
UniqueQueue holds unique values in its queue
func NewQueue ¶
func NewQueue() *UniqueQueue
NewQueue returns a pointer to new UniqueQueue
Care: Map is case-sensitive. Use strings.ToLower on key to make case-insensitive.
func (*UniqueQueue) Clear ¶
func (q *UniqueQueue) Clear()
Clear removes all items from the queue but not from its map
func (*UniqueQueue) FirstEncounter ¶
func (q *UniqueQueue) FirstEncounter(item string) bool
FirstEncounter returns true if the item was seen for the first time by the queue in its lifetime
func (*UniqueQueue) GetMapValue ¶
func (q *UniqueQueue) GetMapValue(key string) (bool, error)
GetMapValue returns value of key inside the map used by UniqueQueue.
It throws ErrItemNotFound when the item couldn't be found in the map, this means that the item was never pushed to the queue.
Thread safe.
func (*UniqueQueue) Insert ¶ added in v0.8.5
func (q *UniqueQueue) Insert(item string) (success bool)
Insert appends item to the queue after checking that item was never seen before by the queue. Returns true if item was added to the queue.
Care: Map is case-sensitive. Use strings.ToLower to make case-insensitive.
NOP when item was seen earlier in queue's lifetime. Default item value is 'false'.
Thread safe.
func (*UniqueQueue) InsertForce ¶ added in v0.8.5
func (q *UniqueQueue) InsertForce(item string)
InsertForce appends item to the queue WITHOUT checking that the item was seen before. Useful when item was not processed successfully and/or needs to be reprocessed. Or while bulk loading from unique set.
Care: Map is case-sensitive. Use strings.ToLower to make case-insensitive.
Default item value is 'false'.
Thread safe.
func (*UniqueQueue) IsEmpty ¶
func (q *UniqueQueue) IsEmpty() bool
IsEmpty tells if queue is empty or not
func (*UniqueQueue) Remove ¶ added in v0.8.5
func (q *UniqueQueue) Remove() (string, error)
Remove pops first item from the queue. Returns ErrEmptyQueue when empty.
Thread safe.
func (*UniqueQueue) SetMapValue ¶
func (q *UniqueQueue) SetMapValue(key string, value bool)
SetMapValue set value of key inside the map used by UniqueQueue.
Thread safe.