broker

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 2 Imported by: 0

README

broker

Project Badges

A lightweight broker that mediates HTTP requests and responses, handling user context, routing, validation, and service coordination.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker handles batching of items for efficient processing

func New

func New(batchWindow int) *Broker

New creates a new Broker with the specified batch window in milliseconds

func (*Broker) Clear added in v0.0.2

func (b *Broker) Clear()

Clear cleans the queue without triggering a flush

func (*Broker) Enqueue added in v0.0.2

func (b *Broker) Enqueue(key string, data []byte)

Enqueue adds data to the queue, consolidating by key

func (*Broker) FlushNow added in v0.0.2

func (b *Broker) FlushNow()

FlushNow forces an immediate flush

func (*Broker) QueueLength added in v0.0.2

func (b *Broker) QueueLength() int

QueueLength returns the current number of unique keys in the queue

func (*Broker) SetOnFlush added in v0.0.2

func (b *Broker) SetOnFlush(fn func([]Item))

SetOnFlush configures the callback for when the batch window expires

type Item added in v0.0.2

type Item struct {
	Key  string
	Data [][]byte
}

Item represents a consolidated group of data

Jump to

Keyboard shortcuts

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