cherami

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TransportSpec added in v1.9.0

func TransportSpec(opts ...TransportSpecOption) yarpcconfig.TransportSpec

TransportSpec builds a TransportSpec for the Cherami transport. TransportSpecOptions may be passed to this function to configure the behavior of the TransportSpec.

configurator.MustRegisterTransport(
	cherami.TransportSpec(cherami.DefaultPeerList("/etc/hosts.json")),
)

See TransportConfig, InboundConfig, and OutboundConfig for details on the different configuration parameters supported by this Transport.

Types

type Inbound

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

Inbound receives Oneway YARPC requests over Cherami.

func (*Inbound) IsRunning

func (i *Inbound) IsRunning() bool

IsRunning returns whether the inbound is still processing requests.

func (*Inbound) SetRouter

func (i *Inbound) SetRouter(router transport.Router)

SetRouter configures a router to handle incoming requests. This satisfies the transport.Inbound interface, and would be called by a dispatcher when it starts.

func (*Inbound) Start

func (i *Inbound) Start() error

Start starts the inbound, reads and handle messages from Cherami.

func (*Inbound) Stop

func (i *Inbound) Stop() error

Stop ends the connection to Cherami.

func (*Inbound) Transports

func (i *Inbound) Transports() []transport.Transport

Transports returns the transport that the inbound uses.

type InboundConfig

type InboundConfig struct {
	// Destination from which RPCs for this inbound will be retrieved.
	//
	// If unspecified, the destination "/${service}/yarpc_dest" will be used
	// where ${service} is the name of your YARPC service.
	Destination string `config:"destination,interpolate"`

	// Name of the consumer group used to read RPCs from Cherami.
	//
	// If unspecified, the consumer group "/${service}/yarpc_cg" will be used
	// where ${service} is the name of your YARPC service.
	ConsumerGroup string `config:"consumerGroup,interpolate"`

	// Number of requests to buffer locally. If requests are short-lived,
	// setting this to a higher value may improve throughput at the cost of
	// memory usage.
	//
	// Defaults to 10.
	PrefetchCount int `config:"prefetchCount"`
}

InboundConfig configures a Cherami Inbound.

inbounds:
  cherami:
    destination: /myservice/yarpc_dest
    consumerGroup: /myservice/yarpc_cg

type InboundOptions added in v1.9.0

type InboundOptions struct {
	Destination   string
	ConsumerGroup string
	PrefetchCount int
}

InboundOptions defines the config in order to create a Inbound.

PrefetchCount controls the number of messages to buffer locally. Inbounds which process messages very fast may want to specify larger value for PrefetchCount for faster throughput. On the flip side larger values for PrefetchCount will result in more messages being buffered locally causing high memory footprint.

type Outbound

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

Outbound is a outbound that uses Cherami as the transport.

func (*Outbound) CallOneway

func (o *Outbound) CallOneway(ctx context.Context, req *transport.Request) (transport.Ack, error)

CallOneway makes a oneway request using Cherami.

func (*Outbound) IsRunning

func (o *Outbound) IsRunning() bool

IsRunning returns whether the outbound is still running.

func (*Outbound) Start

func (o *Outbound) Start() error

Start starts the outbound.

func (*Outbound) Stop

func (o *Outbound) Stop() error

Stop ends the connection to Cherami.

func (*Outbound) Transports

func (o *Outbound) Transports() []transport.Transport

Transports returns the transport that the outbound uses.

type OutboundConfig

type OutboundConfig struct {
	// Destination to which RPCs for this outbound will be written.
	//
	// If unspecified, the destination "/${service}/yarpc_dest" will be used
	// where ${service} is the name of the destination service.
	Destination string `config:"destination,interpolate"`
}

OutboundConfig configures a Cherami Outbound.

type OutboundOptions added in v1.9.0

type OutboundOptions struct {
	Destination string
}

OutboundOptions specifies a Cherami outbound.

type Transport

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

Transport keeps shared objects between inbound and outbound.

func NewTransport

func NewTransport(client cherami.Client) *Transport

NewTransport creates a new cherami transport for shared objects between inbound and outbound.

func (*Transport) IsRunning

func (t *Transport) IsRunning() bool

IsRunning returns whether the cherami transport is running.

func (*Transport) NewInbound

func (t *Transport) NewInbound(opts InboundOptions) *Inbound

NewInbound builds a new Cherami inbound.

func (*Transport) NewOutbound

func (t *Transport) NewOutbound(opts OutboundOptions) *Outbound

NewOutbound builds a new cherami outbound.

func (*Transport) Start

func (t *Transport) Start() error

Start starts the cherami transport.

func (*Transport) Stop

func (t *Transport) Stop() error

Stop stops the cherami transport.

type TransportConfig added in v1.9.0

type TransportConfig struct {
	// If specified, this is the address of a specific Cherami Frontend or a
	// locally hosted development instance. Most users should omit this since
	// the Cherami Frontend will be discovered automatically.
	//
	// 	address: 127.0.0.1:4922
	Address string `config:"address,interpolate"`

	// Path to a JSON file containing the TChannel peer list used to
	// auto-discover Cherami Frontend machines. This may be skipped if a
	// default peer list was provided on TransportSpec instantiation or if an
	// Address was provided.
	//
	// 	peerList: /etc/hosts.json
	PeerList string `config:"peerList,interpolate"`

	// Timeout for requests to the Cherami service. The default timeout should
	// suffice for most use cases.
	//
	// 	timeout: 5s
	Timeout time.Duration `config:"timeout"`

	// Name of the Cherami deployment to which requests should be sent. Some
	// examples are, "prod", "staging", "staging2", and "dev".
	//
	// 	deploymentStr: dev
	//
	// Defaults to "prod".
	DeploymentStr string `config:"deploymentStr,interpolate"`
}

TransportConfig configures the shared Cherami Transport. This is shared between all Cherami outbounds and inbounds of a Dispatcher.

All fields in TransportConfig are optional and this section may be skipped entirely for most use cases.

type TransportSpecOption added in v1.9.0

type TransportSpecOption func(*transportSpec)

TransportSpecOption configures the Cherami TransportSpec.

func DefaultPeerList added in v1.9.0

func DefaultPeerList(path string) TransportSpecOption

DefaultPeerList specifies the default path at which the TChannel peer list may be found.

This value will be used when building Cherami transports that automatically discover Cherami Frontends if the user did not provide their own peer list.

Jump to

Keyboard shortcuts

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