mercury

package module
v0.0.0-...-96cbe97 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2016 License: MIT Imports: 9 Imported by: 0

README

Mercury

🚨 Mercury is deprecated and is no longer maintained. 🚨

Build Status GoDoc

An RPC client/server implementation using Typhon, intended for building microservices.

Server

A Server receives RPC requests, routes them to an Endpoint, calls a handler function to "do work," and returns a response back to a caller.

Server middleware

Server middleware offers hooks into request processing for globally altering a server's input or output. They could be used to provide authentication or distributed tracing functionality, for example.

Client

A Client offers a convenient way, atop a Typhon transport, to make requests to other servers. They co-ordinate the execution of many parallel requests, deal with response and error unmarshaling, and provide convenient ways of dealing with response errors.

Client middleware

Like server middleware, clients too have hooks for altering outbound requests or inbound responses.

Service

A Service is a lightweight wrapper around a server, which also sets up some global defaults (for instance, to use the same default client transport as the server).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message tmsg.Message

type Request

type Request interface {
	tmsg.Request
	context.Context

	// Response constructs a response to this request, with the (optional) given body. The response will share
	// the request's ID, and be destined for the originator.
	Response(body interface{}) Response
	// A Context for the Request.
	Context() context.Context
	// SetContext replaces the Request's Context.
	SetContext(ctx context.Context)
}

A Request is a representation of an RPC call (inbound or outbound). It extends Typhon's Request to provide a Context, and also helpers for constructing a response.

func FromTyphonRequest

func FromTyphonRequest(req tmsg.Request) Request

func NewRequest

func NewRequest() Request

type Response

type Response interface {
	tmsg.Response
	// IsError returns whether this response contains an error
	IsError() bool
	// SetIsError modifies whether the flag specifying whether this response contains an error
	SetIsError(bool)
	// Error returns the error contained within the response
	Error() error
}

func FromTyphonResponse

func FromTyphonResponse(rsp tmsg.Response) Response

func NewResponse

func NewResponse() Response

Directories

Path Synopsis
Package testproto is a generated protocol buffer package.
Package testproto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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