bucket

package
v0.0.0-...-a2bdee9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MaxPktSize = 1500
)

Variables

View Source
var (
	ErrBufferTooSmall    = errors.New("buffer too small")
	ErrPacketTooOld      = errors.New("received packet too old")
	ErrPacketTooNew      = errors.New("received packet too new")
	ErrRTXPacket         = errors.New("packet already received")
	ErrRTXPacketSize     = errors.New("packet already received, size mismatch")
	ErrPacketMismatch    = errors.New("sequence number mismatch")
	ErrPacketSizeInvalid = errors.New("invalid size")
	ErrPacketTooLarge    = errors.New("packet too large")
)

Functions

This section is empty.

Types

type Bucket

type Bucket[T number] struct {
	// contains filtered or unexported fields
}

func NewBucket

func NewBucket[T number](capacity int) *Bucket[T]

func (*Bucket[T]) AddPacket

func (b *Bucket[T]) AddPacket(pkt []byte) ([]byte, error)

func (*Bucket[T]) AddPacketWithSequenceNumber

func (b *Bucket[T]) AddPacketWithSequenceNumber(pkt []byte, sn T) ([]byte, error)

func (*Bucket[T]) Capacity

func (b *Bucket[T]) Capacity() int

func (*Bucket[T]) GetPacket

func (b *Bucket[T]) GetPacket(buf []byte, sn T) (int, error)

func (*Bucket[T]) Grow

func (b *Bucket[T]) Grow() int

Grow increases the capacity of the bucket by adding initial capacity to the buffer

func (*Bucket[T]) HeadSequenceNumber

func (b *Bucket[T]) HeadSequenceNumber() T

func (*Bucket[T]) ResyncOnNextPacket

func (b *Bucket[T]) ResyncOnNextPacket()

Jump to

Keyboard shortcuts

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