mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
This change optimizes live queries by pushing the computation of query targets to the creation time of the query, and efficiently caching the targets in Redis. This results in a huge performance improvement at both steady-state, and when running live queries. - Live queries are stored using a bitfield in Redis, and takes advantage of bitfield operations to be extremely efficient. - Only run Redis live query test when REDIS_TEST is set in environment - Ensure that live queries are only sent to hosts when there is a client listening for results. Addresses an existing issue in Fleet along with appropriate cleanup for the refactored live query backend.
31 lines
959 B
Go
31 lines
959 B
Go
// Automatically generated by mockimpl. DO NOT EDIT!
|
|
|
|
package mock
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/kolide/fleet/server/kolide"
|
|
)
|
|
|
|
var _ kolide.TargetStore = (*TargetStore)(nil)
|
|
|
|
type CountHostsInTargetsFunc func(hostIDs, labelIDs []uint, now time.Time) (kolide.TargetMetrics, error)
|
|
type HostIDsInTargetsFunc func(hostIDs, labelIDs []uint) ([]uint, error)
|
|
|
|
type TargetStore struct {
|
|
CountHostsInTargetsFunc CountHostsInTargetsFunc
|
|
CountHostsInTargetsFuncInvoked bool
|
|
HostIDsInTargetsFunc HostIDsInTargetsFunc
|
|
HostIDsInTargetsFuncInvoked bool
|
|
}
|
|
|
|
func (s *TargetStore) CountHostsInTargets(hostIDs, labelIDs []uint, now time.Time) (kolide.TargetMetrics, error) {
|
|
s.CountHostsInTargetsFuncInvoked = true
|
|
return s.CountHostsInTargetsFunc(hostIDs, labelIDs, now)
|
|
}
|
|
|
|
func (s *TargetStore) HostIDsInTargets(hostIDs, labelIDs []uint) ([]uint, error) {
|
|
s.HostIDsInTargetsFuncInvoked = true
|
|
return s.HostIDsInTargetsFunc(hostIDs, labelIDs)
|
|
}
|