line

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncCtx

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

AsyncCtx : async call context

func (*AsyncCtx) R

func (m *AsyncCtx) R() (interface{}, error)

R : get response with wait

func (*AsyncCtx) SetR

func (m *AsyncCtx) SetR(r interface{}, err error)

SetR : set return

type AsyncR

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

AsyncR : async call result.

type CallCtx

type CallCtx struct {
	Call  CallFn
	Param interface{}
}

CallCtx : call context, function and param

func NewCallCtx

func NewCallCtx(call CallFn, param interface{}) *CallCtx

NewCallCtx : new call context

type CallFn

type CallFn func(ctx context.Context, req interface{}) (rsp interface{}, err error)

CallFn : call function

type Line

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

Line : async runner

func NewLine

func NewLine(wg *sync.WaitGroup, opts ...Option) *Line

NewLine : new async line

func (*Line) AsyncCall

func (c *Line) AsyncCall(ctx context.Context, callCtx *CallCtx) (interface{}, error)

AsyncCall : wrap call ctx -- context.Context callCtx -- call context

func (*Line) QSize

func (c *Line) QSize() int

QSize : get queue size in each slot

func (*Line) Run

func (c *Line) Run()

Run : run all queue msg handler

func (*Line) Stop

func (c *Line) Stop()

Stop : stop

type Option

type Option func(option *_Option)

Option : only qSize option

func WithName

func WithName(name string) Option

WithName : setup name

func WithQSize

func WithQSize(qSize int) Option

WithQSize : setup qSize

Jump to

Keyboard shortcuts

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