channel

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultPipeline

func NewDefaultPipeline(channel Channel) *defaultPipeline

Types

type Channel

type Channel interface {
	io.ReadWriteCloser
	util.AttributeMap

	Flush() error
	Id() channelid.ChannelId
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	Pipeline() Pipeline
}

type DefaultChannel

type DefaultChannel struct {
	util.DefaultAttributeMap
	// contains filtered or unexported fields
}

func NewDefaultChannel

func NewDefaultChannel(conn net.Conn) *DefaultChannel

func (*DefaultChannel) Close

func (c *DefaultChannel) Close() error

func (*DefaultChannel) Flush

func (c *DefaultChannel) Flush() error

flush output, only working with buffered writer

func (*DefaultChannel) Id

func (*DefaultChannel) LocalAddr

func (c *DefaultChannel) LocalAddr() net.Addr

func (*DefaultChannel) Pipeline

func (c *DefaultChannel) Pipeline() Pipeline

func (*DefaultChannel) Read

func (c *DefaultChannel) Read(p []byte) (n int, err error)

func (*DefaultChannel) RemoteAddr

func (c *DefaultChannel) RemoteAddr() net.Addr

func (*DefaultChannel) Write

func (c *DefaultChannel) Write(p []byte) (n int, err error)

type Handler

type Handler interface {
	OnError(c HandlerContext, err error)
}

type HandlerContext

type HandlerContext interface {
	InboundInvoker
	OutboundInvoker

	Channel() Channel
	Name() string
	Handler() Handler
	Pipeline() Pipeline
	TransferChannelRead(name string, msg interface{})
}

type InboundHandler

type InboundHandler interface {
	Handler
	ChannelActive(c HandlerContext)
	ChannelInActive(c HandlerContext)
	ChannelRead(c HandlerContext, msg interface{})
}

type InboundInvoker

type InboundInvoker interface {
	ChannelActive()
	ChannelInActive()
	ChannelRead(msg interface{})
	OnError(err error)
}

type OutboundHandler

type OutboundHandler interface {
	Handler
	Write(c HandlerContext, msg interface{}) error
	Flush(c HandlerContext) error
}

type OutboundInvoker

type OutboundInvoker interface {
	Write(msg interface{}) error
	Flush() error
	WriteAndFlush(msg interface{}) error
}

type Pipeline

type Pipeline interface {
	InboundInvoker
	OutboundInvoker

	Channel() Channel
	AddLast(name string, handler Handler)
	AddFirst(name string, handler Handler)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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