Documentation ¶
Overview ¶
Package http implements the HTTP inbound and outbound transports for YARPC.
Note that the Close method for the HTTP Inbound does NOT immediately close the ongoing connections. The connection will remain open until all clients have disconnected.
Index ¶
Constants ¶
const ( // ApplicationHeaderPrefix is the prefix added to application headers over // the wire. ApplicationHeaderPrefix = "Rpc-Header-" // CallerHeader is the HTTP header used to indiate the service doing the calling CallerHeader = "Rpc-Caller" // EncodingHeader is the HTTP header used to specify the name of the // encoding. EncodingHeader = "Rpc-Encoding" // TTLMSHeader is the HTTP header used to indicate the ttl in ms TTLMSHeader = "Context-TTL-MS" // ProcedureHeader is the HTTP header used to indicate the procedure ProcedureHeader = "Rpc-Procedure" // ServiceHeader is the HTTP header used to indicate the service ServiceHeader = "Rpc-Service" // ShardKeyHeader is the HTTP header used by a clustered service to // identify the node responsible for handling the request. ShardKeyHeader = "Rpc-Shard-Key" // RoutingKeyHeader is the HTTP header used by a relay to identify // the traffic group responsible for handling the request, overriding the // service name when available. RoutingKeyHeader = "Rpc-Routing-Key" // RoutingDelegateHeader is the HTTP header used by a relay to identify a // service that can proxy for the destined service and perform // application-specific routing. RoutingDelegateHeader = "Rpc-Routing-Delegate" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶ added in v0.4.0
type Agent struct {
// contains filtered or unexported fields
}
Agent keeps track of http peers and the associated client with which the peer will call into.
func NewAgent ¶ added in v0.4.0
func NewAgent(opts ...AgentOption) *Agent
NewAgent creates a new http agent for managing peers and sending requests
func (*Agent) ReleasePeer ¶ added in v0.4.0
func (a *Agent) ReleasePeer(pid peer.Identifier, sub peer.Subscriber) error
ReleasePeer releases a peer from the peer.Subscriber and removes that peer from the Agent if nothing is listening to it
func (*Agent) RetainPeer ¶ added in v0.4.0
func (a *Agent) RetainPeer(pid peer.Identifier, sub peer.Subscriber) (peer.Peer, error)
RetainPeer gets or creates a Peer for the specified peer.Subscriber (usually a peer.List)
type AgentOption ¶ added in v0.4.0
type AgentOption func(*agentConfig)
AgentOption customizes the behavior of an HTTP agent.
func KeepAlive ¶
func KeepAlive(t time.Duration) AgentOption
KeepAlive specifies the keep-alive period for the network connection. If zero, keep-alives are disabled.
Defaults to 30 seconds.
type Inbound ¶
type Inbound interface { transport.Inbound // Address on which the server is listening. Returns nil if Start has not // been called yet. Addr() net.Addr }
Inbound represents an HTTP Inbound. It is the same as the transport Inbound except it exposes the address on which the system is listening for connections.
func NewInbound ¶
func NewInbound(addr string, opts ...InboundOption) Inbound
NewInbound builds a new HTTP inbound that listens on the given address.
type InboundOption ¶
type InboundOption func(*inbound)
InboundOption is an option for an HTTP inbound.
type Outbound ¶ added in v0.4.0
type Outbound struct {
// contains filtered or unexported fields
}
Outbound is an HTTP UnaryOutbound and OnewayOutbound
func NewOutbound
deprecated
func NewOutbound(urlStr string, opts ...AgentOption) *Outbound
NewOutbound builds a new HTTP outbound that sends requests to the given URL.
Deprecated: create outbounds through NewPeerListOutbound instead
func NewPeerListOutbound ¶ added in v0.4.0
NewPeerListOutbound builds a new HTTP outbound built around a PeerList for getting potential downstream hosts. PeerList.ChoosePeer MUST return *hostport.Peer objects. PeerList.Start MUST be called before Outbound.Start
func (*Outbound) CallOneway ¶ added in v0.4.0
CallOneway makes a oneway request