Back to godoc.org

Package pipeline

v0.3.3
Latest Go to latest

The latest major version is .

Published: Jan 20, 2020 | License: MIT | Module: github.com/bilibili/kratos

Index

Variables

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

ErrFull channel full error

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 Pipeline config

type Pipeline

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

Pipeline pipeline struct

func NewPipeline

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

NewPipeline new pipline

func (*Pipeline) Add

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

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

func (*Pipeline) Close

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

Close all goroutinue

func (*Pipeline) Start

func (p *Pipeline) Start()

Start start all mergeproc

func (*Pipeline) SyncAdd

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

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier