live_query

package
v0.0.0-...-98a7958 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

package live_query implements an interface for storing and retrieving live queries.

Design

This package operates by storing a single redis key for host targeting information. This key has a known prefix, and the data is a bitfield representing _all_ the hosts in fleet.

In this model, a live query creation is a few redis writes. While a host checkin needs to scan the keyspace for matching key, and then fetch the bitfield value for their id. While this scan might be expensive, this model fits very well with having a lot of hosts and very few live queries.

A contrasting model, for the case of fewer hosts, but a lot of live queries, is to have a set per host. In this case, the LQ is pushed into each host's set. This model has many potential writes for LQ creation, but a host checkin has very few.

We believe that normal fleet usage has many hosts, and a small number of live queries targeting all of them. This was a big factor in choosing this implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisLiveQuery

func NewRedisLiveQuery(pool *redis.Pool) *redisLiveQuery

NewRedisQueryResults creats a new Redis implementation of the QueryResultStore interface using the provided Redis connection pool.

Types

type MockLiveQuery

type MockLiveQuery struct {
	mock.Mock
	kolide.LiveQueryStore
}

func (*MockLiveQuery) QueriesForHost

func (m *MockLiveQuery) QueriesForHost(hostID uint) (map[string]string, error)

func (*MockLiveQuery) QueryCompletedByHost

func (m *MockLiveQuery) QueryCompletedByHost(name string, hostID uint) error

func (*MockLiveQuery) RunQuery

func (m *MockLiveQuery) RunQuery(name, sql string, hostIDs []uint) error

func (*MockLiveQuery) StopQuery

func (m *MockLiveQuery) StopQuery(name string) error

Jump to

Keyboard shortcuts

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