pipeline

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

pipeline

import "github.com/ccheers/xpkg/sync/pipeline"

Index

Variables

ErrFull channel full error

var ErrFull = errors.New("channel full")

type Aggregation

Aggregation pipeline struct

type Aggregation struct {
    Do    func(c context.Context, index int, values map[string][]interface{})
    Split func(key string) int
    // contains filtered or unexported fields
}
func NewPipeline
func NewPipeline(config *Config) (res *Aggregation)

NewPipeline new pipline

func (*Aggregation) Add
func (p *Aggregation) Add(c context.Context, key string, value interface{}) (err error)

Add async add a value to channal, channel shard in split method

func (*Aggregation) Close
func (p *Aggregation) Close() (err error)

Close all goroutinue

func (*Aggregation) Start
func (p *Aggregation) Start()

Start start all mergeproc

func (*Aggregation) SyncAdd
func (p *Aggregation) SyncAdd(c context.Context, key string, value interface{}) (err error)

SyncAdd sync add a value to channal, channel shard in split method

type Config

Config Aggregation config

type Config struct {
    // MaxSize merge size
    MaxSize int
    // Interval merge interval
    Interval xtime.Duration
    // Buffer channel size
    Buffer int
    // Worker channel number
    Worker int
    // Name use for metrics
    Name string
}

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFull = errors.New("channel full")

ErrFull channel full error

Functions

This section is empty.

Types

type Aggregation

type Aggregation struct {
	Do    func(c context.Context, index int, values map[string][]interface{})
	Split func(key string) int
	// contains filtered or unexported fields
}

Aggregation pipeline struct

func NewPipeline

func NewPipeline(config *Config) (res *Aggregation)

NewPipeline new pipline

func (*Aggregation) Add

func (p *Aggregation) Add(c context.Context, key string, value interface{}) (err error)

Add async add a value to channal, channel shard in split method

func (*Aggregation) Close

func (p *Aggregation) Close() (err error)

Close all goroutinue

func (*Aggregation) Start

func (p *Aggregation) Start()

Start start all mergeproc

func (*Aggregation) SyncAdd

func (p *Aggregation) SyncAdd(c context.Context, key string, value interface{}) (err error)

SyncAdd sync add a value to channal, channel shard in split method

type Config

type Config struct {
	// MaxSize merge size
	MaxSize int
	// Interval merge interval
	Interval xtime.Duration
	// Buffer channel size
	Buffer int
	// Worker channel number
	Worker int
	// Name use for metrics
	Name string
}

Config Aggregation config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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