Documentation
¶
Overview ¶
Package gbuffer provides generic batching, aggregation, and priority worker scheduling.
Index ¶
- Variables
- func SumInt64(old, next int64) int64
- type AddFunc
- type AddMiddleware
- type AggregateAddFunc
- type AggregateAddMiddleware
- type Aggregator
- type AggregatorOption
- func WithAggregatorFlushInterval[K comparable, V any](d time.Duration) AggregatorOption[K, V]
- func WithAggregatorPool[K comparable, V any](pool WorkerPool) AggregatorOption[K, V]
- func WithAggregatorPriority[K comparable, V any](priority int) AggregatorOption[K, V]
- func WithEventThreshold[K comparable, V any](n int) AggregatorOption[K, V]
- func WithKeyThreshold[K comparable, V any](n int) AggregatorOption[K, V]
- type Batcher
- type BatcherOption
- func WithBatchFlushInterval[T any](d time.Duration) BatcherOption[T]
- func WithBatchMaxPending[T any](n int) BatcherOption[T]
- func WithBatchPool[T any](pool WorkerPool) BatcherOption[T]
- func WithBatchPriority[T any](priority int) BatcherOption[T]
- func WithBatchSinkMiddleware[T any](middleware ...Middleware[[]T]) BatcherOption[T]
- func WithBatchSize[T any](size int) BatcherOption[T]
- type Combiner
- type Job
- type Middleware
- type PoolOption
- type PriorityWorkerPool
- type SinkJob
- type Sinker
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type AddMiddleware ¶
type AggregateAddFunc ¶
type AggregateAddFunc[K comparable, V any] func(context.Context, K, V) error
type AggregateAddMiddleware ¶
type AggregateAddMiddleware[K comparable, V any] func(AggregateAddFunc[K, V]) AggregateAddFunc[K, V]
type Aggregator ¶
type Aggregator[K comparable, V any] struct { // contains filtered or unexported fields }
func NewAggregator ¶
func NewAggregator[K comparable, V any](sink Sinker[map[K]V], combine Combiner[V], opts ...AggregatorOption[K, V]) (*Aggregator[K, V], error)
type AggregatorOption ¶
type AggregatorOption[K comparable, V any] func(*Aggregator[K, V])
func WithAggregatorFlushInterval ¶
func WithAggregatorFlushInterval[K comparable, V any](d time.Duration) AggregatorOption[K, V]
func WithAggregatorPool ¶
func WithAggregatorPool[K comparable, V any](pool WorkerPool) AggregatorOption[K, V]
func WithAggregatorPriority ¶
func WithAggregatorPriority[K comparable, V any](priority int) AggregatorOption[K, V]
func WithEventThreshold ¶
func WithEventThreshold[K comparable, V any](n int) AggregatorOption[K, V]
func WithKeyThreshold ¶
func WithKeyThreshold[K comparable, V any](n int) AggregatorOption[K, V]
type Batcher ¶
type Batcher[T any] struct { // contains filtered or unexported fields }
func NewBatcher ¶
func NewBatcher[T any](sink Sinker[[]T], opts ...BatcherOption[T]) (*Batcher[T], error)
type BatcherOption ¶
func WithBatchFlushInterval ¶
func WithBatchFlushInterval[T any](d time.Duration) BatcherOption[T]
func WithBatchMaxPending ¶
func WithBatchMaxPending[T any](n int) BatcherOption[T]
func WithBatchPool ¶
func WithBatchPool[T any](pool WorkerPool) BatcherOption[T]
func WithBatchPriority ¶
func WithBatchPriority[T any](priority int) BatcherOption[T]
func WithBatchSinkMiddleware ¶
func WithBatchSinkMiddleware[T any](middleware ...Middleware[[]T]) BatcherOption[T]
func WithBatchSize ¶
func WithBatchSize[T any](size int) BatcherOption[T]
type Middleware ¶
type PoolOption ¶
type PoolOption func(*PriorityWorkerPool)
func WithQueueSize ¶
func WithQueueSize(n int) PoolOption
func WithWorkers ¶
func WithWorkers(n int) PoolOption
type PriorityWorkerPool ¶
type PriorityWorkerPool struct {
// contains filtered or unexported fields
}
func NewPriorityWorkerPool ¶
func NewPriorityWorkerPool(opts ...PoolOption) *PriorityWorkerPool
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
aggregator
command
|
|
|
batcher
command
|
|
|
close_flush
command
|
|
|
middleware
command
|
|
|
shared_pool
command
|
Click to show internal directories.
Click to hide internal directories.