broker

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GatewayRPCBroker

type GatewayRPCBroker interface {
	// SendRequestToGateway is called by the HTTP server to send a request
	// to a certain gateway, and waits on the response channel for response.
	// The caller should time out on the response channel.
	SendRequestToGateway(gwReq *protos.GatewayRequest) (*GatewayResponseChannel, error)
	// ProcessGatewayResponse is called by the SyncRPC servicer. It receives
	// a SyncRPCResponse from the SyncRPC servicer, and send the corresponding GatewayResponse to the HTTP server
	ProcessGatewayResponse(response *protos.SyncRPCResponse) error
	// InitializeGateway initializes the necessary data structures for a gwId
	// when the gateway connects to the SyncRPC servicer so the dispatcher
	// is ready to take any requests for this gateway, and returns
	// a request queue for gRPC servicer to listen on for incoming requests
	// from HTTP servers.
	InitializeGateway(gwId string) chan *protos.SyncRPCRequest
	// CleanupGateway cleans up the data and resources for a gwId when the gw loses SyncRPC connection to the cloud.
	CleanupGateway(gwId string) error
	// CancelGatewayRequest notifies the gateway to stop handling the request with ID reqId.
	CancelGatewayRequest(gwId string, reqId uint32) error
}

GatewayRPCBroker is the bridge between httpServer and SyncRPC servicer, where httpServer handles requests from the cloud service instances, and SyncRPC servicer talks directly to the gateways using a gRPC bidirectional stream.

type GatewayRPCBrokerImpl

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

GatewayRPCBrokerImpl implements a GatewayRPCBroker, managing a response table and request queue.

func NewGatewayReqRespBroker

func NewGatewayReqRespBroker() *GatewayRPCBrokerImpl

func (*GatewayRPCBrokerImpl) CancelGatewayRequest

func (broker *GatewayRPCBrokerImpl) CancelGatewayRequest(gwId string, reqId uint32) error

func (*GatewayRPCBrokerImpl) CleanupGateway

func (broker *GatewayRPCBrokerImpl) CleanupGateway(gwId string) error

func (*GatewayRPCBrokerImpl) InitializeGateway

func (broker *GatewayRPCBrokerImpl) InitializeGateway(gwId string) chan *protos.SyncRPCRequest

func (*GatewayRPCBrokerImpl) ProcessGatewayResponse

func (broker *GatewayRPCBrokerImpl) ProcessGatewayResponse(response *protos.SyncRPCResponse) error

func (*GatewayRPCBrokerImpl) SendRequestToGateway

func (broker *GatewayRPCBrokerImpl) SendRequestToGateway(
	gwReq *protos.GatewayRequest,
) (*GatewayResponseChannel, error)

type GatewayResponseChannel

type GatewayResponseChannel struct {
	RespChan chan *protos.GatewayResponse
	ReqId    uint32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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