agent

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	GetSession() session.Session
	Push(route string, v interface{}) error
	ResponseMID(ctx context.Context, mid uint, v interface{}, isError ...bool) error
	Close() error
	RemoteAddr() net.Addr
	String() string
	GetStatus() int32
	Kick(ctx context.Context) error
	SetLastAt()
	SetStatus(state int32)
	Handle()
	IPVersion() string
	SendHandshakeResponse() error
	SendHandshakeErrorResponse() error
	SendRequest(ctx context.Context, serverID, route string, v interface{}) (*protos.Response, error)
	AnswerWithError(ctx context.Context, mid uint, err error)
}

Agent corresponds to a user and is used for storing raw Conn information

type AgentFactory

type AgentFactory interface {
	CreateAgent(conn net.Conn) Agent
}

AgentFactory factory for creating Agent instances

func NewAgentFactory

func NewAgentFactory(
	appDieChan chan bool,
	decoder codec.PacketDecoder,
	encoder codec.PacketEncoder,
	serializer serialize.Serializer,
	heartbeatTimeout time.Duration,
	messageEncoder message.Encoder,
	messagesBufferSize int,
	sessionPool session.SessionPool,
	metricsReporters []metrics.Reporter,
) AgentFactory

NewAgentFactory ctor

type Remote

type Remote struct {
	Session session.Session // session
	// contains filtered or unexported fields
}

Remote corresponding to another server

func NewRemote

func NewRemote(
	sess *protos.Session,
	reply string,
	rpcClient cluster.RPCClient,
	encoder codec.PacketEncoder,
	serializer serialize.Serializer,
	serviceDiscovery cluster.ServiceDiscovery,
	frontendID string,
	messageEncoder message.Encoder,
	sessionPool session.SessionPool,
) (*Remote, error)

NewRemote create new Remote instance

func (*Remote) Close

func (a *Remote) Close() error

Close closes the remote

func (*Remote) Kick

func (a *Remote) Kick(ctx context.Context) error

Kick kicks the user

func (*Remote) Push

func (a *Remote) Push(route string, v interface{}) error

Push pushes the message to the user

func (*Remote) RemoteAddr

func (a *Remote) RemoteAddr() net.Addr

RemoteAddr returns the remote address of the user

func (*Remote) ResponseMID

func (a *Remote) ResponseMID(ctx context.Context, mid uint, v interface{}, isError ...bool) error

ResponseMID reponds the message with mid to the user

func (*Remote) SendRequest

func (a *Remote) SendRequest(ctx context.Context, serverID, reqRoute string, v interface{}) (*protos.Response, error)

SendRequest sends a request to a server

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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