Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextReader ¶
type ContextReader interface { // Get reads from the url and returns DefaultClient errors // This operation's deadline and cancellation depends on ctx // You should close the Body when you finished reading from it Get(ctx context.Context) (*http.Response, error) }
ContextReader reads from the url with the specified context
type CtxReader ¶
type CtxReader struct {
// contains filtered or unexported fields
}
CtxReader implements ContextReader interface
type MockCtxReader ¶
type MockCtxReader struct { ContextReadFunc func(ctx context.Context) (*http.Response, error) // contains filtered or unexported fields }
func NewMockCtxReader ¶
func NewMockCtxReader(url string) *MockCtxReader
type MockExpvarReader ¶
type MockExpvarReader struct { StartFunc func() chan struct{} // contains filtered or unexported fields }
func NewMockExpvarReader ¶
func NewMockExpvarReader(jobs chan context.Context, resCh chan *ReadJobResult, f func(context.Context)) *MockExpvarReader
func (*MockExpvarReader) JobChan ¶
func (m *MockExpvarReader) JobChan() chan context.Context
func (*MockExpvarReader) ResultChan ¶
func (m *MockExpvarReader) ResultChan() chan *ReadJobResult
func (*MockExpvarReader) Start ¶
func (m *MockExpvarReader) Start() chan struct{}
type ReadJobResult ¶
type ReadJobResult struct { Time time.Time Res io.ReadCloser Err error }
ReadJobResult is constructed everytime a new record is fetched. The time is set after the request was successfully read
type TargetReader ¶
type TargetReader interface { // The engine will send a signal to this channel to inform the reader when to read from the target. // The engine never blocks if the reader is not able to process the requests. It is the reader's job to provide large enough // channel, otherwise it will cause goroutine leakage. // The context might be canceled depending how the user sets the timeouts. JobChan() chan context.Context // The engine runs the reading job in another goroutine. Therefore it is the reader's job not to send send a lot of results back // to the engine, otherwise it might cause crash on readers and the application itself. ResultChan() chan *ReadJobResult // The reader's loop should be inside a goroutine, and return a channel. // This channel should be closed one it's work is finished and wants to quit. Start() chan struct{} Name() string }
TargetReader recieves job requests to read from the target, and returns its success results with in a JobResult channel.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.