fleet/server/kolide/query_results.go
Zachary Wasserman 262a48f8eb Datastores for buffering distributed query results (#346)
A new datastore interface is needed for buffering incoming distributed query results to be sent to the client. This PR attempts to define and implement that interface.

It is intended that the ReadChannel() method be used by the goroutine that will push query results down a websocket to the client. Passing the results through this channel will allow that goroutine to perform a select on both the channel and the websocket, in order to properly handle IO.
2016-10-31 15:51:19 -07:00

18 lines
642 B
Go

package kolide
import "golang.org/x/net/context"
// QueryResultStore defines functions for sending and receiving distributed
// query results over a pub/sub system. It is implemented by structs in package
// pubsub.
type QueryResultStore interface {
// WriteResult writes a distributed query result submitted by an
// osqueryd client
WriteResult(result DistributedQueryResult) error
// ReadChannel returns a channel to be read for incoming distributed
// query results. Channel values should be either
// DistributedQueryResult or error
ReadChannel(ctx context.Context, query DistributedQueryCampaign) (<-chan interface{}, error)
}