mediator

package
v0.1.6-0...-5c25bcb Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InvalidRequestErrorCode for invalid requests.
	InvalidRequestErrorCode = command.Code(iota + command.ROUTE)

	// ResponseWriteErrorCode for connection ID validation error.
	RegisterMissingConnIDCode

	// RegisterRouterErrorCode for register router error.
	RegisterRouterErrorCode

	// UnregisterRouterErrorCode for unregister router error.
	UnregisterRouterErrorCode

	// GetConnectionsErrorCode for get connections error.
	GetConnectionsErrorCode

	// ReconnectMissingConnIDCode for connection ID validation error.
	ReconnectMissingConnIDCode

	// ReconnectRouterErrorCode for reconnecting router error.
	ReconnectRouterErrorCode

	// StatusRequestMissingConnIDCode for connection ID validation error.
	StatusRequestMissingConnIDCode

	// StatusRequestErrorCode for status request error.
	StatusRequestErrorCode

	// BatchPickupMissingConnIDCode for connection ID validation error.
	BatchPickupMissingConnIDCode

	// BatchPickupRequestErrorCode for batch pick up error.
	BatchPickupRequestErrorCode

	// ReconnectAllError is typically a code for mediator reconnectAll errors.
	ReconnectAllError
)

Error codes.

View Source
const (
	// command name.
	CommandName = "mediator"

	// command methods.
	RegisterCommandMethod       = "Register"
	UnregisterCommandMethod     = "Unregister"
	GetConnectionsCommandMethod = "Connections"
	ReconnectCommandMethod      = "Reconnect"
	StatusCommandMethod         = "Status"
	BatchPickupCommandMethod    = "BatchPickup"
	ReconnectAllCommandMethod   = "ReconnectAll"
)

constant for the mediator controller.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchPickupRequest

type BatchPickupRequest struct {
	// ConnectionID of connection for which pending messages needs to be dispatched.
	ConnectionID string `json:"connectionID"`
	// Size of batch of pending messages to be dispatched.
	Size int `json:"batch_size"`
}

BatchPickupRequest is request for dispatching pending messages.

type BatchPickupResponse

type BatchPickupResponse struct {
	// Count of messages dispatched.
	MessageCount int `json:"message_count"`
}

BatchPickupResponse is response for dispatching pending messages.

type Command

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

Command contains command operations provided by route controller.

func New

func New(ctx provider, autoAccept bool) (*Command, error)

New returns new route controller command instance.

func (*Command) BatchPickup

func (o *Command) BatchPickup(rw io.Writer, req io.Reader) command.Error

BatchPickup dispatches pending messages for given connection.

func (*Command) Connections

func (o *Command) Connections(rw io.Writer, req io.Reader) command.Error

Connections returns the connections of the router.

func (*Command) GetHandlers

func (o *Command) GetHandlers() []command.Handler

GetHandlers returns list of all commands supported by this controller command.

func (*Command) Reconnect

func (o *Command) Reconnect(rw io.Writer, req io.Reader) command.Error

Reconnect sends noop message to given connection to re-establish a network connection. nolint:dupl

func (*Command) ReconnectAll

func (o *Command) ReconnectAll(rw io.Writer, req io.Reader) command.Error

ReconnectAll performs reconnection on all available mediator connections. This command is useful in re-establishing lost connections (ex: lost websocket connection).

func (*Command) Register

func (o *Command) Register(rw io.Writer, req io.Reader) command.Error

Register registers the agent with the router. nolint:dupl

func (*Command) Status

func (o *Command) Status(rw io.Writer, req io.Reader) command.Error

Status returns details about pending messages for given connection.

func (*Command) Unregister

func (o *Command) Unregister(rw io.Writer, req io.Reader) command.Error

Unregister unregisters the agent with the router.

type ConnectionsResponse

type ConnectionsResponse struct {
	Connections []string `json:"connections"`
}

ConnectionsResponse is response for router`s connections.

type CreateInvitationRequest

type CreateInvitationRequest struct {
	Label     string        `json:"label"`
	Goal      string        `json:"goal"`
	GoalCode  string        `json:"goal_code"`
	Service   []interface{} `json:"service"`
	Protocols []string      `json:"protocols"`
}

CreateInvitationRequest model

This is used for creating an invitation using mediator

type CreateInvitationResponse

type CreateInvitationResponse struct {
	// Invitation is out-of-band invitation from mediator.
	Invitation *outofband.Invitation `json:"invitation"`
}

CreateInvitationResponse model

Response for creating invitation through mediator

type RegisterRoute

type RegisterRoute struct {
	ConnectionID string `json:"connectionID"`
}

RegisterRoute contains parameters for registering/reconnecting router.

type StatusRequest

type StatusRequest struct {
	ConnectionID string `json:"connectionID"`
}

StatusRequest is request for getting details about pending messages.

type StatusResponse

type StatusResponse struct {
	*messagepickup.Status
}

StatusResponse is status response containing details about pending messages.

Jump to

Keyboard shortcuts

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