Documentation
¶
Index ¶
- type HTTPService
- func (httpSrv *HTTPService) Discard(ctx context.Context)
- func (httpSrv *HTTPService) ExecuteBuffered(ctx context.Context, creq chan interface{}, cwork chan int)
- func (httpSrv *HTTPService) ExecuteRealTime(ctx context.Context, creq chan interface{}, cwork chan int)
- func (httpSrv *HTTPService) Read() (interface{}, error)
- func (httpSrv *HTTPService) Write(resp interface{}) error
- type HTTPServiceOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPService ¶
type HTTPService struct {
// contains filtered or unexported fields
}
HTTPService is the core http flow handler
func New ¶
func New(sqp *model.ServiceQProperties, httpSrvOptions ...HTTPServiceOption) *HTTPService
New initializes new HTTPService and sets up the upstream client
func NewNop ¶
func NewNop(sqp *model.ServiceQProperties) *HTTPService
NewNop returns a HTTPService that does nothing
func (*HTTPService) Discard ¶
func (httpSrv *HTTPService) Discard(ctx context.Context)
Discard sets error response and discards client http connection
func (*HTTPService) ExecuteBuffered ¶
func (httpSrv *HTTPService) ExecuteBuffered(ctx context.Context, creq chan interface{}, cwork chan int)
ExecuteBuffered retries buffered requests by calling dialAndSend()
func (*HTTPService) ExecuteRealTime ¶
func (httpSrv *HTTPService) ExecuteRealTime(ctx context.Context, creq chan interface{}, cwork chan int)
ExecuteRealTime reads from incoming http connection and attempts to forward it to upstream nodes by calling dialAndSend(). It temporarily saves the request before forwarding, if needed for subsequent retries. This saved request can be buffered if dialAndSend() is unable to forward to any upstream nodes.
func (*HTTPService) Read ¶
func (httpSrv *HTTPService) Read() (interface{}, error)
Read reads http request from reader
func (*HTTPService) Write ¶
func (httpSrv *HTTPService) Write(resp interface{}) error
Write writes http response to writer (in http format)
type HTTPServiceOption ¶
type HTTPServiceOption func(*HTTPService) error
func WithIncomingTCPConn ¶
func WithIncomingTCPConn(tcpConn *net.Conn) HTTPServiceOption
WithIncomingTCPConn assigns a tcp conn and binds reader/writer to http service