remote

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoSuchPayloadType      = errors.New("not such payload type")
	ErrorInvalidRequestBodyType = errors.New("invalid request body type")
)

Functions

func MarshalPayload

func MarshalPayload(valu interface{}) (*nacospb.Payload, error)

MarshalPayload .

func ValueClientIP

func ValueClientIP(ctx context.Context) string

func ValueConnID

func ValueConnID(ctx context.Context) string

Types

type Client

type Client struct {
	ID       string         `json:"id"`
	Addr     *net.TCPAddr   `json:"addr"`
	ConnMeta ConnectionMeta `json:"conn_meta"`
	// contains filtered or unexported fields
}

Client

func (*Client) Close

func (c *Client) Close()

func (*Client) LoadStream

func (c *Client) LoadStream() (*SyncServerStream, bool)

func (*Client) SetStreamRef

func (c *Client) SetStreamRef(stream *SyncServerStream)

type ClientIPKey

type ClientIPKey struct{}

type ClientInFlights

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

ClientInFlights

type ConnIDKey

type ConnIDKey struct{}

type ConnectionEvent

type ConnectionEvent struct {
	EventType EventType
	ConnID    string
	Client    *Client
}

ConnectionEvent

type ConnectionInfoKey

type ConnectionInfoKey struct{}

type ConnectionManager

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

func NewConnectionManager

func NewConnectionManager() *ConnectionManager

func (*ConnectionManager) GetClient

func (h *ConnectionManager) GetClient(id string) (*Client, bool)

func (*ConnectionManager) GetClientByAddr

func (h *ConnectionManager) GetClientByAddr(addr string) (*Client, bool)

func (*ConnectionManager) GetStream

func (h *ConnectionManager) GetStream(connID string) *SyncServerStream

func (*ConnectionManager) HandleConn

func (h *ConnectionManager) HandleConn(ctx context.Context, s stats.ConnStats)

HandleConn processes the Conn stats.

func (*ConnectionManager) HandleRPC

func (h *ConnectionManager) HandleRPC(ctx context.Context, s stats.RPCStats)

HandleRPC processes the RPC stats.

func (*ConnectionManager) InFlights

func (h *ConnectionManager) InFlights() *InFlights

func (*ConnectionManager) ListConnections

func (h *ConnectionManager) ListConnections() map[string]*Client

func (*ConnectionManager) OnAccept

func (h *ConnectionManager) OnAccept(conn net.Conn)

OnAccept call when net.Conn accept

func (*ConnectionManager) OnClose

func (h *ConnectionManager) OnClose()

OnClose call when net.Listener close

func (*ConnectionManager) OnRelease

func (h *ConnectionManager) OnRelease(conn net.Conn)

OnRelease call when net.Conn release

func (*ConnectionManager) RefreshClient

func (h *ConnectionManager) RefreshClient(ctx context.Context)

func (*ConnectionManager) RegisterConnection

func (h *ConnectionManager) RegisterConnection(ctx context.Context, payload *nacospb.Payload,
	req *nacospb.ConnectionSetupRequest) error

func (*ConnectionManager) TagConn

func (h *ConnectionManager) TagConn(ctx context.Context, connInfo *stats.ConnTagInfo) context.Context

TagConn can attach some information to the given context. The returned context will be used for stats handling. For conn stats handling, the context used in HandleConn for this connection will be derived from the context returned. For RPC stats handling,

  • On server side, the context used in HandleRPC for all RPCs on this

connection will be derived from the context returned.

  • On client side, the context is not derived from the context returned.

func (*ConnectionManager) TagRPC

TagRPC can attach some information to the given context. The context used for the rest lifetime of the RPC will be derived from the returned context.

func (*ConnectionManager) UnRegisterConnection

func (h *ConnectionManager) UnRegisterConnection(connID string)

type ConnectionMeta

type ConnectionMeta struct {
	ConnectType      string
	ClientIp         string
	RemoteIp         string
	RemotePort       int
	LocalPort        int
	Version          string
	ConnectionId     string
	CreateTime       time.Time
	AppName          string
	Tenant           string
	Labels           map[string]string
	ClientAttributes nacospb.ClientAbilities
}

ConnectionMeta

func ValueConnMeta

func ValueConnMeta(ctx context.Context) ConnectionMeta

type EventType

type EventType int32
const (
	ClientConnectionEvent = "ClientConnectionEvent"

	EventClientConnected EventType
	EventClientDisConnected
)

type InFlight

type InFlight struct {
	ConnID     string
	RequestID  string
	Callback   func(map[string]interface{}, nacospb.BaseResponse, error)
	ExpireTime time.Time
	Attachment map[string]interface{}
	// contains filtered or unexported fields
}

InFlight

func (*InFlight) IsExpire

func (i *InFlight) IsExpire(now time.Time) bool

type InFlights

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

InFlights

func NewInFlights

func NewInFlights(ctx context.Context) *InFlights

func (*InFlights) AddInFlight

func (i *InFlights) AddInFlight(inflight *InFlight) error

AddInFlight 添加一个待回调通知的 InFligjt

func (*InFlights) NotifyInFlight

func (i *InFlights) NotifyInFlight(connID string, resp nacospb.BaseResponse)

type RequestHandler

RequestHandler

type RequestHandlerWarrper

type RequestHandlerWarrper struct {
	Handler        RequestHandler
	PayloadBuilder func() nacospb.CustomerPayload
}

RequestHandlerWarrper

type SyncServerStream

type SyncServerStream struct {
	Stream grpc.ServerStream
	// contains filtered or unexported fields
}

SyncServerStream

func (*SyncServerStream) Context

func (s *SyncServerStream) Context() context.Context

Context returns the context for this stream.

func (*SyncServerStream) SendMsg

func (s *SyncServerStream) SendMsg(m interface{}) error

Jump to

Keyboard shortcuts

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