utils

package
v0.7.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateChecksum

func CalculateChecksum(data string) []byte

CalculateChecksum calculates a Blake2b 256 bit checksum of the passed data and returns it as a []byte.

func Equal

func Equal(checksumA, checksumB []byte) bool

Equal compares 2 checksums passed in as []byte and returns whether they are equal or not

Types

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue uses slice as a data structure to hold elements New elements are appended as a last indexes in the slice, meaning the oldest entries (First in) are at the start of the slice Queue is also thread safe and support usage over multiple go-routines

func (*Queue) CompareElementNameList

func (q *Queue) CompareElementNameList(givenList []string) bool

CompareElementNameList compares given element-name list with the current element-name list of the queue

func (*Queue) Contains

func (q *Queue) Contains(targetElement QueueElement) bool

Checks if the queue holds the specified elements checking is done by name of the element

func (*Queue) Dequeue

func (q *Queue) Dequeue() QueueElement

Dequeue will delete oldest element in the queue and return it Returns nil if queue is empty

func (*Queue) Enqueue

func (q *Queue) Enqueue(element QueueElement)

Enqueue will add a new element into the end of the queue

func (*Queue) GetElementNames

func (q *Queue) GetElementNames() []string

GetElementNames returns slice of names of the elements in the queue

type QueueElement

type QueueElement interface {
	// name of each item must be unique
	GetName() string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL