line

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 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 NewAsyncCtx

func NewAsyncCtx(ctx context.Context,
	call func(context.Context, interface{}) (interface{}, error), param interface{}) *AsyncCtx

NewAsyncCtx : new async call context ctx -- context call -- async call function param -- async call param

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  func(ctx context.Context, req interface{}) (rsp interface{}, err error)
	Param interface{}
}

CallCtx : call context, function and param

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