adapter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package adapter ...

Index

Constants

View Source
const ErrNetClosingSuffix = "use of closed network connection"

ErrNetClosingSuffix ...

Variables

This section is empty.

Functions

func NewSyncClientService

func NewSyncClientService(adapter *Adapter) base.IORCService

NewSyncClientService ...

func NewSyncServerService

func NewSyncServerService(adapter *Adapter) base.IORCService

NewSyncServerService ...

Types

type Adapter

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

Adapter ...

func NewClientAdapter

func NewClientAdapter(
	network string,
	addr string,
	tlsConfig *tls.Config,
	rBufSize int,
	wBufSize int,
	receiver IReceiver,
) *Adapter

NewClientAdapter ...

func NewServerAdapter

func NewServerAdapter(
	isDebug bool,
	network string,
	addr string,
	tlsConfig *tls.Config,
	rBufSize int,
	wBufSize int,
	receiver IReceiver,
) *Adapter

NewServerAdapter ...

func (*Adapter) Close

func (p *Adapter) Close() bool

Close ...

func (*Adapter) Open

func (p *Adapter) Open() bool

Open ...

func (*Adapter) Run

func (p *Adapter) Run() bool

Run ...

type IConn

type IConn interface {
	OnOpen()
	OnClose()
	OnError(err *base.Error)
	OnReadReady() bool
	OnWriteReady() bool
	OnReadBytes(b []byte)
	OnFillWrite(b []byte) int

	SetNext(conn IConn)
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	Close()
}

IConn ...

type IReceiver

type IReceiver interface {
	OnConnOpen(streamConn *StreamConn)
	OnConnClose(streamConn *StreamConn)
	OnConnReadStream(streamConn *StreamConn, stream *rpc.Stream)
	OnConnError(streamConn *StreamConn, err *base.Error)
}

IReceiver ...

type StreamConn

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

StreamConn ...

func NewStreamConn

func NewStreamConn(isDebug bool, prev IConn, receiver IReceiver) *StreamConn

NewStreamConn ...

func (*StreamConn) Close

func (p *StreamConn) Close()

Close ...

func (*StreamConn) IsActive

func (p *StreamConn) IsActive(nowNS int64, timeout time.Duration) bool

IsActive ...

func (*StreamConn) LocalAddr

func (p *StreamConn) LocalAddr() net.Addr

LocalAddr ...

func (*StreamConn) OnClose

func (p *StreamConn) OnClose()

OnClose ...

func (*StreamConn) OnError

func (p *StreamConn) OnError(err *base.Error)

OnError ...

func (*StreamConn) OnFillWrite

func (p *StreamConn) OnFillWrite(b []byte) int

OnFillWrite ...

func (*StreamConn) OnOpen

func (p *StreamConn) OnOpen()

OnOpen ...

func (*StreamConn) OnReadBytes

func (p *StreamConn) OnReadBytes(b []byte)

OnReadBytes ...

func (*StreamConn) OnReadReady

func (p *StreamConn) OnReadReady() bool

OnReadReady ...

func (*StreamConn) OnWriteReady

func (p *StreamConn) OnWriteReady() bool

OnWriteReady ...

func (*StreamConn) RemoteAddr

func (p *StreamConn) RemoteAddr() net.Addr

RemoteAddr ...

func (*StreamConn) SetNext

func (p *StreamConn) SetNext(_ IConn)

SetNext ...

func (*StreamConn) SetReceiver

func (p *StreamConn) SetReceiver(receiver IReceiver)

SetReceiver ...

func (*StreamConn) WriteStreamAndRelease

func (p *StreamConn) WriteStreamAndRelease(stream *rpc.Stream)

WriteStreamAndRelease ...

type SyncConn

type SyncConn struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SyncConn ...

func NewClientSyncConn

func NewClientSyncConn(netConn net.Conn, rBufSize int, wBufSize int) *SyncConn

NewClientSyncConn ...

func NewServerSyncConn

func NewServerSyncConn(netConn net.Conn, rBufSize int, wBufSize int) *SyncConn

NewServerSyncConn ...

func (*SyncConn) Close

func (p *SyncConn) Close()

Close ...

func (*SyncConn) LocalAddr

func (p *SyncConn) LocalAddr() net.Addr

LocalAddr ...

func (*SyncConn) OnClose

func (p *SyncConn) OnClose()

OnClose ...

func (*SyncConn) OnError

func (p *SyncConn) OnError(err *base.Error)

OnError ...

func (*SyncConn) OnFillWrite

func (p *SyncConn) OnFillWrite(_ []byte) int

OnFillWrite ...

func (*SyncConn) OnOpen

func (p *SyncConn) OnOpen()

OnOpen ...

func (*SyncConn) OnReadBytes

func (p *SyncConn) OnReadBytes(_ []byte)

OnReadBytes ...

func (*SyncConn) OnReadReady

func (p *SyncConn) OnReadReady() bool

OnReadReady ...

func (*SyncConn) OnWriteReady

func (p *SyncConn) OnWriteReady() bool

OnWriteReady ...

func (*SyncConn) RemoteAddr

func (p *SyncConn) RemoteAddr() net.Addr

RemoteAddr ...

func (*SyncConn) SetNext

func (p *SyncConn) SetNext(next IConn)

SetNext ...

Jump to

Keyboard shortcuts

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