buffer

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary struct {
	UncompressedSize uint32
	CompressedSize   uint32
	CompressedData   []byte
}

Binary represents compressed data.

type Buffer

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

Buffer represents the in-memory buffer for the current chunk.

func New

func New(maxSize int, codec *codec.Codec) *Buffer

New creates a new buffer with the specified maximum size.

func (*Buffer) Add

func (b *Buffer) Add(entry codec.LogEntry, entryTime time.Time) bool

Add adds a log entry to the buffer and updates actor bitmaps.

func (*Buffer) Flush

func (b *Buffer) Flush() (Flush, error)

Flush atomically extracts the current buffer contents and resets the buffer. It returns a deep-copied snapshot so the caller owns the returned slices/maps without needing additional synchronization.

func (*Buffer) Query

func (b *Buffer) Query(actorID uint32, dayStart time.Time, from, to time.Time) iter.Seq[codec.LogEntry]

Query returns entries for a specific actor within a time range.

func (*Buffer) QueryActors

func (b *Buffer) QueryActors(dayStart time.Time, from, to time.Time, actors []uint32) iter.Seq[codec.LogEntry]

QueryActors returns entries that contain ALL specified actors within a time range.

func (*Buffer) Size

func (b *Buffer) Size() int

Size returns the number of entries in the buffer.

type Flush

type Flush struct {
	Data  Binary
	Index []Index
	Time  [2]uint32 // Time bounds [min, max] (Unix seconds)
}

Flush represents the data returned by Buffer.Flush.

type Index

type Index struct {
	Binary
	ActorID uint32
}

Index represents a compressed actor bitmap.

Jump to

Keyboard shortcuts

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