httprunner

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPRunner

type HTTPRunner struct {
	// contains filtered or unexported fields
}

HTTPRunner is an implementation of FetcherRunner that run a HTTP server and tick when it receives request to a certain endpoints.

func NewHTTPRunner

func NewHTTPRunner(options ...Option) (*HTTPRunner, error)

NewHTTPRunner creates a new instance of HTTPRunner.

func (*HTTPRunner) GetAuthDataTicker

func (h *HTTPRunner) GetAuthDataTicker() <-chan time.Time

GetAuthDataTicker returns the auth data ticker.

func (*HTTPRunner) GetBlockTicker

func (h *HTTPRunner) GetBlockTicker() <-chan time.Time

GetBlockTicker returns the block ticker.

func (*HTTPRunner) GetGlobalDataTicker

func (h *HTTPRunner) GetGlobalDataTicker() <-chan time.Time

GetGlobalDataTicker returns the global data ticker.

func (*HTTPRunner) GetOrderbookTicker

func (h *HTTPRunner) GetOrderbookTicker() <-chan time.Time

GetOrderbookTicker returns the order book ticker.

func (*HTTPRunner) GetRateTicker

func (h *HTTPRunner) GetRateTicker() <-chan time.Time

GetRateTicker returns the rate ticker.

func (*HTTPRunner) Start

func (h *HTTPRunner) Start() error

Start initializes and starts the ticker HTTP server. It returns an error if the server is started already. It is guaranteed that the HTTP server is ready to serve request after this method is returned. The HTTP server is listened on all network interfaces.

func (*HTTPRunner) Stop

func (h *HTTPRunner) Stop() error

Stop stops the HTTP server. It returns an error if the server is already stopped.

type Option

type Option func(hr *HTTPRunner)

Option is the option to setup the HTTPRunner on creation.

func WithBindAddr added in v0.1.2

func WithBindAddr(bindAddr string) Option

WithBindAddr setups the HTTPRunner instance with the given bindAddr. Without this option, NewHTTPRunner will use a random bindAddr.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the HTTP ticker server.

func NewServer

func NewServer(runner *HTTPRunner, bindAddr string) *Server

NewServer creates a new instance of HttpRunnerServer.

func (*Server) Start

func (s *Server) Start() error

Start creates the HTTP server if needed and starts it. The HTTP server is running in foreground. This function always return a non-nil error.

func (*Server) Stop

func (s *Server) Stop() error

Stop shutdowns the HTTP server and free the resources. It returns an error if the server is shutdown already.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL