Documentation ¶
Index ¶
- Constants
- func ExecuteTask(tloc *TRSHTTPLocal, tct taskChannelTuple)
- func SendDelayedError(tct taskChannelTuple, logger *logrus.Logger)
- type ClientPolicy
- type HttpKafkaRx
- type HttpKafkaTx
- type HttpTask
- type HttpTxPolicy
- type RetryPolicy
- type SerializedRequest
- type SerializedResponse
- type TRSHTTPLocal
- func (tloc *TRSHTTPLocal) Alive() (bool, error)
- func (tloc *TRSHTTPLocal) Cancel(taskList *[]HttpTask)
- func (tloc *TRSHTTPLocal) Check(taskList *[]HttpTask) (bool, error)
- func (tloc *TRSHTTPLocal) Cleanup()
- func (tloc *TRSHTTPLocal) Close(taskList *[]HttpTask)
- func (tloc *TRSHTTPLocal) CreateTaskList(source *HttpTask, numTasks int) []HttpTask
- func (tloc *TRSHTTPLocal) Init(serviceName string, logger *logrus.Logger) error
- func (tloc *TRSHTTPLocal) Launch(taskList *[]HttpTask) (chan *HttpTask, error)
- func (tloc *TRSHTTPLocal) SetSecurity(inParams interface{}) error
- type TRSHTTPLocalSecurity
- type TRSHTTPRemote
- func (tloc *TRSHTTPRemote) Alive() (bool, error)
- func (tloc *TRSHTTPRemote) Cancel(taskList *[]HttpTask)
- func (tloc *TRSHTTPRemote) Check(taskList *[]HttpTask) (bool, error)
- func (tloc *TRSHTTPRemote) Cleanup()
- func (tloc *TRSHTTPRemote) Close(taskList *[]HttpTask)
- func (tloc *TRSHTTPRemote) CreateTaskList(source *HttpTask, numTasks int) []HttpTask
- func (tloc *TRSHTTPRemote) Init(serviceName string, logger *logrus.Logger) error
- func (tloc *TRSHTTPRemote) Launch(taskList *[]HttpTask) (chan *HttpTask, error)
- func (tloc *TRSHTTPRemote) SetSecurity(inParams interface{}) error
- type TrsAPI
Constants ¶
View Source
const ( DFLT_RETRY_MAX = 3 //default max # of retries on failure DFLT_BACKOFF_MAX = 5 //default max seconds per retry )
Variables ¶
This section is empty.
Functions ¶
func ExecuteTask ¶
func ExecuteTask(tloc *TRSHTTPLocal, tct taskChannelTuple)
func SendDelayedError ¶
Types ¶
type ClientPolicy ¶
type ClientPolicy struct { Retry RetryPolicy Tx HttpTxPolicy }
type HttpKafkaRx ¶
type HttpKafkaRx struct { ID uuid.UUID // message ID Response *SerializedResponse Err *error }
type HttpKafkaTx ¶
type HttpKafkaTx struct { ID uuid.UUID Request SerializedRequest `json:",omitempty"` TimeStamp string `json:",omitempty"` // Time the request time.Now().String() Timeout time.Duration `json:",omitempty"` CPolicy ClientPolicy ServiceName string Ignore bool }
func (HttpKafkaTx) ToHttpTask ¶
func (tx HttpKafkaTx) ToHttpTask() (ht HttpTask)
type HttpTask ¶
type HttpTask struct { ServiceName string //name of the service Request *http.Request TimeStamp string // Time the request was created/sent RFC3339Nano Err *error Timeout time.Duration // task's context timeout CPolicy ClientPolicy Ignore bool // contains filtered or unexported fields }
func (*HttpTask) SetIDIfNotPopulated ¶
func (HttpTask) ToHttpKafkaRx ¶
func (ht HttpTask) ToHttpKafkaRx() (rx HttpKafkaRx)
func (HttpTask) ToHttpKafkaTx ¶
func (ht HttpTask) ToHttpKafkaTx() (tx HttpKafkaTx)
type HttpTxPolicy ¶
type RetryPolicy ¶
type SerializedRequest ¶
type SerializedRequest struct { Method string `json:",omitempty"` URL *url.URL `json:",omitempty"` Proto string `json:",omitempty"` // "HTTP/1.0" ProtoMajor int `json:",omitempty"` // 1 ProtoMinor int `json:",omitempty"` // 0 Header http.Header `json:",omitempty"` Body []byte `json:",omitempty"` ContentLength int64 `json:",omitempty"` TransferEncoding []string `json:",omitempty"` Close bool `json:",omitempty"` Host string `json:",omitempty"` Form url.Values `json:",omitempty"` PostForm url.Values `json:",omitempty"` // Go 1.1 MultipartForm *multipart.Form `json:",omitempty"` Trailer http.Header `json:",omitempty"` RemoteAddr string `json:",omitempty"` RequestURI string `json:",omitempty"` TLS *tls.ConnectionState `json:",omitempty"` }
func ToSerializedRequest ¶
func ToSerializedRequest(req http.Request) (sr SerializedRequest)
func (SerializedRequest) Equal ¶
func (sr SerializedRequest) Equal(sr1 SerializedRequest) (equal bool)
func (SerializedRequest) ToHttpRequest ¶
func (sr SerializedRequest) ToHttpRequest() (req http.Request)
type SerializedResponse ¶
type SerializedResponse struct { Status string // e.g. "200 OK" StatusCode int // e.g. 200 Proto string // e.g. "HTTP/1.0" ProtoMajor int // e.g. 1 ProtoMinor int // e.g. 0 Header http.Header Body []byte ContentLength int64 TransferEncoding []string Close bool Uncompressed bool Trailer http.Header TLS *tls.ConnectionState }
func ToSerializedResponse ¶
func ToSerializedResponse(resp http.Response) (sr SerializedResponse)
func (SerializedResponse) Equal ¶
func (sr SerializedResponse) Equal(sr1 SerializedResponse) (equal bool)
func (SerializedResponse) ToHttpResponse ¶
func (sr SerializedResponse) ToHttpResponse() (resp http.Response)
type TRSHTTPLocal ¶
type TRSHTTPLocal struct { Logger *logrus.Logger CACertPool *x509.CertPool ClientCert tls.Certificate // contains filtered or unexported fields }
func (*TRSHTTPLocal) Alive ¶
func (tloc *TRSHTTPLocal) Alive() (bool, error)
func (*TRSHTTPLocal) Cancel ¶
func (tloc *TRSHTTPLocal) Cancel(taskList *[]HttpTask)
func (*TRSHTTPLocal) Cleanup ¶
func (tloc *TRSHTTPLocal) Cleanup()
func (*TRSHTTPLocal) Close ¶
func (tloc *TRSHTTPLocal) Close(taskList *[]HttpTask)
func (*TRSHTTPLocal) CreateTaskList ¶
func (tloc *TRSHTTPLocal) CreateTaskList(source *HttpTask, numTasks int) []HttpTask
func (*TRSHTTPLocal) Init ¶
func (tloc *TRSHTTPLocal) Init(serviceName string, logger *logrus.Logger) error
Initialize a local HTTP task system.
ServiceName: Name of running service/application. Return: Error string if something went wrong.
func (*TRSHTTPLocal) Launch ¶
func (tloc *TRSHTTPLocal) Launch(taskList *[]HttpTask) (chan *HttpTask, error)
func (*TRSHTTPLocal) SetSecurity ¶
func (tloc *TRSHTTPLocal) SetSecurity(inParams interface{}) error
type TRSHTTPLocalSecurity ¶
type TRSHTTPRemote ¶
type TRSHTTPRemote struct { Logger *logrus.Logger KafkaInstance *tkafka.TRSKafka // contains filtered or unexported fields }
func (*TRSHTTPRemote) Alive ¶
func (tloc *TRSHTTPRemote) Alive() (bool, error)
func (*TRSHTTPRemote) Cancel ¶
func (tloc *TRSHTTPRemote) Cancel(taskList *[]HttpTask)
func (*TRSHTTPRemote) Cleanup ¶
func (tloc *TRSHTTPRemote) Cleanup()
Clean up a Remote HTTP task system.
func (*TRSHTTPRemote) Close ¶
func (tloc *TRSHTTPRemote) Close(taskList *[]HttpTask)
func (*TRSHTTPRemote) CreateTaskList ¶
func (tloc *TRSHTTPRemote) CreateTaskList(source *HttpTask, numTasks int) []HttpTask
func (*TRSHTTPRemote) Init ¶
func (tloc *TRSHTTPRemote) Init(serviceName string, logger *logrus.Logger) error
func (*TRSHTTPRemote) Launch ¶
func (tloc *TRSHTTPRemote) Launch(taskList *[]HttpTask) (chan *HttpTask, error)
func (*TRSHTTPRemote) SetSecurity ¶
func (tloc *TRSHTTPRemote) SetSecurity(inParams interface{}) error
type TrsAPI ¶
type TrsAPI interface { Init(serviceName string, logger *logrus.Logger) error SetSecurity(params interface{}) error CreateTaskList(source *HttpTask, numTasks int) []HttpTask Launch(taskList *[]HttpTask) (chan *HttpTask, error) Check(taskList *[]HttpTask) (running bool, err error) Cancel(taskList *[]HttpTask) Close(taskList *[]HttpTask) Alive() (ok bool, err error) Cleanup() }
Click to show internal directories.
Click to hide internal directories.