broker

package module
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

broker

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

func (b *Broker) Clear()

Clear cleans the queue without triggering a flush

func (*Broker) Enqueue

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

Enqueue adds data to the queue, consolidating by key

func (*Broker) FlushNow

func (b *Broker) FlushNow()

FlushNow forces an immediate flush

func (*Broker) QueueLength

func (b *Broker) QueueLength() int

QueueLength returns the current number of unique keys in the queue

func (*Broker) SetOnFlush

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

SetOnFlush configures the callback for when the batch window expires

type Item

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