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) SetRouter ¶
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) Transports ¶
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
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 ¶
CallOneway makes a oneway request using Cherami.
func (*Outbound) Transports ¶
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 ¶
NewTransport creates a new cherami transport for shared objects between inbound and outbound.
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.
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.