Help us shape the future of Go! Take the 2026 Go Developer Survey

buffer

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryBuffer

type MemoryBuffer[R Record] struct {
	// contains filtered or unexported fields
}

PartitionBuffer provides a thread-safe buffer for storing internet latency samples. It supports concurrent appends and atomic flushing, as well as a maximum capacity with backpressure to avoid having too many records in the buffer at once.

func NewMemoryBuffer

func NewMemoryBuffer[R Record](capacity int) *MemoryBuffer[R]

func (*MemoryBuffer[R]) Add

func (b *MemoryBuffer[R]) Add(record R)

func (*MemoryBuffer[R]) CopyAndReset

func (b *MemoryBuffer[R]) CopyAndReset() []R

func (*MemoryBuffer[R]) FlushWithoutReset

func (b *MemoryBuffer[R]) FlushWithoutReset() []R

func (*MemoryBuffer[R]) Len

func (b *MemoryBuffer[R]) Len() int

func (*MemoryBuffer[R]) PriorityPrepend

func (b *MemoryBuffer[R]) PriorityPrepend(records []R)

func (*MemoryBuffer[R]) Read

func (b *MemoryBuffer[R]) Read() []R

func (*MemoryBuffer[R]) Recycle

func (b *MemoryBuffer[R]) Recycle(buf []R)

func (*MemoryBuffer[R]) TryAdd

func (b *MemoryBuffer[R]) TryAdd(record R) bool

type MemoryPartitionedBuffer

type MemoryPartitionedBuffer[K PartitionKey, R Record] struct {
	// contains filtered or unexported fields
}

func NewMemoryPartitionedBuffer

func NewMemoryPartitionedBuffer[K PartitionKey, R Record](partitionBufferCapacity int) *MemoryPartitionedBuffer[K, R]

func (*MemoryPartitionedBuffer[K, R]) Add

func (b *MemoryPartitionedBuffer[K, R]) Add(key K, record R) uint64

func (*MemoryPartitionedBuffer[K, R]) Capacity added in v0.6.3

func (b *MemoryPartitionedBuffer[K, R]) Capacity(key K) int

func (*MemoryPartitionedBuffer[K, R]) CopyAndReset

func (b *MemoryPartitionedBuffer[K, R]) CopyAndReset(key K) []R

func (*MemoryPartitionedBuffer[K, R]) FlushWithoutReset

func (b *MemoryPartitionedBuffer[K, R]) FlushWithoutReset() map[K][]R

func (*MemoryPartitionedBuffer[K, R]) Has

func (b *MemoryPartitionedBuffer[K, R]) Has(key K) bool

func (*MemoryPartitionedBuffer[K, R]) Len added in v0.6.3

func (b *MemoryPartitionedBuffer[K, R]) Len(key K) int

func (*MemoryPartitionedBuffer[K, R]) PriorityPrepend

func (b *MemoryPartitionedBuffer[K, R]) PriorityPrepend(key K, records []R)

func (*MemoryPartitionedBuffer[K, R]) Read

func (b *MemoryPartitionedBuffer[K, R]) Read(key K) []R

func (*MemoryPartitionedBuffer[K, R]) Recycle

func (b *MemoryPartitionedBuffer[K, R]) Recycle(partitionKey K, records []R)

func (*MemoryPartitionedBuffer[K, R]) Remove

func (b *MemoryPartitionedBuffer[K, R]) Remove(key K)

type PartitionKey

type PartitionKey interface {
	comparable
}

type PartitionedBuffer

type PartitionedBuffer[K PartitionKey, R Record] interface {
	Add(key K, record R) uint64
	PriorityPrepend(key K, records []R)
	FlushWithoutReset() map[K][]R
	Recycle(partitionKey K, records []R)
	Remove(key K)
	Has(key K) bool
	CopyAndReset(key K) []R
	Read(key K) []R
	Capacity(key K) int
	Len(key K) int
}

type Record

type Record any

Jump to

Keyboard shortcuts

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