Documentation ¶
Index ¶
Constants ¶
const ( // ApplicationHeaderPrefix is the prefix added to application headers over // the wire. ApplicationHeaderPrefix = "Rpc-Header-" // BaggageHeaderPrefix is the prefix added to context headers over the wire. BaggageHeaderPrefix = "Context-" // 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 = BaggageHeaderPrefix + "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" )
const ( // MesosHTTPConnTimeout is the mesos connection timeout MesosHTTPConnTimeout = 30 * time.Second // MesosHTTPConnKeepAlive is the mesos connection keep alive MesosHTTPConnKeepAlive = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func NewOutbound ¶
func NewOutbound( parent tally.Scope, detector LeaderDetector, urlTemplate url.URL, defaultHeaders http.Header, opts ...OutboundOption) transport.Outbounds
NewOutbound builds a new HTTP outbound that sends requests to the given URL.
Types ¶
type ErrNoLeader ¶
type ErrNoLeader string
ErrNoLeader represents no leader is available for outbound.
func (ErrNoLeader) Error ¶
func (e ErrNoLeader) Error() string
type Inbound ¶
type Inbound interface { transport.Inbound StartMesosLoop(ctx context.Context, newHostPort string) (chan error, error) }
Inbound represents a Mesos 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(parent tally.Scope, d MesosDriver, opts ...InboundOption) Inbound
NewInbound builds a new Mesos HTTP inbound after registering with Mesos master via Subscribe message
type InboundOption ¶
type InboundOption func(*inbound)
InboundOption is an option for an Mesos HTTP inbound.
type LeaderDetector ¶
type LeaderDetector interface { // Current leader's hostport, or empty string if no leader. HostPort() string }
LeaderDetector provides current leader's hostport.
type MesosDriver ¶
type MesosDriver interface { // Returns the name of Mesos driver such as scheduler or executor Name() string // Returns the Mesos endpoint to be connected to Endpoint() url.URL // Returns the Type of Mesos event message such as // mesos.v1.scheduler.Event or mesos.v1.executor.Event EventDataType() reflect.Type // Returns a subscribe Call message to be sent to Mesos for // setting up an event stream connection PrepareSubscribeRequest(ctx context.Context, mesosMasterHostPort string) (*http.Request, error) // Invoked after the subscription to Mesos is done PostSubscribe(ctx context.Context, mesosStreamID string) // GetContentEncoding returns the http content encoding of the Mesos // HTTP traffic GetContentEncoding() string }
MesosDriver is an interface used by Inbound to subscribe to a Mesos service endpoint such as scheduler, executor, master etc.
type Metrics ¶
type Metrics struct { Running tally.Gauge Stopped tally.Gauge LeaderChanges tally.Counter StartCount tally.Counter StopCount tally.Counter Frames tally.Counter ReadLineError tally.Counter FrameLengthError tally.Counter LineLengthError tally.Counter RecordIOError tally.Counter }
Metrics hold all metrics related to mhttp.
type OutboundOption ¶
type OutboundOption func(*outboundConfig)
OutboundOption customizes the behavior of a Mesos HTTP outbound.
func KeepAlive ¶
func KeepAlive(t time.Duration) OutboundOption
KeepAlive specifies the keep-alive period for the network connection. If zero, keep-alives are disabled.
Defaults to 30 seconds.
func MaxConnectionsPerHost ¶
func MaxConnectionsPerHost(conns int) OutboundOption
MaxConnectionsPerHost defines the max connections per host Default value is 1024