raw

package
v0.1.3 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, sIndex int, callCtx *SlotCallCtx) *AsyncCtx

NewAsyncCtx : new async call context ctx -- context sIndex -- slot index callCtx -- SlotCallCtx, including call function and param

func NewAsyncCtxM

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

NewAsyncCtxM : new async call context ctx -- context sIndex -- slot index 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, sIndex int, req interface{}) (rsp interface{}, err error)
	Param SlotAble
}

CallCtx : call context, function and param

type Mux

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

Mux : multi-queue mux

func NewMux

func NewMux(opts ...pipe.Option) *Mux

NewMux : new mux

func NewMuxRun

func NewMuxRun(opts ...pipe.Option) *Mux

NewMuxRun : new mux and run

func (*Mux) Call

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

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

func (*Mux) CallSlot

func (c *Mux) CallSlot(ctx context.Context, sIndex int, callCtx *SlotCallCtx) (interface{}, error)

CallSlot : wrap slot call ctx -- context.Context sIndex -- slot index callCtx -- call context

func (*Mux) NormalizeSlotIndex

func (c *Mux) NormalizeSlotIndex(index int) int

NormalizeSlotIndex slot index

func (*Mux) QSize

func (c *Mux) QSize() int

QSize : get queue size in each slot

func (*Mux) Run

func (c *Mux) Run()

Run : run all queue msg handler

func (*Mux) SlotSize

func (c *Mux) SlotSize() int

SlotSize : get slot size

func (*Mux) Stop

func (c *Mux) Stop()

Stop : stop

func (*Mux) WaitStop

func (c *Mux) WaitStop(ctx context.Context) error

WaitStop : wait stop

type SlotAble

type SlotAble interface {
	Slot() int
}

type SlotCallCtx

type SlotCallCtx struct {
	Call  func(ctx context.Context, sIndex int, req interface{}) (rsp interface{}, err error)
	Param interface{}
}

SlotCallCtx : call context, function and param need specific slot index

Jump to

Keyboard shortcuts

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