Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheStater ¶
type CacheStater interface { // Subscribe for updates Subscribe(ctx context.Context, onStartFn state.SubOnStart, onMessageFn state.SubOnMessage, channels ...string) error // GetGroup returns the requested group with/without modules GetGroup(ctx context.Context, orgID, scanGroupID int, wantModules bool) (*am.ScanGroup, error) }
CacheStater is for interfacing with a state management system (see coordinator/state/redis for implementation)
type ScanGroupCache ¶
type ScanGroupCache struct {
// contains filtered or unexported fields
}
func NewScanGroupCache ¶
func NewScanGroupCache() *ScanGroupCache
func (*ScanGroupCache) Clear ¶
func (s *ScanGroupCache) Clear(key string)
func (*ScanGroupCache) Get ¶
func (s *ScanGroupCache) Get(key string) *am.ScanGroup
Get a module configuration via the key
func (*ScanGroupCache) GetByIDs ¶
func (s *ScanGroupCache) GetByIDs(orgID, groupID int) *am.ScanGroup
GetByIDs returns the scangroup for the specified org/group
func (*ScanGroupCache) MakeGroupKey ¶
func (s *ScanGroupCache) MakeGroupKey(orgID, groupID int) string
MakeGroupKey from org/group id
type ScanGroupSubscriber ¶
type ScanGroupSubscriber struct {
// contains filtered or unexported fields
}
ScanGroupSubscriber manage scan group cache and state
func NewScanGroupSubscriber ¶
func NewScanGroupSubscriber(exitContext context.Context, state CacheStater) *ScanGroupSubscriber
NewScanGroupSubscriber returns a scan group cache state subscriber for listening to scan group updates and handling the caching. This will be re-used in most (if not all) modules.
func (*ScanGroupSubscriber) ChannelOnMessage ¶
func (s *ScanGroupSubscriber) ChannelOnMessage(channel string, data []byte) error
ChannelOnMessage when we receieve updates to scan groups/other state.
func (*ScanGroupSubscriber) ChannelOnStart ¶
func (s *ScanGroupSubscriber) ChannelOnStart() error
ChannelOnStart when we are subscribed to listen for group/other state updates
func (*ScanGroupSubscriber) GetGroupByIDs ¶
func (s *ScanGroupSubscriber) GetGroupByIDs(orgID, groupID int) (*am.ScanGroup, error)
GetGroupByIDs using the orgID/groupID first check if it is in our cache, if not grab the scan group from our state.