Documentation ¶
Overview ¶
Package stream provides a client and a server to consume search results as stream.
Index ¶
Constants ¶
const DefaultSSEPath = "/stream"
DefaultSSEPath is the path used by zoekt-webserver.
Variables ¶
This section is empty.
Functions ¶
func NewSamplingSender ¶
NewSamplingSender is a zoekt.Sender that samples stats events to avoid sending many empty stats events over the wire.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for StreamSearch. Do not create directly, call NewClient.
func NewClient ¶
NewClient returns a client which implements StreamSearch. If httpClient is nil, http.DefaultClient is used.
func (*Client) StreamSearch ¶
func (c *Client) StreamSearch(ctx context.Context, q query.Q, opts *zoekt.SearchOptions, streamer zoekt.Sender) error
StreamSearch returns search results as stream by calling streamer.Send(event) for each event returned by the server.
Error events returned by the server are returned as error. Context errors are recreated and returned on a best-efforts basis.
type Doer ¶
Doer implements the minimal surface of *http.Client and http.RoundTripper needed by Client.
type SenderFunc ¶
type SenderFunc func(result *zoekt.SearchResult)
SenderFunc is an adapter to allow the use of ordinary functions as Sender. If f is a function with the appropriate signature, SenderFunc(f) is a Sender that calls f.
func (SenderFunc) Send ¶
func (f SenderFunc) Send(result *zoekt.SearchResult)