circbuf

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package circbuf provides an in-memory circular buffer implementation to bound the size of captured log streams.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSize = errors.New("circbuf: size must be a positive int")

ErrInvalidSize is returned when initializing a Buffer with a non-positive max size.

Functions

This section is empty.

Types

type Buffer

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

Buffer represents a dynamic circular (ring) buffer of fixed maximum size.

func NewBuffer

func NewBuffer(size int) (*Buffer, error)

NewBuffer creates and returns a Buffer with a max size.

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

Bytes returns a copy of the buffer contents, with the oldest contents at the beginning.

func (*Buffer) Write

func (b *Buffer) Write(p []byte) (int, error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

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