bytefifo

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 3 Imported by: 0

README

Coverage Status Go Reference

bytefifo

A Go package implementing a data structure for storing byte data representing iterations of a single resource (i.e. a GET request on a dynamic resource, file undergoing updates etc.). The data structure resembles a FIFO queue, implemented using Go Rings.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//LengthInitErr occurs when initializing ByteFifo with an invalid amount of elements
	LengthInitErr = byteFifoError{"Length of ResRing should be greater than 0"}
	//BaseTypeErr occurs when the internal ring structure of ByteFifo contains elements of the wrong type
	BaseTypeErr = byteFifoError{"Internal Ring Value Type incorrect, ResRing instance may not be generated from resring.New()"}
	//SameDataErr occurs when attempting to add data to the ByteFifo that is identical to the current data on top
	SameDataErr = byteFifoError{"New and Current data are identical"}
)

Functions

This section is empty.

Types

type ByteFifo

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

ByteFifo is a a structure similar to ring of resData structs, New()

func New

func New(length int) (ByteFifo, error)

New creates a ByteFifo struct of length n

func (*ByteFifo) Add

func (b *ByteFifo) Add(newData []byte) error

Add attempts to update the ByteFifo with new data

func (ByteFifo) TimeStamp

func (b ByteFifo) TimeStamp() (time.Time, error)

TimeStamp returns the time when the resource was added to the ByteFifo

func (ByteFifo) Value

func (b ByteFifo) Value() ([]byte, error)

Value returns the bytedata at the current position of the ring-like structure

Jump to

Keyboard shortcuts

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